# Differing fonts between Octave and other programs with the same fontname

8 messages
Open this post in threaded view
|

## Differing fonts between Octave and other programs with the same fontname

 For consistency with the body text of my work, I would like all my plots to use the font Latin Modern. I downloaded and installed the font, and have been able to use it in Octave.by calling e.g.title('Text (hello, 123) \alpha')set(gca,"fontname","Latin Modern Math","fontsize",20)The font changes - it is no longer the default Octave font. However, it's not the font I'm looking for - it doesn't match the default LaTeX font. Strangely, when I use the same font in another program such as MS Word, I get the desired font. Can anyone explain what is going on here, and suggest how to address it?On a side note, how does one actually use math mode with $? If I call something liketitle('$Text (hello, 123) \alpha$')the$ are interpreted literally. The documentation mentions they can be used in Octave, so I thought to try them and see how it affected my problem, but I couldn't get them to work and the section of the documentation on the text interpreter property didn't explain beyond a passing mention.- Brett Green Octave text.png (26K) Download Attachment
Open this post in threaded view
|

## Re: Differing fonts between Octave and other programs with the same fontname

 On Sun, Dec 1, 2019 at 3:37 PM Brett Green <[hidden email]> wrote: > > For consistency with the body text of my work, I would like all my plots to use the font Latin Modern. I downloaded and installed the font, and have been able to use it in Octave.by calling e.g. > title('Text (hello, 123) \alpha') > set(gca,"fontname","Latin Modern Math","fontsize",20) > The font changes - it is no longer the default Octave font. However, it's not the font I'm looking for - it doesn't match the default LaTeX font. Strangely, when I use the same font in another program such as MS Word, I get the desired font. Can anyone explain what is going on here, and suggest how to address it? Did you restart octave after you instaleed the font? If you print it to svg file, which font do you get in there? > > On a side note, how does one actually use math mode with $? If I call something like > title('$Text (hello, 123) \alpha$') > the$ are interpreted literally. The documentation mentions they can be used in Octave, so I thought to try them and see how it affected my problem, but I couldn't get them to work and the section of the documentation on the text interpreter property didn't explain beyond a passing mention. I think this has been fixed lately in dev. At least your code works on my computer. (Output of print "t1.svg" and print "t1.pdf" "-svgconvert" are attached.) Dmitri. -- t1.svg (8K) Download Attachment t1.pdf (9K) Download Attachment
Open this post in threaded view
|

## Re: Differing fonts between Octave and other programs with the same fontname

 Did you restart octave after you instaleed the font? If you print it to svg file, which font do you get in there? Yes - in fact, I actually first installed the font some months ago, and just hadn't gotten around to addressing this issue.The font is the same when printed to an SVG with print. In fact, it displays with the unusual font in the plot window, in addition to the saved figures.The most mysterious part is that a non-default font is being used at all. I have no idea what font is actually being used. t1.svg (8K) Download Attachment
Open this post in threaded view
|

## Re: Differing fonts between Octave and other programs with the same fontname

 In reply to this post by BGreen BGreen wrote > For consistency with the body text of my work, I would like all my plots > to > use the font Latin Modern. I downloaded and installed the font, and have > been able to use it in Octave.by calling e.g. > title('Text (hello, 123) \alpha') > set(gca,"fontname","Latin Modern Math","fontsize",20) > The font changes - it is no longer the default Octave font. However, it's > not the font I'm looking for - it doesn't match the default LaTeX font. > Strangely, when I use the same font in another program such as MS Word, I > get the desired font. Can anyone explain what is going on here, and > suggest > how to address it? > > On a side note, how does one actually use math mode with $? If I call > something like > title('$Text (hello, 123) \alpha$') > the$ are interpreted literally. The documentation mentions they can be > used in Octave, so I thought to try them and see how it affected my > problem, but I couldn't get them to work and the section of the > documentation on the text interpreter property didn't explain beyond a > passing mention. > > - Brett Green > > > > > Octave text.png (26K) > <https://octave.1599824.n4.nabble.com/attachment/4694774/0/Octave%20text.png>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
Open this post in threaded view
|

## Re: Differing fonts between Octave and other programs with the same fontname

 In reply to this post by BGreen BGreen wrote > On a side note, how does one actually use math mode with $? If I call > something like > title('$Text (hello, 123) \alpha$') > the$ are interpreted literally. The documentation mentions they can be > used in Octave, so I thought to try them and see how it affected my > problem, but I couldn't get them to work and the section of the > documentation on the text interpreter property didn't explain beyond a > passing mention. > > - Brett Green > > > > > Octave text.png (26K) > <https://octave.1599824.n4.nabble.com/attachment/4694774/0/Octave%20text.png>For the side note, Octave doesn't have a "latex" interpreter and thus does not interpret "$" math environment. The only way to have LaTeX fonts and math typesetting (in printout only) is to use pdflatex(standalone) or epslatex formats, e.g.: title ('$Text (hello, 123) \alpha\$', "interpreter", "latex"); # "latex" is the same as "none"   print -dpdflatexstandalone foo.tex   system "pdflatex foo.tex"   open foo.pdf HTH, Pantxo -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|