RE : RE : layout patch - transform handling needed

From: Joaquin Cuenca Abela (
Date: Wed Feb 19 2003 - 15:08:13 EST

  • Next message: Patrick Lam: "commit: ut_units improvement"

    Tomas wrote:
    > Hi guys,
    > This is rather a longish posting, but please bear with me to the end
    > where I make some practical suggestions.
    > Joaquin wrote:
    > > > > Again, this is not right. In particular, requesting
    > screen font at
    > > > > real_size = size*zoom results in incorrect scaling
    > (because font
    > > > > metric does not scale linearly with size). This seems
    > to me to be
    > > > > precisely what we have done in the past, and what does not work.
    > >
    > > Tomas, here you're slightly wrong.
    > > If we have a font at 12pt, then the requested "size" of the font
    > > should be 12 points, whatever the zoom. To get a bigger
    > font (still
    > > at 12pt), you can change the resolution in which you want the font.
    > > Now, except for some MM fonts with optical scaling (if
    > computer modern
    > > had a MM version, then it will qualify), that's exactly
    > equivalent to
    > > requesting the font at size * zoom.
    > You are right, Joaquin, that to get the bigger font we have to
    > notionally adjust the resolution, but adjusting the size by the zoom
    > factor is _not_ equivalent to changing the resolution by the zoom

    Except for some rare MM fonts, that's 100% equivalent (I will speak
    about this gotcha to the end, let's forget it for a while).

    But I guess that we'll reach nowhere saying that each other is wrong :-)
    (we should both have quite a scientific mind)
    I will present some screenshots, and try to explain why I think that
    you're wrong.

    First, you seem to think that the application of the hints on the font
    depends on the _Point size_ of the font, and that it doesn't depends on
    nothing else.

    That's wrong. The hints are there to adjust the shape of the glyph to a
    grid, and thus you will agree that it's natural to believe that this
    processus depends on the final number of pixels that the glyph will take
    on screen, and not its intrinsic "physical" size. For a same physical
    size (say 12 points), you may need all the help you can take to draw a
    glyph at a very poor resolution, and you don't need any hints to draw
    the same glyph with the same physical size at a very high resolution.

    I guess that you'll agree that the problem of drawing a glyph of 12pt at
    96dpi is the same as drawing it with 6pt at 192dpi. You need to do the
    same grid-fitting magic in both cases.

    If you still don't agree, take a look at this screenshot:

    In the upper left of the screenshot, you have the string "mwmwmw"
    rendered at 60pt, with a resolution of 96dpi.
    In the down left of the screenshot, you have the same string, rendered
    at 12pt, with a resolution of 480dpi.
    In the right you have the same string rendered at 6pt/96dpi (up) and
    12pt/48dpi (down).

    As you can see, the results are exactly identical (I've already compared
    them pixel by pixel, but if you want to double check it, be my guess).

    Now, when you read about fonts, there is indeed another distorsion of
    the form of the glyphs that depends on the exact physical size of the
    font, and not on its "pixel" size. This effect is very commonly
    confused with the application of hints (in fact, several months ago when
    I was discussing with Leonard, I was at first confusing them), but it's
    very rare to find it nowadays.

    This effect is known as "optical scaling" (non-linear scaling, optical
    scaling... they look similar, eh? ;-)

    The goal of this effect is to make the strokes of the glyphs a little
    bit stronger (relatively) for small sizes and a little bit lighter for
    big sizes. It was widely used before the introduction of electronic
    typefaces. Remark that it has *NOTHING* to do with the grid-fitting
    problem that the hints fight. You may have an infinite resolution, and
    still use an optical scaling.

    In fact, TeX uses optical scaling in its computer modern. TrueType
    fonts are not so flexible, so this effect has largely ignored. Multiple
    Masters fonts had the optical scaling as one the big selling points, and
    I think that OpenType fonts are also able to do optical scaling, but
    still it's very rare to finds fonts that use it. The effects of optical
    scaling are specially visible when doing, for instance, mathematics, as
    you can mix together brackets, parenthesis, integral signs, etc. of very
    different sizes, and if you scale them linearly they look far too strong
    at big sizes (at least to my taste).

    So, yes, we both agree that we should ask for 12pt fonts when we're
    drawing 12pt fonts, but the problem is not a difference in the hints,
    but a rather much subtle one (one of these problems that comes back to
    bite you several years after :-)


    This archive was generated by hypermail 2.1.4 : Wed Feb 19 2003 - 15:13:23 EST