On Wed, October 10, 2012 17:29, mathog wrote: > Sorry if this is obvious, but the fontconfig documentation is a bit > light on examples. > > Given aset {Name, italic_yesno, bold_yesno, weight, size}, how does one > select the correct font? > One can find a font with a name like "arial" or "arial bold" using > FcNameParse(), so by converting > italic/bold to text and mixing it in with the name FcNameParse() can do > it. But is there another method? If your pattern spec is derived from a configuration file or some other textual representation, FcNameParse would indeed be the easiest way to get an FcPattern object. E. g. for Arial Bold Italic 12 pt Arial:weight=200:size=12:slant=100 (An additional dash is also supported after the family name to specify a size, like "Arial-10".) The other method is to use FcPatternCreate and then add properties piece by piece. For example, to set size 48pt: FcPattern *pat; FcValue v; pat = FcPatternCreate(); v.type=FcTypeInteger; v.u.i=48; FcPatternAdd(pat,FC_SIZE,v,FcTrue); Or use a combination of both (but note that repeated FcPatternAdd's to the same property cause that property to grow into a list). FcPatternAddInteger(pat,FC_SIZE,48) would have been another way to achieve the above. There's also FcPatternAddWeak which adds a property with weak binding which most of the time means it can get outweighed by 'lang'. > And what about weight and size, do those have to wait until FreeType to > be employed? All properties have the potential to be used in pattern substitution, depending on the user's configuration. To see the ones that are used in the matcher, i. e. after pattern substitution but before rendering, check _FcMatchers in fcmatch.c, which is a subset of the properties defined in fontconfig.h. However this set is not guaranteed to remain stable. You can normally simply set the properties you're interested in in your pattern, do config and default substitution, and use the result of FcFontMatch. Raimund -- Worringer Str 31 Duesseldorf 40211 Germany +49-179-2981632 icq 16845346 _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig