MATLAB Answers

Why does MATLAB not show any newly installed fonts since updating to Windows version 1809?

209 views (last 30 days)
In the past, I could use installed third-party fonts inside MATLAB. After upgrading to Windows version 1809 (OS build: 17763.194) though, newly installed fonts do not show in MATLAB.
I tested this by deleting one font 'Bitstream Vera Sans Mono' which previously displayed in MATLAB, and then installing it again. MATLAB does not show the re-installed font.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Feb 2019
Edited: MathWorks Support Team on 7 Feb 2019
The font picker issue arose because Windows 10 version 1809 added a feature which allows a font to be installed only for a specific user rather than for all users. This caused inconsistency in the Java API, which retrieves the list of all the fonts for a specific user.
There are 3 workarounds for this issue.
Workaround-1: Install the font for all users.
To install the font for all users, right-click the font and select 'Install for all users'.
The font becomes visible for all users in font picker.
Workaround-2: Copy the font to /jre/lib/fonts folder.
To copy the font to the /jre/lib/fonts folder of your system's Java install location, follow these steps:
1. Run this code in MATLAB to determine the /jre/lib/fonts folder location.
fullfile(java.lang.System.getProperty('java.home').toCharArray', 'lib', 'fonts')
2. Manually copy the font file to the /jre/lib/fonts folder.
Alternatively, you can run this command in MATLAB:
copyfile('\path\to\font\file\font.ttf', fullfile(java.lang.System.getProperty('java.home').toCharArray', 'lib', 'fonts')) % Replace 'path\to\font\file\font.ttf' with the location of the font file.
3. Verify that the font was successfully copied by running the following code in MATLAB.
dir(fullfile(java.lang.System.getProperty('java.home').toCharArray', 'lib', 'fonts'))
4. Restart MATLAB. The copied font is now visible in the font picker.
Workaround-3: Use Settings to set the font
If the above two workarounds are not feasible due to the lack of admin privileges, and the font can only be installed for a specific user, you can set the font using settings.
Run this code in MATLAB to set the font settings:
s = settings;
s.matlab.fonts.codefont.Name.PersonalValue = '<Font Name>' % Replace <Font Name> with the name of the font.
The font name is listed in Windows Font Viewer which can be opened by double-clicking the font file or right clicking the font file and selecting 'Preview' option. Alternatively, run this code in MATLAB to determine the font name:
font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, java.io.File('\path\to\font\file\font.ttf')); % Replace 'path\to\font\file\font.ttf' with the location of the font file.
font.getFamily().toCharArray'

  1 Comment

LukasJ
LukasJ on 21 Apr 2020
Unfortunately this doesn't work for me. I am working on Matlab 2017 b and I tried every option. Somehow "settings" have been changed quite a lot. All I get is:
s = settings;
s.matlab
SettingsGroup 'matlab' with properties:
apps: [1×1 SettingsGroup]
appdesigner: [1×1 SettingsGroup]
general: [1×1 SettingsGroup]
editor: [1×1 SettingsGroup]
errorrecovery: [1×1 SettingsGroup]
toolboxpathcache: [1×1 SettingsGroup]
ui: [1×1 SettingsGroup]
Where I couldn't find any "font" option in the section shown above.

Sign in to comment.

More Answers (1)

Tags

No tags entered yet.

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by