[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thoughts on font management
From: |
Isaiah Beerbower |
Subject: |
Re: Thoughts on font management |
Date: |
Mon, 10 Dec 2007 19:14:44 -0500 |
On 12/10/07, Fred Kiefer <fredkiefer@gmx.de> wrote:
> Isaiah Beerbower wrote:
> > On 12/10/07, Fred Kiefer <fredkiefer@gmx.de> wrote:
> >> Isaiah Beerbower wrote:
> >>> I have an almost complete implementation working with the cairo back
> >>> end. Should I create a new branch for it under /libs/back/branches?
> >>> This is my first contribution to GNUstep, which is why I ask.
> >> The first thing you need to do is of course to assign the copyright to
> >> the FSF :-)
> >> After that you should be able to get write access to the SVN repository.
> >
> > I've already done both.
> >
> >> Whether we need a separate branch for this change depends on the amount
> >> of code that changes and on how stable the change is in the beginning. I
> >> prefer to work on the trunk, so that people will actually test the
> >> changes I make. But this is only advisable if you are willing to correct
> >> any problems very fast.
> >
> > Currently I have made changes in only three classes
> > (CairoFontEnumerator, CairoFaceInfo, & CairoFontInfo) and I've tested
> > it in several situations already and consider it stable.
> >
> > The reason I asked is because you said "I would prefer to see code,
> > before I judge on it". Shall I put it in trunk then?
> >
>
> Fine for me.
Ok, its in trunk now.
A few comments...
fontconfig is no longer a dependancy. I'm taking everything directly
from FreeType.
Currently I'm caching all GNUstep font directories by default
(*/Library/Fonts). Additional directories may be specified using the
GSAdditionalFontPaths user default, which is simply an array of paths
like so:
GSAdditionalFontPaths = (
"/usr/local/lib/X11/fonts",
"/windows/WINDOWS/Fonts"
)
Each directory is cached recursively, so not only
/usr/local/lib/X11/fonts is being cached but
/usr/local/lib/X11/fonts/TTF, /usr/local/lib/X11/fonts/Type1, etc..
Two cache files are created in ~/GNUstep/Library/FontInfo/:
FontCache.plist and CachedDirs.plist. CachedDirs.plist contains a
dictionary with the paths to all cached directories (again recursive)
as the keys, and the date/time each directory was last cached as the
values. CachedDirs.plist isn't meant to be changed by the user.
FontCache.plist is the actual font cache. It contains an array of
dictionaries, each dictionary representing a font. Here's a couple of
sample font dictionaries to give you an idea:
{
Family = Helvetica;
Files = (
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.pfb",
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.pfm",
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.afm"
);
Foundry = URW;
Name = Italic;
PostScriptName = "Helvetica-Italic";
}
{
Family = "Nimbus Sans L";
Files = (
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.pfb",
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.afm",
"/usr/GNUstep/System/Library/Fonts/Helvetica.nfont/n019023l.pfm"
);
FullName = "Nimbus Sans L Regular Italic";
Index = <*I0>;
ItalicAngle = <*R-12>;
Name = "Regular Italic";
PostScriptName = "NimbusSanL-ReguItal";
Traits = <*I1>;
Weight = <*I5>;
}
The first entry was read from a nfont bundle, and the second was read
using FreeType. Known keys are Family, Files, ScreenFonts, Foundry,
FullName, Index, ItalicAngle, Name, PostScriptName, Traits, Weight,
FontLicense, FontCopyright & Enabled. FontCache.plist may be edited by
the user, for example changing the name of a font or adding a trait,
and the changes will be kept. To force all fonts to be re-cached
FontCache.plist may be deleted.
On a machine with an 800 MHz processor, 512 Mg of RAM, and about 200
font families, it takes less than 8 seconds to load if no fonts are
cached, and less than 0.5 seconds if all fonts are cached.
In its current state everything works and is totally usable. There
are, however, a few things remaining to be implemented (which I will
be implementing as time passes):
TrueType and OpenType fonts have a localized name table containing,
amongst other things, the family name, style name, full name,
copyright, license, and foundry which I am not querying, yet really
should be queried.
*.font files aren't supported yet. I couldn't file any explanation for
what these files are. Just brief mentions, and some code in the art
back end. Can anybody give me a better description of it?
Also, support for bitmap fonts isn't present yet. Currently bitmap
fonts are just ignored. I think the way a bitmap font would be cached
(following the nfont spec) is so:
{
Family = Courier;
FontCopyright = "Copyright (c) 1984, 1987 Adobe Systems
Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital
Equipment Corporation. All Rights Reserved.";
Foundry = Adobe;
FullName = "Courier Bold";
Index = <*I0>;
Name = Bold;
PostScriptName = "Courier-Bold";
ScreenFonts = {
<*I8> = (
"/usr/local/lib/X11/fonts/100dpi/courB08-ISO8859-15.pcf.gz"
);
<*I10> = (
"/usr/local/lib/X11/fonts/100dpi/courB10-ISO8859-15.pcf.gz"
);
<*I12> = (
"/usr/local/lib/X11/fonts/100dpi/courB12-ISO8859-15.pcf.gz"
);
<*I14> = (
"/usr/local/lib/X11/fonts/100dpi/courB14-ISO8859-15.pcf.gz"
);
<*I18> = (
"/usr/local/lib/X11/fonts/100dpi/courB18-ISO8859-15.pcf.gz"
);
<*I24> = (
"/usr/local/lib/X11/fonts/100dpi/courB24-ISO8859-15.pcf.gz"
);
};
Traits = <*I2>;
Weight = <*I8>;
}
I'm not sure what to do with bitmap fonts for multiple resolutions
though. Also, I don't know how to make cairo and/or FreeType render
them properly. The former font system using fontconfig doesn't have
them rendered properly either so I can't take any hints from it. So
for now I leave them uncached. If anybody has any thoughts on this, I
would be happy to hear them.
- Isaiah Beerbower
--
www.ipaqah.com
- Re: Thoughts on font management, Isaiah Beerbower, 2007/12/01
- Re: Thoughts on font management, Isaiah Beerbower, 2007/12/09
- Re: Thoughts on font management, Fred Kiefer, 2007/12/10
- Message not available
- Re: Thoughts on font management, Isaiah Beerbower, 2007/12/10
- Re: Thoughts on font management, Fred Kiefer, 2007/12/10
- Re: Thoughts on font management,
Isaiah Beerbower <=
- Re: Thoughts on font management, Fred Kiefer, 2007/12/10
- Re: Thoughts on font management, Fred Kiefer, 2007/12/11
- Re: Thoughts on font management, Isaiah Beerbower, 2007/12/11
- Re: Thoughts on font management, Isaiah Beerbower, 2007/12/11