On Fri, 27 Feb 2004, bulia byak wrote:
Today I looked into how Inkscape finds and presents fonts (using Xft, i.e. this only affects Linux). Lots of problems are now fixed.
Wow, very cool. These fixes sound like they'll solve a wide range of font problems we've all been bothered by, including several secondary bugs that arise from our hacky workarounds. :-)
(For example, with this fix, we may be able to deliver the About screen with regular text instead of converting to curves, which has caused several secondary issues. Similarly, probably helps with Tutorial troubles too.)
- For some reason, Inkscape ignored all fonts from *.pfa files, commenting
thus:
/* fixme: This is silly and evil */ /* But Freetype just does not load pfa reliably (Lauris) */ /* Changed to exclude pfa, better for OSX */
In my tests, pfa fonts are loaded just as well as any other fonts. So I restored the pfa loading capability. Now I need someone else to confirm that it works with pfa fonts. This may fix bug 894947.
- Much worse, when parsing a font, Inkscape (that is, Sodipodi, because
this part of the code did not change from Sodipodi times) only pays attention to weight and slant - and nothing else. As a result, font faces within a family that differ in some other parameters (condensed, outline, small caps etc) were simply ignored, not used and not shown. Until today, Inkscape only loaded 173 font faces on my system; after I fixed this and the pfa loading, it shows 202! This will likely fix bug 904962.
- The names for faces within a family were constructed by Inkscape from the
numeric weight and slant parameters. As a result, all fonts were shown in the list as "Normal", "Italic", etc., even when the fonts used different style names (Regular, Book, Slanted etc). Now it remembers and uses for display the exact style name of the font as returned by Xft.
- When sorting full font names into families, a rather stupid algorithm was
used which unreliably compared font names with family names. As a result, fonts sometimes ended up in wrong families. This is now fixed, each font remembers its exact full name and family name as reported by Xft.
Think this may solve the issue where if a font is unknown, it defaults to the first in the list, rather than selecting a different font from the same family?
- Very annoyingly, the list of styles in the Text dialog was not sorted.
Now it is sorted so that Regular or Roman always comes first, then Italic, Bold, Bold Italic.
TODO: This is only tested on Linux. I may well have broken something on Windows. This also requires additional testing (and likely coding) to accommodate non-ASCII font names and style names.
Thanks Bulia, this is a major enhancement to the codebase and long needed. I had assumed it'd be a big project to start addressing these issues, it's wonderful to see how quickly that some of the basic issues could be fixed.
Bryce