Custom font getting cut off at bottom => UIFont????

XamtasticXamtastic Member ✭✭✭

Having an issue where a custom font (FontAwesome) is not rendering properly. The bottom is getting cut off, so for example you can't see the loop in a lowercase "g" and looks like a backwards "p".

From what it seems I can correct this with the ascender/descender ?

Anyone know how to use it???

Thanks!

Tagged:

Best Answer

Answers

  • XamtasticXamtastic Member ✭✭✭

    I can see what you're going for and spot on!

    However I'm not able to get that working; mostly due to PEBCAK, not sure what to do/how to use it :) other than putting it into iOS instance.

    Also, I need to do this with Buttons and the properties there were different so that venture didn't end well either haha

  • XamtasticXamtastic Member ✭✭✭

    This is what I am doing, but not sure how to override the loading of UILabel so I don't have to add a custom controller on EVERY page.

        [assembly: ExportRenderer(typeof(UILabel), typeof(UILabel))]  
        namespace myApp.iOS  
        {  
            public class FontAwesome : UILabel  
            {  
                public override void DrawText(CGRect rect)
                {
                    if (Font.Name == "FontAwesome")
                    {
                        var newBounds = new CGRect(rect.X, rect.Y - 2, rect.Width, rect.Height);
                        base.DrawText(newBounds);
                    }
                    else
                    {
                        base.DrawText(rect);
                    }
                }
            }  
        }   
    
  • XamtasticXamtastic Member ✭✭✭

    Totally PEBCAK......I removed the "[assembly: Expor...."

    Everything works. Thanks!

  • XamtasticXamtastic Member ✭✭✭

    I lost the "Awesome" in Font Awesome........... custom font is gone

Sign In or Register to comment.