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 UIControl object with a font called 'MyFont'. When you call listfonts with the object as input, the sorted list includes the object font and the system fonts.

c = uicontrol('Style','text','String','My Text','FontName','MyFont');
d = listfonts(c)
 d =
    {'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 object.

Tips

  • Some system fonts cannot be rendered in MATLAB®. To preview fonts that MATLAB can render in figure windows, use the uisetfont function. Alternatively, in the Environment section of the Home tab, select Preferences > Fonts > Custom to preview the available fonts that MATLAB can render.

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

Version History

Introduced in R2007a

See Also