Re: Font, layout units et al.

From: Joaquín Cuenca Abela (cuenca@pacaterie.u-psud.fr)
Date: Sun Jun 02 2002 - 11:08:24 EDT

  • Next message: Joaquín Cuenca Abela: "Re: DELETEP, FREEP, and friends"

    Hi!

    As you may know, I've been trying to figure out how to get WYSIWYG in
    AbiWord. Before implementing anything in AbiWord, I though that it will
    pay off to implement my ideas in a little program, see how they work,
    and we all agree that we're in the right path, then implement it in
    AbiWord.

    I've thus written a little program to show how my first idea works, ie.
    use linearly scaled metrics to lay out individual characters on screen,
    and default horizontal advances on printers (I guess that trying to lay
    out individual characters in the printer will inflate too much our PS
    file).

    That way, if my thoughts are right, we will get WYSIWYG on
    high-resolution printers, and very near WYSIWYG on low-resolution
    printers (where rounding errors can still affect the layout). It seems
    that that's the way MS Word works.

    When you start this little app, you can start typing anything. You will
    see in the first line what you type, layed out using this algorithm. In
    the second line the text is layed out using our current algorithm.

    I rendered this way a line in Times New Roman at 12 points, with a
    resolution of 96dpi. I then started MS Word, and I wrote the same line
    using the same font at the same size and with the same resolution.

    I took a screenshot and a pasted the MS Word rendered line just above
    the two lines of my little program (screenshot at
    http://www.ie2.u-psud.fr/~cuenca/abi_vs_word.png).

    As you may see, the word positioned letters are exactly at the same
    position than the letters positioned by the new algorithm, but for some
    letters, rendered by word 1 pixel before the position picked by the new
    algorithm.

    I guess that this difference comes from the way the new algorithm pass
    from high-resolution to 96dpi (rounding), instead of what MS Word seems
    to do (truncating). So it may only be after all a little ms word bug
    (this truncating error is not cumulated, so it's not so important).

    Attached the code of this little application (I've only tried it with
    Xft2, but I think that it will also run with Xft1).

    Comments?

    Cheers,

    -- 
    Joaquín Cuenca Abela
    cuenca@pacaterie.u-psud.fr
    




    This archive was generated by hypermail 2.1.4 : Mon Jun 03 2002 - 04:29:33 EDT