If use_scalable_false is false, then LyX displays the type1 math fonts at 12
points, regardless of the size they should be.

The cause for this problem is as follows: 
  XListFonts(...,"-*-cmsy-*-*-*-*-*-*-*-*-*-*-*-*",...)
return *2* matches, 
-bluesky-cmsy-medium-r-normal--0-0-0-0-m-0-adobe-fontspecific
-bluesky-cmsy-medium-r-normal--12-120-75-75-m-0-adobe-fontspecific

The 2nd match is "correct" while the 1st one is "wrong" 
(as the font is scalable).

The font is recognized as scalable in FontInfo::query.
However, in FontInfo::getFontname, the first match causes closestind
to be not equal to -1, and therefore, the conditional
   if (scalable && (lyxrc.use_scalable_fonts || closestind == -1))
is not satisfied, and therefore the font is not scaled.
There are several possible solutions:

1. Call XListFonts(...,"-*-cmsy-*",...) which only gives the "correct" match.
This works on xfree but may not be portable:
http://marc.theaimsgroup.com/?l=lyx-devel&m=102748076625757&w=2

2. Ignore matches whose 12th field is zero, while its 7th field is non-zero:
@@ -143,6 +144,9 @@ void FontInfo::query()
                                }
                                scalable = true;
                        };
+                       if (sizes[i] > 0 &&
+                           lyx::atoi(token(name, '-', 12)) == 0)
+                               sizes[i] = 0;
                };
                XFreeFontNames(list);
        }

3. Change the if statement above to

@@ -51,7 +51,8 @@ string const FontInfo::getFontname(int s
                }
        }
 
-       if (scalable && (lyxrc.use_scalable_fonts || closestind == -1)) {
+       if (scalable && (lyxrc.use_scalable_fonts || closestind == -1
+                        || error/size > 0.2)) {
                // We can use scalable
                string const font = resize(strings[scaleindex], size);
                lyxerr[Debug::FONT] << "Using scalable font to get\n"

This means that if use_scalable_fonts is false, but the size of closest
available bitmap font is not close enough, we still prefer to rescale the
font.
Note that this change can be made even if (1) or (2) are also applied.
Clearly, if I have, for example, the font Times as a bitmap font at sizes
14,17,20, and as an outline(scalable) font, and I want a font of size 30 on
screen, it is preferable to use the scalable font over the 20pt bitmap font.
In fact, the 0.2 can be replaced by a lyxrc variable scalable_font_threshold
and the use_scalable_fonts can be removed
(use_scalable_fonts=true is equivalent to having scalable_font_threshold=0).

Note: The description of the use_scalable_fonts in the preferences dialog is
not accurate.
What this variable means is as follows:
* use_scalable_fonts=false: If the font available as both bitmap and as an
  outline (scalable) font, prefer the bitmap font.
* use_scalable_fonts=true:  If the font available as both bitmap and as an
  outline font, prefer the scalable font.






Reply via email to