Re: GR_UnixPangoGraphics::_scaleCharacterMetrics unit confusion

From: John Wehle <john_at_feith.com>
Date: Fri Jan 30 2009 - 19:59:14 CET

> Another possibility for your problem is that m_iDeviceResolution is
> not set correctly.

It looks reasonable.

> In all my builds I always see a device resolution of 96.

The existing debug statements said:

DEBUG: GR_UnixPangoGraphics::graphicsAllocator
DEBUG: Initializing UnixPangoGraphics 8954000
DEBUG: cursor set to 1 gdk 68
DEBUG: @@@@@@@@@@@@@ retrieved DPI 96 @@@@@@@@@@@@@@@@@

And the statement I added to tdu said:

Zoom 114 DeviceRes 96 Res 1440

>> 1) I believe RI.m_pGlyphs->glyphs[i].geometry.width is PangoGlyphUnit,
>> not layout units.
>
> It starts out that way but it must end up in device units, ie the
> actual pixel position on the screen.

Okay I'm even more confused. What I see in the code is:

  pango_shape fills out m_pGlyphs based on the chosen font

  _scaleCharacterMetrics is intended to fill m_pScaledGlyphs
  based on m_pGlyphs and the current zoom

  m_pScaledGlyphs is passed to pango_xft_render to draw the
  actual glyphs

My pango documentation indicates that pango_shape fills in
glyphs with geometry information based on PANGO_SCALE (1024)
of a device unit. The documentation also indicates that
pango_xft_render expects the geometry of the glyphs to be
based on PANGO_SCALE (1024) of a device unit (i.e. the same
units as pango_shape).

  1) _tduX is looks like it works in layout units which appears
     to be 1440. How can it take something in pango units when
     it expects layout units?

  2) What am I missing in the pango documentation regarding the
     units used by the glyph parameter to pango_xft_render?

I do see that the x and y offsets passed to pango_xft_render for
where to start are in pixels, however that's separate from the
glyph information.

> The _tduX() method does what you want but in addition takes into
> account rounding unit adjustments when doing a horizontal scroll, (in
> case the width of the page is bigger that your frame).

I understand this when dealing with the x offset of the glyph. I don't
understand how anything regarding the scroll affects the glyph width.
Can you give me an example?

-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
Received on Fri Jan 30 19:59:21 2009

This archive was generated by hypermail 2.1.8 : Fri Jan 30 2009 - 19:59:21 CET