This works for me on linux, both onscreen and in printout (for raster format
or pdf using the -svgconvert option). Octave uses fontconfig to find font
files in your system, and eventually fallback to a suitable font. You can
see what font file is chosen using the fc-match command, e.g.:
fontname = "Latin Modern Math";
fcmatch_binary = "fc-match"; # Add .exe on Windows
system (sprintf ('%s "%s"', fcmatch_binary, fontname))
On my system this returns
latinmodern-math.otf: "Latin Modern Math" "Regular"
If you just installed a new font, you may need to run "fc-cache" in order to
update the font cache and then restart Octave:
system ("fc-cache") # Add .exe on Windows
HTH,
Pantxo
--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Thank you, that gives some insight. I'm still having trouble, unforunately.
First off, I'm running Octave 5.1.0 on Windows 10 - I should have included that earlier.
Apparently, it's been using Cambria Math:
>> fontname = "Latin Modern Math";
>> fcmatch_binary = "fc-match"; # Add .exe on Windows
>> system (sprintf ('%s "%s"', fcmatch_binary, fontname))
cambria.ttc: "Cambria Math" "Regular"
ans = 0
>> system ("fc-cache") # Add .exe on Windows
ans = 0
Running your code and restarting Octave doesn't change the result; it still picks out Cambria Math.
I thought perhaps it was the install location. Most of my fonts are in
C:\Windows\Fonts
Two that I've downloaded, including Latin Modern Math, are in
C:\Users\Brett\AppData\Local\Microsoft\Windows\Fonts
I tried reinstalling by double-clicking the OTF file for Latin Modern Math in
AppData, at which point Windows asserted it was not a valid font and automatically deleted it. I re-downloaded and reinstalled it. The new font installed the
AppData location as well, and also was determined to be invalid and deleted by Windows.
I'm wondering if Octave only searched C:\Windows\Fonts
for fonts and hence didn't find them. I do not
know.in what way they could be invalid, as MS Word was still able to use any the font just fine before it was deleted, after it was reinstalled, and again, even though Windows would go on do identify the font as invalid and delete it.
For what it's worth, I've tried calling .
>> fcmatch_binary = "fc-match"; # Add .exe on Windows
>> system (sprintf ('%s "%s"', fcmatch_binary, fontname))
after changing fontname to see how that affects things. If it's anything but "Latin Modern Math", the font that is returned is Verdana. I think Cambria Math was the last font I used (successfully) in Octave before trying Latin Modern Math.
Finally... as seen in the attached image, whatever font was used isn't actually Cambria Math or Verdana either.