[Fonts]Re: fontconfig and generic family names
On Mon, 02 Dec 2002 23:51:44 +, Keith Packard wrote: Around 2 o'clock on Dec 3, Braden McDaniel wrote: I'm still stumped by this. I've condensed the problem to this C program: Fontconfig is still not easy enough to use. Your example skipped two required steps in matching fonts. Try this instead: [snip] Ah, that's it. Thanks! Braden ___ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts
[Fonts]Re: Re: fontconfig and generic family names
On Sun, 24 Nov 2002 20:33:04 -0500, Owen Taylor wrote: [snip] Probably something wrong about how you are constructing the pattern. Fontconfig has the annoying habit of _always_ matching something, which, in case of error is often something unrelated to what you actually want. Can you provide a code snippet showing how you are constructing the pattern and using it to load the font? I'm still stumped by this. I've condensed the problem to this C program: #include fontconfig/fontconfig.h const FcChar8 name[] = Monospace; int main() { FcPattern *p, *m; FcResult result; p = FcNameParse(name); m = FcFontMatch(0, p, result); FcPatternPrint(m); return 0; } For me--on a pretty ordinary Red Hat 8.0 installation--this yields: Pattern 10 of 16 charset: set family: Utopia file: /usr/X11R6/lib/X11/fonts/Type1/UTBI.pfa index: 0 lang: langset outline: FcTrue scalable: FcTrue slant: 100 style: Bold Italic weight: 200 Do I need to be doing something else for the config parameter of FcFontMatch? -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED] ___ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts
[Fonts]Re: fontconfig and generic family names
On Sun, 24 Nov 2002 18:44:04 -0500, Owen Taylor wrote: Braden McDaniel [EMAIL PROTECTED] writes: The fontconfig man page suggests that Monospace can be used to select the users preferred monospace font; but I'm not having any luck with this. Sans and Serif don't have the desired effect either (though I don't see them mentioned in the man page, so I'm unsure that they should). This is on a stock Red Hat 8.0 system. Anything in particular I ought to be doing for this to work? It should be noted that the standard aliases are not the same as the fonts selected in the GNOME font properties dialog; the standard fontconfig names are configurable only through /etc/fonts/fonts.conf and ~/.fonts.conf. The reason that we didn't try to make them follow the user's font configuration is that it was problematic to have the font a particular name referred to change while a program was running, while the fonts in the font preferences dialog should take affect immediately. Thanks; but I don't think it accounts for what I'm seeing. I don't have a ~/.fonts.conf, and I haven't modified /etc/fonts/fonts.conf. I construct my initial pattern from the name monospace:outline=True. After calling FcFontMatch, FcPatternPrint of the result yields: Pattern 10 of 16 charset: set family: Utopia file: /usr/X11R6/lib/X11/fonts/Type1/UTBI.pfa index: 0 lang: langset outline: FcTrue scalable: FcTrue slant: 100 style: Bold Italic weight: 200 -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED] ___ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts
[Fonts]Re: Re: fontconfig and generic family names
On Sun, 24 Nov 2002 20:33:04 -0500, Owen Taylor wrote: Probably something wrong about how you are constructing the pattern. Fontconfig has the annoying habit of _always_ matching something, which, in case of error is often something unrelated to what you actually want. Can you provide a code snippet showing how you are constructing the pattern and using it to load the font? Sure... std::cout fontName std::endl; initialPattern = FcNameParse(FcChar8String(fontName.begin(), fontName.end()).c_str()); if (!initialPattern) { throw std::bad_alloc(); } // // Set the language. // if (!language.empty()) { FcPatternAddString(initialPattern, FC_LANG, language.c_str()); } FcPatternPrint(initialPattern); FcChar8 * name = FcNameUnparse(initialPattern); std::cout name std::endl; free(name); FcResult result = FcResultMatch; matchedPattern = FcFontMatch(0, initialPattern, result); if (result != FcResultMatch) { throw FontconfigError(result); } assert(matchedPattern); FcPatternPrint(matchedPattern); -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED] ___ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts
[Fonts]Re: Simple example of fontconfig usage?
On Sat, 02 Nov 2002 23:18:38 +, Keith Packard wrote: Around 23 o'clock on Nov 1, Braden McDaniel wrote: Are there any relatively simple examples of using fontconfig for font discovery? Pango uses fontconfig and FreeType for one of it's backends; here's a brief sample from that: [snip] Thanks. That helps a lot. -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED] ___ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts