Enrico Forestieri wrote:

> I investigated why \int and \oint are not shown on Windows, contrarily
> to *nix. It turned out that the following check performed in
> GuiFontLoader.C:
> 
> bool isChosenFont(QFont & font, string const & family)
> {
>         ...
>         // So we check rawName first
>         if (contains(fromqstr(font.rawName()), family)) {
>                 lyxerr[Debug::FONT] << " got it ";
>                 return true;
>         }
>         ...
> 
> always succeeds on windows, whatever font is asked for, existing or not.

This is documented for QFont::setRawName:

If Qt's internal font database cannot resolve the raw name, the font becomes
a raw font with name as its family.

I guess that this applies also if you request a font by other means that
setRawName().

> In this way, LyX thinks that the esint font is existing on the system,
> thus the "iffont esint" test in lib/symbols succeeds, and the integral
> sign glyphs are assigned to a missing font file...
> 
> The attached patch corrects this and I can see the integrals. I think
> that it is correct and I also tested it on linux and solaris, but I am
> no Qt expert, so I ask for opinions before applying it.

According to the qt docs this should be safe: fi.family() is the family of
the font that gets used. If that matches font.rawName() (which is either
the requested family or an XLFD or some xft stuff), then that means that
this font was actually found.

_But_: If we go this way we trust that fi.family() is correct. Then we can
as well use the attached patch instead. So the question is: Is the comment
about qt lying in fi.family() still true?


Georg


PS: It was not wise from the qt3 cleanup people to remove the comment that
Qt 3.x always used "xft" as rawName but not the test for "xft". Either the
test for "xft" is not needed anymore, or the comment should come back.
Index: src/frontends/qt4/GuiFontLoader.C
===================================================================
--- src/frontends/qt4/GuiFontLoader.C	(Revision 16123)
+++ src/frontends/qt4/GuiFontLoader.C	(Arbeitskopie)
@@ -139,24 +139,11 @@ bool isChosenFont(QFont & font, string c
 	// The workaround is to add dummy glyphs at least at all ASCII
 	// positions.
 
-	// Note Qt lies about family quite often
-	lyxerr[Debug::FONT] << "alleged fi family: "
-		<< fromqstr(fi.family()) << endl;
-
-	// So we check rawName first
-	if (contains(fromqstr(font.rawName()), family)) {
+	if (contains(fromqstr(fi.family()), family)) {
 		lyxerr[Debug::FONT] << " got it ";
 		return true;
 	}
 
-	// Qt 4.1 returns "Multi" for all ? xft fonts
-	if (font.rawName() == "xft" || font.rawName() == "Multi") {
-		if (contains(fromqstr(fi.family()), family)) {
-			lyxerr[Debug::FONT] << " got it (Xft) ";
-			return true;
-		}
-	}
-
 	return false;
 }
 

Reply via email to