[Fontconfig] Bitmap font resizing

Raimund Steger rs at mytum.de
Tue Dec 25 04:57:40 PST 2012


Werner LEMBERG wrote:
>
>> I'm not sure if bitmap scaling is really expected things as the
>> outcome on the request.  I'm thinking of other possibilities too as
>> someone was sometimes raising the sort of "How to stop fallback" or
>> something like that. for instance, how about adding new binding mode
>> to ask for strict matching, and if no candidates, simply fails?
>> wound't that way avoid such situation?  or is it better relying on
>> that bitmap scaling feature in the rendering libraries?
>>
>> That may depends on what one wants to do.  having both
>> implementation may be ideal though.
>
> Indeed.  Bitmap fonts scaled by non-integer values look horrible if
> the output is B/W, and just a bit better if the target is grayscale
> (this is, the scaling has been done with proper dithering).

I tend to agree, it's probably hardly worth the trouble, after all, any 
sane fontconfig configuration should direct matches away from bitmap 
fonts if the size difference is too considerable.

But then I see https://bugs.freedesktop.org/show_bug.cgi?id=23539 and 
just in case it is related, I think for targets like PS or PDF where 
bitmap fonts are scaled anyway it's maybe something that could be 
thought about.

Also, _down_scaling large bitmap glyphs to grayscale by 50% or more 
could probably look OK even on image targets. Everything else, I'm not 
so sure. What I definitely wouldn't want is all Cairo-based applications 
suddenly rendering upscaled 12px or downscaled 14px just because some 
CSS style computation ends at 13px, but OK, Behdad states that for small 
size differences it doesn't make sense anyway.

As for the config suggested. It generally doesn't seem like a bad idea 
to allow sub-expressions in <matrix> elements, if it's not too 
complicated to implement. Maybe one could also expose both pattern and 
font pixelsizes to expressions, something like <name 
target="pattern">pixelsize</name> vs. <name 
target="font">pixelsize</name>? I'm not sure about using the 'dpi' and 
'size' properties to calculate the scaling factor because these 
properties will not always be there.

But in the end, even if fontconfig isn't changed an application could 
still add that scaling itself by just comparing pixelsizes before and 
after FcFontMatch and adding the necessary properties, right?


Raimund

-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>


More information about the Fontconfig mailing list