MATLAB Answers


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

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.


No tags entered yet.




1 Answer

Answer by MathWorks Support Team on 7 Feb 2019
Edited by MathWorks Support Team on 7 Feb 2019
 Accepted Answer

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,'\path\to\font\file\font.ttf')); % Replace 'path\to\font\file\font.ttf' with the location of the font file.


Sign in to comment.