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?