commit: huge layout patch

From: Patrick Lam (
Date: Sat Feb 15 2003 - 08:43:21 EST

  • Next message: besnik bleta: "I can't build from source. Could anybody help?"

    Use layout units exclusively (mostly) - with Dom

    This commit will break other platforms. Here's what you have to do to
    make them work again.

    Abi now, in principle, does all calculations at 1440 dpi. (in layout
    Previously, Abi was doing the calculation twice, both at screen
    (~72dpi) and at layout resolution. This sucked, and caused various
    bugs, which should be resolved now.

    We've introduced functions gr_Graphics::tdu, ::tlu, ::tduD, and ::tluD.
    ::tdu converts from layout To Device Units, while ::tlu converts To
    Units. The *D versions use doubles, while the normal versions use
    UT_sint32s. These replace the old _UL and _UD macros, which should no
    longer be used. ::getResolution() now returns a constant 1440, while
    ::getDeviceResolution() returns something consistent with the zoom.
    [The graphics class is exclusively responsible for zoom scaling now.]

    Any constant '1 pixel' additions in the source need to say 'tlu(1)' now.
    We've done this in unix and XP code, but there may be instances in
    graphics classes.

    The graphics classes now communicate with the rest of Abi in layout
    That means that in the platform impls of the graphics classes, you need
    to run ::tdu before you start drawing anything. You'll probably also
    to change gr_*Image. Also, you need to change the event handling
    that should be in af/ev/*. When an event comes in, any pixels will be
    device units, and they need to be wrapped with ::tlu before being passed
    to the rest of abi. The frame also deals with pixels in terms of
    The public API from the frame should give layout units.

    We also inserted some ::tlu calls in a Unix dialog which had image
    previews, FileOpenSaveAs.

    Finally, we did some work on fixing up fonts in Unix (where xft is
    now). What we wanted was to get two fonts, one corresponding to the
    zoom, and one for 1440dpi, for measurement. We didn't quite succeed in
    goal, because we didn't manage to get FontConfig to cooperate with us,
    the public API is based on this assumption, and we internally do fixups
    between the UnixFont and the UnixGraphics to make it work pretty well in
    practice. There are three functions which return font metrics, in
    Graphics code: ::getAscent, ::getDescent, and ::measureUnRemappedChar.
    possible, these should return metrics based on a font requested at 1440
    [or they should pretend to]. ::drawGlyph needs to draw a font at
    ::getDeviceResolution (you may find it easier to request a 'screen font'
    the appropriate size multiplied by getZoomPercentage()).

    I'm not aware of any serious remaining issues. Sometimes the redraw
    scroll isn't as pretty as it should be, but it's not blatantly broken
    like it was before yesterday.

    I hope I've given enough information for platform maintainers to unbreak
    their builds. Best of luck!


    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS: Committing in .
    CVS: Modified Files:
    CVS: src/af/ev/unix/ev_UnixMouse.cpp
    CVS: src/af/gr/unix/gr_UnixGraphics.cpp
    CVS: src/af/gr/unix/gr_UnixGraphics.h
    CVS: src/af/gr/unix/gr_UnixImage.cpp src/af/gr/unix/gr_UnixImage.h
    CVS: src/af/gr/win/gr_Win32Graphics.cpp
    CVS: src/af/gr/win/gr_Win32Graphics.h src/af/gr/xp/gr_Caret.cpp
    CVS: src/af/gr/xp/gr_Graphics.cpp src/af/gr/xp/gr_Graphics.h
    CVS: src/af/gr/xp/gr_Image.cpp src/af/gr/xp/gr_Image.h
    CVS: src/af/util/xp/ut_svg.cpp src/af/util/xp/ut_types.h
    CVS: src/af/util/xp/ut_units.cpp src/af/util/xp/ut_units.h
    CVS: src/af/xap/unix/xap_UnixApp.cpp
    CVS: src/af/xap/unix/xap_UnixDlg_FileOpenSaveAs.cpp
    CVS: src/af/xap/unix/xap_UnixFont.cpp
    CVS: src/af/xap/unix/xap_UnixFont.h
    CVS: src/af/xap/unix/xap_UnixFontManager.cpp
    CVS: src/af/xap/unix/xap_UnixFontManager.h
    CVS: src/af/xap/unix/xap_UnixFrameImpl.cpp
    CVS: src/af/xap/unix/xap_UnixNullGraphics.cpp
    CVS: src/af/xap/unix/xap_UnixNullGraphics.h
    CVS: src/af/xap/unix/xap_UnixPSFont.cpp
    CVS: src/af/xap/unix/xap_UnixPSFont.h
    CVS: src/af/xap/unix/xap_UnixPSGraphics.cpp
    CVS: src/af/xap/unix/xap_UnixPSGraphics.h
    CVS: src/af/xap/win/xap_Win32Dlg_FontChooser.cpp
    CVS: src/af/xap/xp/xap_Dlg_FontChooser.cpp
    CVS: src/af/xap/xp/xap_Draw_Symbol.cpp
    CVS: src/af/xap/xp/xap_Preview_Zoom.cpp src/af/xap/xp/xav_View.cpp
    CVS: src/text/fmt/xp/fb_Alignment.cpp
    CVS: src/text/fmt/xp/fb_Alignment.h
    CVS: src/text/fmt/xp/fb_ColumnBreaker.cpp
    CVS: src/text/fmt/xp/fg_Graphic.h
    CVS: src/text/fmt/xp/fg_GraphicRaster.cpp
    CVS: src/text/fmt/xp/fg_GraphicRaster.h
    CVS: src/text/fmt/xp/fg_GraphicVector.cpp
    CVS: src/text/fmt/xp/fg_GraphicVector.h
    CVS: src/text/fmt/xp/fl_BlockLayout.cpp
    CVS: src/text/fmt/xp/fl_BlockLayout.h
    CVS: src/text/fmt/xp/fl_DocLayout.cpp
    CVS: src/text/fmt/xp/fl_DocLayout.h
    CVS: src/text/fmt/xp/fl_FootnoteLayout.cpp
    CVS: src/text/fmt/xp/fl_SectionLayout.cpp
    CVS: src/text/fmt/xp/fl_SectionLayout.h
    CVS: src/text/fmt/xp/fl_TableLayout.cpp
    CVS: src/text/fmt/xp/fl_TableLayout.h src/text/fmt/xp/fp_Column.cpp
    CVS: src/text/fmt/xp/fp_Column.h
    CVS: src/text/fmt/xp/fp_ContainerObject.h
    CVS: src/text/fmt/xp/fp_FmtMarkRun.cpp
    CVS: src/text/fmt/xp/fp_FootnoteContainer.cpp
    CVS: src/text/fmt/xp/fp_Line.cpp src/text/fmt/xp/fp_Line.h
    CVS: src/text/fmt/xp/fp_Page.cpp src/text/fmt/xp/fp_Page.h
    CVS: src/text/fmt/xp/fp_Run.cpp src/text/fmt/xp/fp_Run.h
    CVS: src/text/fmt/xp/fp_TableContainer.cpp
    CVS: src/text/fmt/xp/fp_TableContainer.h
    CVS: src/text/fmt/xp/fp_TextRun.cpp src/text/fmt/xp/fp_TextRun.h
    CVS: src/text/fmt/xp/fv_View.cpp src/text/fmt/xp/fv_View_cmd.cpp
    CVS: src/text/fmt/xp/fv_View_protected.cpp
    CVS: src/wp/ap/unix/ap_UnixApp.cpp src/wp/ap/unix/ap_UnixFrame.cpp
    CVS: src/wp/ap/unix/ap_UnixFrameImpl.cpp
    CVS: src/wp/ap/unix/ap_UnixLeftRuler.cpp
    CVS: src/wp/ap/unix/ap_UnixTopRuler.cpp
    CVS: src/wp/ap/xp/ap_Dialog_Columns.cpp
    CVS: src/wp/ap/xp/ap_Dialog_FormatTable.cpp
    CVS: src/wp/ap/xp/ap_Dialog_Lists.cpp
    CVS: src/wp/ap/xp/ap_Dialog_PageNumbers.cpp
    CVS: src/wp/ap/xp/ap_EditMethods.cpp src/wp/ap/xp/ap_LeftRuler.cpp
    CVS: src/wp/ap/xp/ap_LeftRuler.h
    CVS: src/wp/ap/xp/ap_Preview_Paragraph.cpp
    CVS: src/wp/ap/xp/ap_Ruler.cpp src/wp/ap/xp/ap_TopRuler.cpp
    CVS: src/wp/ap/xp/ap_TopRuler.h src/wp/impexp/xp/ie_exp_HTML.cpp

    This archive was generated by hypermail 2.1.4 : Sat Feb 15 2003 - 08:47:41 EST