Quickest Way to Get List of Font Names in any Font Family (think LLDB)

Fri, Dec 13

There are many ways to get a list of fonts names for a font family on iOS, for example: looping or via block. However, I am often looking for a font name for inclusion in an app as a one-time occurrence, so writing a chunk of code I’ll throw away seems superfluous.

Here is another approach, that is much quicker, with just two lines in the LLDB debugger:

List Font Names in Font Family

Step 1 – Set a breakpoint in any application.
Step 2 – At the (lldb) prompt enter:

po [[UIFont familyNames] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]

You’ll now have a list of all font family names in sorted order:

<__NSArrayI 0xa139990>(
Academy Engraved LET,
Al Nile,
American Typewriter,
Apple Color Emoji,
Apple SD Gothic Neo,
Arial,
Arial Hebrew,
Arial Rounded MT Bold,
Avenir,
...

Step 3 – Mark/copy a font name from the list
Step 4 – Paste selected font name into the po command shown below (replacing “Arial”):

po [UIFont fontNamesForFamilyName:@"Arial"]

You will now have a list of the font names in the font family:

<__NSCFArray 0xa238570>(
ArialMT,
Arial-BoldItalicMT,
Arial-ItalicMT,
Arial-BoldMT
)

Copy/paste the font name and you’re good to go.

UIFont *font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:30];