RE : layout patch - transform handling needed

From: Joaquin Cuenca Abela (e98cuenc@free.fr)
Date: Tue Feb 18 2003 - 15:43:27 EST

  • Next message: Seth Delackner: "Backporting RTF export to wv?"

    Hi all!

    I'm sorry I've been busy these days. I've just got to this thread...

    Patrick wrote:
    >
    > Yes, well, if you could tell me how to get a 1440dpi font
    > from FontConfig, we'd be much obliged. For us, FC was rather
    > stubborn and uncooperative.

    If I understand rightly your problem, you want to get the horizontal
    advances, height, etc. of a font at 1440 dpi, right?
    I guess that you want the metrics and not to draw the font at a so high
    resolution.
    And if you want the metrics at a so high resolution, I guess that's just
    to use this resolution as a kind of "infinite" resolution, to do the
    layout. Am I right?

    Then you just need to use the linearHoriAdvance field of the
    FT_GlyphSlotRec structure.

    If you need some example, just ask. Right now I don't have the time to
    produce production quality code (read: don't expect caches, etc) but I
    should be able to provide any quick example that you need.

    FontConfig doesn't provide directly such an API. Remember that its only
    goal is to discover and match fonts, not to give the client any font
    metrics. For that, you should go directly to freetype (that's why
    FontConfig depends explicitely on the freetype API).

    >
    > > > ::drawGlyph needs to draw a font at ::getDeviceResolution
    > (you may
    > > > find it easier to request a 'screen font' of the appropriate size
    > > > multiplied by getZoomPercentage()).
    > >
    > > 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.

    I say that you should not do it because for some rare fonts it will have
    slightly different results (fonts with optical scaling), but for most
    fonts it's exactly the same thing as requesting a "size * font" size,
    and yet it works perfectly ok.

    The problem that Tomas mentions (font metrics doesn't scales linearly)
    is not a deal, as anyway you're NOT using the non-linearly scaled font
    metrics to layout the text (that's the whole point of the patch), so it
    doesn't matters if they're not scaled linearly with the resolution.

    > Currently, we are using two fonts. One font should be at
    > 1440dpi (we can't actually get this to be the case), but the
    > important thing is that it is independent of zoom -- it never

    Excuse me if I speak without all the context, because I don't have the
    time to read all the new code, but unless I'm missing something obvious,
    you don't need two fonts.

    Please, don't repeat the 2 fonts mistake (we don't need that in the
    fontconfig/xft code). You don't want a real, instanciated font,
    independent of the resolution. You want the real, linearly scaled
    metrics, of the font that the user is using. You may store it at a high
    resolution if you want, but IMO it will be better to use directly the
    maximum resolution that the font format is able to give (but I don't
    care so much).

    One more thing, if you're putting all these things on gr_Graphics,
    please, oh please, move all that to a base gr_Font or something. It's
    not the gr_Graphics class to know about font metrics...

    > changes. This font is not drawn, only measured. On the

    You see, you don't really need it :)

    Cheers,

    P.S.: Congratulations to Pat and Dom for the fixes! I hope to be able
    to test them as soon as possible



    This archive was generated by hypermail 2.1.4 : Tue Feb 18 2003 - 15:49:04 EST