Created
March 14, 2018 10:24
-
-
Save jfversluis/69359f8c47479df947d2a66d076020c6 to your computer and use it in GitHub Desktop.
Enumerating all the fonts in an iOS app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override bool FinishedLaunching(UIApplication app, NSDictionary options) | |
{ | |
// Nifty helper to get all fonts with the right names in your console | |
#if DEBUG | |
var fontList = new StringBuilder(); | |
var familyNames = UIFont.FamilyNames; | |
foreach (var familyName in familyNames) | |
{ | |
fontList.Append(String.Format("Family: {0}\n", familyName)); | |
Console.WriteLine("Family: {0}\n", familyName); | |
var fontNames = UIFont.FontNamesForFamilyName(familyName); | |
foreach (var fontName in fontNames) | |
{ | |
Console.WriteLine("\tFont: {0}\n", fontName); | |
fontList.Append(String.Format("\tFont: {0}\n", fontName)); | |
} | |
}; | |
#endif | |
// ... Rest of the initialisation code here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment