help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Pantxo
Subject: Re: Differing fonts between Octave and other programs with the same fontname
Date: Sun, 1 Dec 2019 18:50:56 -0600 (CST)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]