I''d like to search the fonts on a system by family name, but prefer outline fonts later on the list over bitmap fonts earlier on the list. For example, for the spec "Courier, DejaVu Sans Mono": 1. Courier (outline) 2. DejaVu Sans Mono (outline) 3. Courier (bitmap) 4. DejaVu Sans Mono (bitmap) 5. Fallback font Here''s what I''ve tried: 1. I tried figuring out how to do this with a single call to FcFontMatch. It turns out the "best" match is determined by hardcoded weights. If they weren''t hardcoded, I could simply increase the weight for the "outline" attribute. 2. I tried figuring out how to do this passing each family separately to FcFontMatch, then picking the first that has an outline, or falling back to the first without an outline. However, I can''t figure out how to tell the difference between when FcFontMatch returns a family I asked for and when it returns a fallback font. 3. I tried using FcFontList to create a font list containing only outline fonts so I could search that first, but I can''t tell the difference between when it can find a font and when it found a fallback font. 4. I tried looking at the source code to FcFontMatch, but it looks like it does a lot of peeking inside of structures that are opaque to clients. I''d have to make a lot of API calls to access the required information. What am I missing, or is it really that hard to do this?
On Fri, Oct 1, 2010 at 00:04, <depp at moria.us> wrote:> I''d like to search the fonts on a system by family name, but prefer outline > fonts later on the list over bitmap fonts earlier on the list. ?For example, > for the spec "Courier, DejaVu Sans Mono": > > ... > > What am I missing, or is it really that hard to do this?Since you''re contrasting them to bitmap fonts, it sounds like what you''re looking for is "vector" fonts rather than "outline" fonts. In that case, I think the Fontconfig attribute you''re looking for is "scalable" rather than "outline". -- Mark Wagner
Hm. "Outline font" is typically another term for "vector font". I checked the Fontconfig source code, and the "scalable" and "outline" attributes are always set to the same value (see src/fcfreetype.c:FcFreeTypeQueryFace). Quoting Mark Wagner <carnildo at gmail.com>:> On Fri, Oct 1, 2010 at 00:04, <depp at moria.us> wrote: >> I''d like to search the fonts on a system by family name, but prefer outline >> fonts later on the list over bitmap fonts earlier on the list. ?For example, >> for the spec "Courier, DejaVu Sans Mono": >> >> ... >> >> What am I missing, or is it really that hard to do this? > > Since you''re contrasting them to bitmap fonts, it sounds like what > you''re looking for is "vector" fonts rather than "outline" fonts. In > that case, I think the Fontconfig attribute you''re looking for is > "scalable" rather than "outline". > > -- > Mark Wagner >