On Fri, Jan 30, 2009 at 8:15 PM, John Wehle <john@feith.com> wrote:
>
> Perhaps someone familiar with the code can sanity check me.
>
> I'm working on tracking down character spacing problems using
> abiword 2.6.6 on FreeBSD 6.4. For example if I start abiword
> and enter "Hello" all the letters overlap by about 90% (i.e.
> what I see is a black ink smudge).
>
> I believe the intent of GR_UnixPangoGraphics::_scaleCharacterMetrics
> is to create a copy of the font metrics which has been adjusted to
> reflect the current scale factor. However I'm puzzled by:
>
> RI.m_pScaledGlyphs->glyphs[i].geometry.width =
> _tduX(RI.m_pGlyphs->glyphs[i].geometry.width);
>
> _tduX is described as converting layout units to device units while
> taking account of the X-scroll offset.
>
> 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.
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).
Another possibility for your problem is that m_iDeviceResolution is
not set correctly.
Look at this code in
src/af/gr/unix/gr_UnixPangoGraphics::init()
line 446 onwards
FcPattern *pattern = FcPatternCreate();
if (pattern)
{
double dpi;
XftDefaultSubstitute (GDK_SCREEN_XDISPLAY (gScreen),
iScreen,
pattern);
if(FcResultMatch == FcPatternGetDouble (pattern,
FC_DPI, 0, &dpi))
{
m_iDeviceResolution = (UT_uint32)round(dpi);
bGotResolution = true;
}
FcPatternDestroy (pattern);
I suggest you do a debug build (with --enable-debug in the configure
line) then place a UT_DEBUGMSG like this...
FcPattern *pattern = FcPatternCreate();
if (pattern)
{
double dpi;
XftDefaultSubstitute (GDK_SCREEN_XDISPLAY (gScreen),
iScreen,
pattern);
if(FcResultMatch == FcPatternGetDouble (pattern,
FC_DPI, 0, &dpi))
{
m_iDeviceResolution = (UT_uint32)round(dpi);
bGotResolution = true;
UT_DEBUGMSG(("!!!!!!!Got a
device resolution of %d \n",m_iDeviceResolution));
}
FcPatternDestroy (pattern);
In all my builds I always see a device resolution of 96.
If you see something significantly different that is almost certainly
your problem.
Good Luck! Let us know what you find!
Cheers
Martin
> 2) I believe that RI.m_pScaledGlyphs->glyphs[i].geometry.width is
> PangoGlyphUnit, not a device units.
>
> 3) I'm unclear how the X-scroll offset affects the width of a character.
>
> Doing something like:
>
> RI.m_pScaledGlyphs->glyphs[i].geometry.width =
> (int)((double)RI.m_pGlyphs->glyphs[i].geometry.width * iZoom / 100);
>
> seems to make more sense and produces a more reasonable display on my
> system.
>
> Thoughts?
>
> -- John
> -------------------------------------------------------------------------
> | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
> | John Wehle | Fax: 1-215-540-5495 | |
> -------------------------------------------------------------------------
>
>
Received on Fri Jan 30 12:16:19 2009
This archive was generated by hypermail 2.1.8 : Fri Jan 30 2009 - 12:16:19 CET