freetype
[Top][All Lists]
Advanced

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

Re: [ft] Off by one error in freetype (or in programmer?)


From: Dave Arnold
Subject: Re: [ft] Off by one error in freetype (or in programmer?)
Date: Fri, 6 Apr 2018 09:40:19 -0700
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

If I look at the glyph /H in Source Sans Pro in a font editor, the top right 
bound is a point at (562,656) and the bottom left point is at (90,0). If I were 
to think about this as a bitmap, I can address row 0 and row 656, so there are 
657 addressable rows.

But when I render it to a bitmap in freetype, I get bitmap.rows == 656, 
bitmap.width == 472 (562 minus the LSB of 90 is 472).

I would add a caution: be careful in assuming a relationship between outline 
coordinates and bitmaps coordinates. The grid-fitting and scan conversion 
processes are not simple, especially with hinting (you don't say if you are 
rendering SourceSansPro hinted). For example, don't rely on an outline bounding 
box to protect access to a bitmap.

-Dave


On 4/5/2018 11:55 PM, Lawrence D'Oliveiro wrote:
On Fri, 06 Apr 2018 08:40:03 +0200 (CEST), Werner LEMBERG wrote:

Of course there will be stair-stepping!  Just have a look into the
additional documentation files that accompany the old TrueType
specification (both Apple and MS versions).  You'll see rectangles
everywhere talking about B/W rasterization.
I know, I used Macs in those days. Most of them still had only
one-bit-per-pixel screens, and people didn’t really know any better.

A graphics system might apply filters to display such bitmaps on
screens, but this is not covered by the TT specification.
If you are going to be filtering out frequencies above the Nyquist
limit (antialiasing), then a rectangular shape is the wrong thing to
start from, since you have already thrown away even harmonics below the
limit.

You start from a dimensionless point, i.e. an “ideally-sampled” pixel.

_______________________________________________
Freetype mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype




reply via email to

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