Hi Alan thanks for this detailed explanation. The inclusion of helvetica
was only a test to make sure it was indeed a font load problem it was not
intended to be a definitive solution. One of the first things I checked was
that fontconfig  was installed. I will dig deeper into this before report
to opensuse at very least I will have to find a more suitable, and clean
example where fontconfig fails. A plplot example is not the most
appropriated situation to report.
Cheers

On Sun, 16 Dec 2018, 06:11 Alan W. Irwin <alan.w.irwin1...@gmail.com wrote:

> On 2018-12-16 00:07-0000 António Rodrigues Tomé wrote:
>
> > Hi all
> > after trying a long time playing with cmake options trying to see if I
> > could get my qt5 plplot loading suitable f fonts I came to conclude that
> my
> > distribution in a way acts differently from Alan's.
> > I get very nice results if in the file plqt.cpp line 182
> > where is
> >    f.setFamily(""); // no family name, forcing Qt to find an appropriate
> > font by itself
> >
> > I replaced by
> >   f.setFamily("Helvetica"); // no family name, forcing Qt to find an
> > appropriate font by itself
> >
> > it seems in my system qt does not find an appropriate font by itsel. I
> > attach the very nice results obtained only by performed this small
> change.
>
> Hi António:
>
> The problem with this workaround is Helevetica is a Sans-Serif font so
> this approach means you have
> excluded serif and monospace possibilities for the PLplot qt device driver
> user.
>
> Furthermore, how fonts are chosen by Qt is documented in <
> http://doc.qt.io/qt-5/qfont.html#details>.
>
> There is a lot of information there, but the relevant points for this
> discussion are
>
> ---------------------------
> enum QFont::StyleHint
>
> Style hints are used by the font matching algorithm to find an appropriate
> default family if a selected font family is not available.
> Constant        Value   Description
> QFont::AnyStyle 5       leaves the font matching algorithm to choose the
> family. This is the default.
> QFont::SansSerif        Helvetica       the font matcher prefer sans serif
> fonts.
> QFont::Helvetica        0       is a synonym for SansSerif.
> QFont::Serif    Times   the font matcher prefers serif fonts.
> QFont::Times    1       is a synonym for Serif.
> QFont::TypeWriter       Courier the font matcher prefers fixed pitch fonts.
> QFont::Courier  2       a synonym for TypeWriter.
> QFont::OldEnglish       3       the font matcher prefers decorative fonts.
> QFont::Decorative       OldEnglish      is a synonym for OldEnglish.
> QFont::Monospace        7       the font matcher prefers fonts that map to
> the CSS generic font-family 'monospace'.
> QFont::Fantasy  8       the font matcher prefers fonts that map to the CSS
> generic font-family 'fantasy'.
> QFont::Cursive  6       the font matcher prefers fonts that map to the CSS
> generic font-family 'cursive'.
> QFont::System   4       the font matcher prefers system fonts.
> ---------------------------
>
> ---------------------------
> The font matching algorithm works as follows:
>
> 1. The specified font family is searched for.
> 2. If not found, the styleHint() is used to select a replacement family.
> 3. Each replacement font family is searched for.
> 4. If none of these are found or there was no styleHint(), "helvetica"
> will be searched for.
> 5. If "helvetica" isn't found Qt will try the lastResortFamily().
> 6. If the lastResortFamily() isn't found Qt will try the lastResortFont()
> which will always return a name of some kind.
> ---------------------------
>
> Here is more context for the code we are discussing from
> bindings/qt-gui/plqt.cpp.
>
> switch ( fontFamily )
>      {
>      case 1:
>          f.setStyleHint( QFont::Serif );
>          break;
>      case 2:
>          f.setStyleHint( QFont::TypeWriter );
>          break;
>      case 0: case 3: case 4: default:
>          f.setStyleHint( QFont::SansSerif );
>          break;
>      }
>      f.setFamily( "" ); // no family name, forcing Qt to find an
> appropriate font by itself
>
> So by this code setting the Family to an empty string we force Step 1
> above to fail and fall back to one of the QFont::Serif,
> QFont::TypeWriter, or QFont::SansSerif depending on what the user has
> requested for the (generic) font family.  And this font finding all
> works fine (as you would expect from the above documentation) for
> Debian Buster with Qt-5.11.2, for the much older Qt5 version I used
> for Debian Oldstable last year, and for many different versions of Qt4
> before that.
>
> I strongly suspect what is going on is you don't have fontconfig
> installed, in which
> case the search algorithm above would drop through to step 6 consistent
> with your
> observation that the unmodified PLplot code has an extremely
> limited font selection.
>
> But if you confirm you do have fontconfig installed, then you have a
> strong basis for a bug report to opensuse since setStyleHint appears
> not to be working on that platform.
>
> Alan
> __________________________
> Alan W. Irwin
>
> 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
> __________________________
>
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to