How to set different fonts (question answered)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set different fonts (question answered)

BGreen
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 | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

nrjank
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

BGreen
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 <[hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

nrjank

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.


this did come up  before (see the discussion at https://savannah.gnu.org/bugs/?50247) because there was an issues linking to pages with spaces in the names. that bug has an outstanding task of identifying which functions would benefit from document link updates now that the underlying issue is fixed.  maybe you could help identify other places where a simple link to follow would have made the search easier?


Reply | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

BGreen
Interesting; I'd never seen that discussion. While off the top of my head I don't remember any, I'll certainly keep that in mind for when I remember or next time I see things where a link could help. Thank you for sharing!

- Brett Green


On Fri, Aug 30, 2019 at 1:01 PM Nicholas Jankowski <[hidden email]> wrote:

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.


this did come up  before (see the discussion at https://savannah.gnu.org/bugs/?50247) because there was an issues linking to pages with spaces in the names. that bug has an outstanding task of identifying which functions would benefit from document link updates now that the underlying issue is fixed.  maybe you could help identify other places where a simple link to follow would have made the search easier?


Reply | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

BGreen
On Fri, Aug 30, 2019 at 4:18 PM Brett Green <[hidden email]> wrote:
Interesting; I'd never seen that discussion. While off the top of my head I don't remember any, I'll certainly keep that in mind for when I remember or next time I see things where a link could help. Thank you for sharing!

- Brett Green


On Fri, Aug 30, 2019 at 1:01 PM Nicholas Jankowski <[hidden email]> wrote:

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.


this did come up  before (see the discussion at https://savannah.gnu.org/bugs/?50247) because there was an issues linking to pages with spaces in the names. that bug has an outstanding task of identifying which functions would benefit from document link updates now that the underlying issue is fixed.  maybe you could help identify other places where a simple link to follow would have made the search easier?

Following up on this, where should I suggest places that links could be added? I see two options on savannah.gnu.org - the general help mailing list and the maintainers mailing list. I would assume the latter would be more appropriate, but it would be rude to invite myself in.

A recent question asked about bar graphs, and I think the user wanted to relabel the bins on the horizontal axis. I found a solution in the axes properties page, but only because I already knew to look there. The bar function reference and entry on the Two-Dimensional Plots page could link to this to explain how to alter bin labels.


Reply | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

Pantxo
BGreen wrote
> On Fri, Aug 30, 2019 at 4:18 PM Brett Green &lt;

> green.brett.r@

> &gt; wrote:
>
>> Interesting; I'd never seen that discussion. While off the top of my head
>> I don't remember any, I'll certainly keep that in mind for when I
>> remember
>> or next time I see things where a link could help. Thank you for sharing!
>>
>> - Brett Green
>>
>>
>> On Fri, Aug 30, 2019 at 1:01 PM Nicholas Jankowski &lt;

> jankowskin@

> &gt;
>> wrote:
>>
>>>
>>> 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.
>>>>
>>>>
>>>> this did come up  before (see the discussion at
>>> https://savannah.gnu.org/bugs/?50247) because there was an issues
>>> linking to pages with spaces in the names. that bug has an outstanding
>>> task
>>> of identifying which functions would benefit from document link updates
>>> now
>>> that the underlying issue is fixed.  maybe you could help identify other
>>> places where a simple link to follow would have made the search easier?
>>>
>>
> Following up on this, where should I suggest places that links could be
> added? I see two options on savannah.gnu.org
> &lt;https://savannah.gnu.org/mail/?group=octave&gt; - the general help
> mailing
> list and the maintainers mailing list. I would assume the latter would be
> more appropriate, but it would be rude to invite myself in.
>
> A recent question asked about bar graphs, and I think the user wanted to
> relabel the bins on the horizontal axis. I found a solution in the axes
> properties page, but only because I already knew to look there. The bar
> function reference
> &lt;https://octave.sourceforge.io/octave/function/bar.html&gt;
> and entry on the Two-Dimensional Plots page
> &lt;https://octave.org/doc/v4.0.0/Two_002dDimensional-Plots.html&gt; could
> link
> to this to explain how to alter bin labels.

I think the best place would be to first add comments in
https://savannah.gnu.org/bugs/?50247

Now if you want to discuss Octave development with a larger audience you are
welcome to the post to the maintainers list, any time you want. Consider
yourself as permanently invited :-)

Pantxo




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: How to set different fonts (question answered)

BGreen

I think the best place would be to first add comments in
https://savannah.gnu.org/bugs/?50247

Now if you want to discuss Octave development with a larger audience you are
welcome to the post to the maintainers list, any time you want. Consider
yourself as permanently invited :-)

Pantxo

--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Thank you very much! I just submitted a comment.

I need to learn to use the GUI-based documentation better, as it's guaranteed current (WRT the installed version, of course) and, once I learn better how to use it, will make finding the appropriate references easier. I started when it was all through the command line, and have always defaulted to searching the Internet for relevant documentation... I need to remember to break this habit.