Re: Fonts
Re: Fonts
- Subject: Re: Fonts
- From: "Torrey T. Lyons" <email@hidden>
- Date: Sun, 29 Jun 2003 13:11:04 -0700
At 11:18 AM -0500 6/29/03, Chris Scharver wrote:
Hello,
I like how xterm has the ability to use MacOS X system fonts. The
antialiasing can look pretty bad though. It's like the "do not
antialias under this size" preferences are not honored. Antialiased
9-point fonts are impossible to read.
I'm trying to incorporate similar font-loading functionality into a
library I am porting. I tried to look through the X11 source to see
how it's being done, but it feels a little like searching for a
needle in a haystack. To add MacOS X font support via FreeType in
X11, do I need to use FreeType's Mac-specific API? Using something
like FT_GetFont_From_Mac_Name() creates a dependence on
CoreFoundation. I cannot seem to properly load a font with that
approach. Does Apple's X11 do something like this, or is the font
support at a lower level?
The current implementation of the library is limiting. FreeType is
used for font loading, but the library only loads fonts by file name
from a specific path. I would like to implement a similar
find-font-by-name method. I tried something like this:
#ifdef __APPLE__
/* Locate fonts by name on MacOS X. */
error = FT_GetFile_From_Mac_Name(fontName, &path, &face_index);
if (! error) {
error = FT_New_Face(library, path.name, 0, &face);
if (error) {
sprintf(stderr, "ERROR: Unable to create face for %s.\n", path.name);
}
} else {
sprintf(stderr, "ERROR: Unable to get %s font file.\n", fontName);
}
#else
if (! (path = _flSearchFont(fontName)))
return NULL;
error = FT_New_Face(library, path, 0, &face);
free(path);
#endif
No errors are reported, but the font doesn't seem to load. I'm not
sure if the above approach is even the correct one to use from
within X11. Any suggestions?
Someone with better font-fu then me may jump in, but here are some
general observations:
1. The Freetype mailing lists are probably the best place for
detailed questions. Check out <http://freetype.org/>.
2. Font configuration changed significantly in XFree86 4.3.0/Apple's
X11 v1.0. Make sure you are using the latest stuff if you are doing
development.
3. Assuming you are up to date, you should be able to just use the
standard API's. font-config knows about all the Mac OS X font
directories and fc-cache will look for fonts in them. Check out
/etc/fonts/fonts.conf.
--Torrey
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: Fonts (From: Chris Scharver <email@hidden>) |