freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] hinting and subpixel positioning


From: Werner LEMBERG
Subject: Re: [ft-devel] hinting and subpixel positioning
Date: Sun, 21 May 2017 08:30:08 +0200 (CEST)

> I admittedly misunderstood grayscale normal hinting.

:-)

> Let's recoup and see if you agree

I assume that you are talking about TrueType fonts.

> In MONOCHROME mode subpixel positioning is impossible because stems
> are nailed to grid.  Any shift in the start position will either be
> ignored or result in jump to the next grid position.  The hinted
> glyph image is unique and only integer advances make sense.

Yes.

> In LIGHT mode, stems are unrestricted and subpixel positioning
> works.

Yes.

> In NORMAL mode, there is a bit more freedom in stem placement which
> still must cover entire pixel whenever possible.

Yes, but...

> Specifically if stem widths are close one pixel, this freedom
> vanishes completely and NORMAL becomes MONOCHROME.

... this is completely up to the font's bytecode.  As a hypothetical
example, let's imagine that the bytecode's topmost goal is to achieve
consistent grayness for all sizes.  In this case, anything close to a
full-width pixel must be rather modified to *not* snap to the grid,
since this would cause an extreme increase in grayness.

> If stem widths is 1.5 pixel, NORMAL becomes LIGHT.  The fractional
> advance may or may not work depending on size.

Certainly.  However, I think we are still miscommunicating.  Let's
assume the following glyph, having a stem width and gap of 1px and
0.5px lsb and rsb, this is, the glyph is ideally 4px wide.

        +--+   +--+
        |  |   |  |
        |  |   |  |
     .  +--+   +--+  .

Here a table of some possible values, using discrete positions.

   frac. offset   lsb    rsb   pixel coverage        width
   ---------------------------------------------------------
      0           0.75   0.5   0.25 0.75 0.25 0.75   4.25px
      0.25        0.75   0.5   1 0 1                 4.25px
      0.5         0.5    0.5   1 0 1                 4.0px
      0.75        0.5    0.5   0.75 0.25 0.75 0.25   4.25px

In the example, lsb and rsb shouldn't become smaller than 0.5 to avoid
clashes with neighbouring glyphs.  It would be the job of the glyph's
bytecode to produce only stems that are not `lighter' than the above
values.  Essentially, this is roughly equal to what auto-hinter
warping is doing.


   Werner



reply via email to

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