help-octave
[Top][All Lists]
Advanced

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

Re: How to set different fonts (question answered)


From: Brett Green
Subject: Re: How to set different fonts (question answered)
Date: Fri, 30 Aug 2019 10:52:04 -0400

The documentation in < https://octave.org/doc/interpreter/Text-Properties.html > is fairly clear. I think the only possible benefit would be a few possible options as examples. For instance, we have the fontunits entry:
fontunits: "centimeters" | "inches" | "normalized" | "pixels" | {"points"}

fontname's entry is:
fontname: string, def. "*"

What about something like this?
fontname: string, def. "*", other options e.g.  "Helvetica" | "Courier New" | ...

Mostly, the reason I had trouble using this property was that I had trouble finding it. My go-to is the "walk-through" part of the documentation, e.g. here: < https://octave.org/doc/interpreter/Plot-Annotations.html >. Though they are treasure troves of functionality, properties lists like < https://octave.org/doc/interpreter/Text-Properties.html > are less easy to find and to learn from. Perhaps that's only a fault of mine, though.

- Brett Green


On Fri, Aug 30, 2019 at 10:33 AM Nicholas Jankowski <address@hidden> wrote:
Assuming there might be users after you with similar questions, do you have a suggestion for revised documentation text that would have made this more clear/useful? 

On Fri, Aug 30, 2019 at 10:20 AM Brett Green <address@hidden> wrote:
I would like to be able to use a LaTeX math mode-like font for some plots. (I'm running Octave 5.1.0 on Windows 10.) The documentation at
suggests using the fontname property for this, but its instructions do not specify

Two suggestions came up when I searched. The first was just to use a font name, like
set(gca,"This Is A Font","defaulttextfontname","Helvetica")
This works, which is great.

The second was to give the directory and file like this:
title("This Is A Font","fontname","C:\Windows\Fonts\cambria.ttc")
While this doesn't return an error, it just prints the title with the default font.

In the end, all I had to do was
title("This Is A Font","fontname","Cambria Math")
and it worked. I had forgotten that I had not tried the simple string ("Cambria Math" here) with the property "fontname" intead of "defaulttextfontname".

I was surprised and impressed that I didn't need to specify a directory for an external font. Kudos to everyone who worked on this, and on Octave in general!

Though I was able to answer my question in the end, I wanted to submit this to the mailing list archives in case it could help someone else in the future.

- Brett Green


reply via email to

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