layout units: proposed course of action

From: Tomas Frydrych (tomas@frydrych.uklinux.net)
Date: Fri Aug 09 2002 - 11:14:09 EDT

  • Next message: Leonard Rosenthol: "Re: layout/screen units mess"

    I have looked at the hinting-related issues that Martin raised, but it is
    clear to me from the code that the two sets of units are the principal
    cause of these problems, and we have to move to using a single set
    of units before we can properly handle font scaling.

    So I would like to remove the layout units ASAP, probably this
    weekend; I have got bulk of the changes done in my tree and it
    compiles and kind-of runs. I will initially commit this using #ifdef
    USE_LAYOUT_UNITS so as to minimize disruption, but once things
    start working reasonably, I will delete the old code for the sake of
    readability.

    For now I want to continue using int's for our widths; this will make
    the transition easier and there will be nothing stoping us from moving
    to floats later, if we wish to do so.

    I want the new system of units to have a resolution 1024 times
    greater than the device on which we operate; this will give us some
    extra margin against rounding errors on low resolution devices, such
    as the screen; I will define macros UT_DEV_UNITS() and
    UT_LOG_UNITS() for the conversions. Please note that these
    conversions only will need to be done inside the gr_*Graphics
    classes, to the rest of AW this will be entirely transparent.

    All our widths in screen context will be scaled by the zoom factor, as
    they are now.

    The key thing in this change is that when the gr_*Graphics::
    functions retrieve the fonts and measure char widths, etc, they have
    to be processing the font point size correctly, i.e., they have to be
    requesting the metrics for the given point size and present device
    resolution, not, as it is done at the moment, adjusting the point size
    by the device resolution. This is very simple to do on win32, and
    should not be hard anywhere else, since this is the normal and only
    correct way of doing it.

    Tomas



    This archive was generated by hypermail 2.1.4 : Fri Aug 09 2002 - 11:19:03 EDT