Skip to content

Instantly share code, notes, and snippets.

@chkn
Last active April 10, 2019 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chkn/a2cede0380080c6ee47dddc3178fad68 to your computer and use it in GitHub Desktop.
Save chkn/a2cede0380080c6ee47dddc3178fad68 to your computer and use it in GitHub Desktop.
static class Extensions {
#if __IOS__
public static Font ToFont (this UIKit.UIFont font)
{
return Font.OfSize (font.Name, font.PointSize);
}
#endif
}
public static class Fonts {
public static Font LargeTitle =>
#if __IOS__
UIKit.UIFont.GetPreferredFontForTextStyle (UIKit.UIFontTextStyle.LargeTitle).ToFont ();
#else
Font.SystemFontOfSize (NamedSize.Large, FontAttributes.Bold);
#endif
public static Font ThinBody =>
#if __IOS__
UIKit.UIFontMetrics.DefaultMetrics.GetScaledFont (UIKit.UIFont.SystemFontOfSize (18, UIKit.UIFontWeight.UltraLight)).ToFont ();
#else
Font.Default;
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment