Main Content

listfonts

List available system fonts

Description

d = listfonts returns an alphabetically sorted list of available system fonts.

example

d = listfonts(obj) returns available system fonts and includes the font name of the specified graphics object, if the object has FontName as a property.

example

Examples

collapse all

Call the listfonts function to return the list of available system fonts, with output similar in format to the one shown below.

d = listfonts
d =
    {'Agency FB'                      }
    {'Algerian'                       }
    {'Arial'                          }
    ... 
    {'Yu Gothic UI Semilight'         }
    {'ZapfChancery'                   }
    {'ZapfDingbats'                   }    

Create a label UI component with a font named "MyFont". When you call listfonts with the component as an input, the sorted list includes the component font and the system fonts.

lbl = uilabel(Text="My Text",FontName="MyFont");
d = listfonts(lbl)
 lbl =
    {'Agency FB'                      }
    {'Algerian'                       }
    {'Arial'                          }
    ... 
    {'MyFont'                         }
    ... 
    {'Yu Gothic UI Semilight'         }
    {'ZapfChancery'                   }
    {'ZapfDingbats'                   }

Input Arguments

collapse all

Graphics object, such as an Axes, Annotation, Illustration, or UI component object.

Tips

  • The list of system fonts returned by listfonts might be different than the set of fonts that MATLAB® can display. To preview font appearance in MATLAB, use the uisetfont function.

  • To determine an object's font name only, use dot notation to query the value of its FontName property.

  • To change the MATLAB desktop code font, in the Environment section of the Home tab, select Settings > Appearance > Fonts.

Version History

Introduced in R2007a

See Also