Sorry, thought I sent the message below, but I just found it in my drafts.
wxWidgets accepts a font name, then uses the style for fallback if that named
font doesn't exist. In the plplot wxWidgets backend we don't use the name
because plplot doesn't include the ability to pass the name in as you have
found.
I personally would like to see PLplot follow a similar pattern – in fact I
think this was one of my first feature requests a long time ago. As well as
being generally useful, I think some journals have specific fonts that should
be used. Unfortunately I’m not sure if other drivers are able to function in
this way and an API change is often difficult as it requires updating all the
supported languages.
However, I relatively easily add this to the wxWidgets API only, as a method of
the wxPLplotstream class.
Alan would you support such a change? The call itself could accept a pointer to
a wxFont object as a wxWidgets native way to set the font.
Phil
From: Alan W. Irwin
Sent: 13 October 2017 23:59
To: Alaric Senat
Cc: plplot-general@lists.sourceforge.net
Subject: Re: [Plplot-general] Another way to change the plotting font
On 2017-10-13 15:26-0700 Alan W. Irwin wrote:
> On 2017-10-13 16:11+0200 Alaric Senat wrote:
>
>> Hi,
>>
>> I'm trying to simply change the font of the texts in plplot by another one,
>> I found a lot of things in the doc' to change the font in the way to make
>> it
>> Italic or Serif etc. But I'm wondering if there is no way to specify a font
>> file
>> like a .ttf, for example. It's good to know that I'm using Plplot with the
>> wxwidgets
>> Driver.
>>
>>> From what I read in the documentation it seem's that i'm limited by the
>> 30 possibilities of plplot FCI system.
>
> Yes. PLplot uses generic fonts. I got that idea from the SVG
> graphics format, and all of the pango/cairo, Qt, and wxWidgets suites of
> graphical libraries. See the first part of
> <http://docs.wxwidgets.org/3.1/overview_font.html> for the generic
> fonts used by wxwidgets.
>
> What generic fonts mean in practice is for each (unicode)
> glyph requested by the PLplot users via the UTF-8 encoded string to be
> plotted, the operating system supplies that glyph using the "best"
> system font of the particular generic kind (Sans, Serif, etc.)
> requested by the PLplot user. Where "best" is typically defined by how
> fontconfig is set up.
>
> The results are normally good. For example, see
> <http://plplot.org/examples.php?demo=02> and click
> on the screenshots of the two pages of that example
> which show what the (PLplot default) sans serif, upright,
> normal weight font looks like. (Those screenshots
> were generated by -dev pngcairo, but all cairo and
> qt results look like this for that example.)
>
> To check what wxwidgets does in this regard I
> ran
>
> examples/c/x02c -dev wxwidgets
>
> and the result is an italic font, i.e., not what
> is intended at all for that example! So as a result
> of this discussion, I have found a bug in the font
> selection by -dev wxwidgets, and once that is sorted
> out, I suspect you will be much more satisfied with
> the generic font choice for -dev wxwidgets.
>
> To be continued by discussion in the plplot-devel mailing
> list, but once the bug is resolved, I will let you
> know here.
Oops. Never mind. There is no bug. That example calls plfont(4)
which corresponds (for unicode fonts) to asking for a generic script
font which -dev wxwidgets supplies. In this case, the other device
drivers (e.g., qt, cairo) do not have generic script font capabilities
implemented (likely due to library limitations) so they fall back to
using generic sans for this case which obviously looks very different
than what is produced by -dev wxwidgets.
So getting back to your original request, if you are not satisfied
with how generic fonts look on your platform for -dev wxwidgets then
you might want to try to set up fontconfig a different way to favor
your preferred fonts.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general