Main Content

Zoom and Change Desktop Fonts

You can change the zoom level, font size, name, and style used by tools in MATLAB®. You also can install new fonts to use with MATLAB.

Zoom

You can change the zoom level in the Editor and Live Editor. To change the zoom level, go to the View tab and select Zoom In, Zoom Out, or Reset Zoom.

Alternatively, you can change the zoom level using the keyboard shortcuts described in this table.

ActionKeyboard Shortcut
Zoom in and out

Ctrl+Mouse Scroll

On macOS systems, use Command+Mouse Scroll.

Zoom in

Ctrl+Plus

On macOS systems, use Command+Shift+Plus.

Zoom out

Ctrl+Minus

On macOS systems, use Command+Shift+Minus.

Reset Zoom

Ctrl+Alt+0

On macOS systems, use Command+Alt+0.

In MATLAB Online™, to change the zoom level, adjust the zoom settings for your web browser.

Change Font Size

You can change the font size in MATLAB using preferences or settings. This table describes how to change the font size for each tool.

ToolProcedure

Live Editor

Specify the code and text font size for the current document using the Customize Styles dialog box.

Go to the Live Editor tab, and in the Text section, click the Customize styles button .

For more information, see Format Text in the Live Editor.

To specify the code and text font size for all open documents and all new documents, use the matlab.fonts Settings. For example, this code changes the code font size in the Live Editor.

s = settings;
s.matlab.fonts.editor.code.Size.TemporaryValue = '26pt'

Code tools

  • Editor

  • Command Window

  • Command History

Specify the font size using font preferences.

On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and, in the Desktop code font section, select a font size. In MATLAB Online, these preferences are located under MATLAB > Appearance > Fonts.

Text-based tools

  • Current Folder browser

  • Workspace browser

  • Variables editor

Specify the font size using font preferences.

On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and in the Desktop text font section, clear the Use system font check box. Then, select a font size.

In MATLAB Online, changing the font size for text-based tools is not supported.

Charts

See Add Title and Axis Labels to Chart.

Change Font Name and Style

You can change the font name and style in MATLAB using several different methods, depending on the tool. This table describes how to change the font name and style for each tool in MATLAB.

ToolProcedure

Live Editor

Specify the code and text font name and font style for the current document using the Customize Styles dialog box.

Go to the Live Editor tab, and in the Text section, click the Customize styles button .

For more information, see Format Text in the Live Editor.

To specify the code and text font name and font style for all open documents and all new documents, use the matlab.fonts Settings. For example, this code changes the font name and style of normal text in the Live Editor.

s = settings;
s.matlab.fonts.editor.normal.Name.PersonalValue = 'Calibri';
s.matlab.fonts.editor.normal.Style.PersonalValue = {'bold'};

Code tools

  • Editor

  • Command Window

  • Command History

Specify the font name and style using font preferences.

On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and, in the Desktop code font section, select a font name and style. In MATLAB Online, these preferences are located under MATLAB > Appearance > Fonts.

By default, the code font is set to monospaced to preserve vertical alignment. When the font is set to monospaced, the actual displayed font in the Editor is different than the font displayed in the Command Window and Command History. This is because monospaced is a logical font, not a physical font. To avoid this discrepancy, specify the font name as a physical font, for example, Courier New.

Text-based tools

  • Current Folder browser

  • Workspace browser

  • Variables editor

Specify the font name and style using font preferences.

On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and, in the Desktop text font section, clear the Use system font check box. Then, select a font name and style. By default, the text font is set to your system font.

In MATLAB Online, changing the font name and style for text-based tools is not supported.

MATLAB web browser

Changing the font name and style is not supported.

To apply antialiasing and create a smoother desktop appearance on Linux® systems, select Use antialiasing to smooth desktop fonts. You must restart MATLAB for the preference to take effect. On Microsoft® Windows® and macOS platforms, MATLAB uses system setting for antialiasing.

Advanced Customization

You can further customize fonts in MATLAB by changing the font preferences for an individual tool. To change the font preferences for an individual tool, on the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts > Custom and choose a tool from the list of Desktop tools. Then, select the font to use:

  • Desktop code — Select this option to use the desktop code font for this tool.

  • Desktop text — Select this option to use the desktop text font for this tool.

  • Custom — Select this option to specify a custom font for this tool. Then, specify a font name, style, and size. Some options are not supported for all tools.

For example, to change the Editor font to a custom font, in the list of Desktop tools, select Editor. Then, in the Font to use section, select Custom and specify the desired font name, style, and size. In MATLAB Online, these preferences are located under MATLAB > Appearance > Fonts > Custom.

To customize code and text fonts in the Live Editor, use the Customize Styles dialog box or the matlab.fonts Settings. For more information, see Format Text in the Live Editor.

Default Font Preferences

This table shows the default font preferences for the tools in MATLAB. You can use this table to restore fonts to their original state.

Tool

Font to Use

Default Font

Command History

Desktop code

Monospaced, plain, 10 point

When the font is set to monospaced, the actual displayed font in the Editor is different than the font displayed in the Command Window and Command History. This is because monospaced is a logical font, not a physical font. To avoid this discrepancy, specify the font name as a physical font, for example, Courier New.

Command Window

Editor (and Shortcuts Editor)

Current Folder browser (and Path browser)

Desktop text

Your system's current font

Workspace browser

Variables editor

Function Browser

Profiler

Custom

Sans serif, plain, 10 point

Add Additional Fonts

You can add additional fonts to use with MATLAB. A common reason for adding additional fonts is to read files created in different languages.

To add a new font to use with MATLAB:

  1. Choose a font. The font must be compatible with MATLAB. MATLAB only includes compatible fonts in the font preferences.

    • For desktop components (such as the Command Window), figure windows, and uicontrols, fonts must be compatible with TrueType and Microsoft OpenType® fonts

    • For graphics objects, such as xlabel, ylabel, title, and text, fonts must be TrueType and Microsoft OpenType fonts

  2. Install the font. For details on installing fonts on your system, refer to the documentation for your system.

    Install the font in the /jre/lib/fonts folder where Java® software is installed on your system, for example, C:\Program Files\MATLAB\R2024a\sys\java\jre\win64\jre\lib\fonts.

  3. Restart MATLAB.

  4. Use the font in MATLAB by following the instructions in Change Font Name and Style.

In MATLAB Online, to add an additional font, install the font on your system. Then, go to the MATLAB > Appearance > Fonts > Custom preferences, select Custom in the Font to use sections and manually enter the new font name in the drop-down list.

See Also

Related Topics