freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Downscaling of rendered bitmaps?


From: Nikolaus Waxweiler
Subject: Re: [ft-devel] Downscaling of rendered bitmaps?
Date: Tue, 29 Mar 2016 00:12:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

Alright, I modified ft_smooth_render_generic() like this: I abuse "vmul" to inflate the outline times 3 on the y-axis, then average these 1x3 pixels into a downsampled bitmap:

  for ( y = 0; y < downsampled_bitmap_height; y++ )
  {
    for ( x = 0; x < pitch; x++ )
    {
       downsampled_bitmap.buffer[y * pitch + x] =
         ( ( bitmap->buffer[3 * pitch * y + x] +
             bitmap->buffer[3 * pitch * y + pitch + x] +
             bitmap->buffer[3 * pitch * y + 2 * pitch + x] ) / 3 );
    }
  }

This alone makes no difference; as discussed in http://www.beatstamm.com/typography/RTRCh4.htm#Sec11, rounding to sample boundaries is also needed. This is trivial on the x-axis, since all rounding instructions there can be replaced by Round_None, as my v38 patch does. But what to do about the y-axis? Rounding to none there makes a difference, but stems are no longer vertically aligned to the pixel grid obviously, so the hinting improves little on no hinting.

Anybody know how Microsoft does 6x5 supersampling?

I'm currently thinking about rigging the rendering pipeline somehow to double glyph size before hinting (10pt -> 20pt) to get around the rounding to sample boundaries issue and downsample it after rasterization. Hm.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]