display of $int...$ under QT5

Enrico Forestieri forenr at lyx.org
Wed Sep 2 09:45:32 UTC 2020


On Wed, Sep 02, 2020 at 10:33:03AM +0200, Enrico Forestieri wrote:
> On Wed, Sep 02, 2020 at 09:45:58AM +0200, Enrico Forestieri wrote:
> > On Wed, Sep 02, 2020 at 07:45:44AM +0200, Cor Blom wrote:
> > > Op 01-09-2020 om 22:21 schreef Enrico Forestieri:
> > > > We already have an elegant solution. We rely on Qt to do the right thing
> > > > with QFontDatabase::addApplicationFont(), but on linux it does not work
> > > > right, contrarily to Windows (and I think MacOS) where it works well.
> > > > In this case it should suffice to directly add the lyx font directory
> > > > to the fontconfig paths. The fonts ditributed with lyx are a superset
> > > > of the texlive ones and could also replace them. However, this is not
> > > > necessary because we can find our fonts by requesting the style "LyX",
> > > > provided that fontconfig can find them.
> > > 
> > > I think I know why it does not work. The lyx fonts are installed in
> > > /usr/share/lyx/fonts and it looks to me this is kind of hardcoded, because
> > > "lyx -dbg font" only gives OK for me when the fonts are in that directory.
> > > 
> > > Fontconfig, however, does not look into that directory. So "fc-match -v
> > > "esint10: style=lyx" | grep file:" only give me the correct result when the
> > > lyx fonts are in /usr/share/fonts.
> 
> This is to be expected, because the fonts should be seen only by lyx. This
> is how QFontDatabase::addApplicationFont() should work. It is the fact that
> you don't see some glyphs that indicates the failure.
> 
> However, it would be interesting if you could report the result of the
> attached patch. This is a patch for lyx 2.3, the corresponding patch for
> the development version 2.4 can be found as an attachment to another email
> in this thread. It should show which font file lyx uses for math fonts.
> You will have to configure lyx using LIBS=-lfontconfig, i.e.,
> 
> configure [your usual options here] LIBS=-lfontconfig
> 
> After building lyx, create a new document and then a math inset.
> You should then see all used font files printed in the terminal.
> 
> If you do not add /usr/share/lyx/fonts to the fontconfig directories
> (make sure that "fc-match -v 'esint10: style=lyx' | grep file:" does
> not return the "correct" result) and no fonts in /usr/share/lyx/fonts
> are spotted, we can be sure that QFontDatabase::addApplicationFont()
> does not work.

I just checked it, and it works on debian. They package separately the
fonts in the package fonts-lyx. With this package installed, I get

$ fc-match -v "esint10: style=regular" | grep file:
	file: "/usr/share/fonts/truetype/lyx/esint10.ttf"(w)

while, uninstalling it, I get

$ fc-match -v "esint10: style=regular" | grep file:
	file: "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"(w)

However, applying the above patch, without the fonts-lyx package I get

Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/eufm10.ttf (family eufm10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/cmsy10.ttf (family cmsy10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/cmmi10.ttf (family cmmi10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/cmr10.ttf (family cmr10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/cmex10.ttf (family cmex10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/msam10.ttf (family msam10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/msbm10.ttf (family msbm10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/wasy10.ttf (family wasy10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/stmary10.ttf (family stmary10, style LyX)
Filename: /usr/local/src/lyx/lyx-stable/lib/fonts/esint10.ttf (family esint10, style LyX)

where /usr/local/src/lyx/lyx-stable is the lyx source dir.
Hence, QFontDatabase::addApplicationFont() works!

Reinstalling the fonts-lyx package I get

Filename: /usr/share/fonts/truetype/lyx/eufm10.ttf (family eufm10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/cmsy10.ttf (family cmsy10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/cmmi10.ttf (family cmmi10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/cmr10.ttf (family cmr10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/cmex10.ttf (family cmex10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/msam10.ttf (family msam10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/msbm10.ttf (family msbm10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/wasy10.ttf (family wasy10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/stmary10.ttf (family stmary10, style LyX)
Filename: /usr/share/fonts/truetype/lyx/esint10.ttf (family esint10, style LyX)

Meaning that the fonts of the fonts-lyx package take precedence.
However, all in all, it seems to work well on debian.
I don't know what the problem may be on other distros.

-- 
Enrico


More information about the lyx-devel mailing list