[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Freetype] Help with kerning troubles?
From: |
Steve Johnson |
Subject: |
[Freetype] Help with kerning troubles? |
Date: |
Thu, 1 Nov 2001 09:20:50 -0800 |
Greetings,
I'm having a problem getting kerning working correctly. I seem to be
getting values for the kerning offsets that are about 1/4th as large as
they should be. I've looked thru the docs and double-checked my code,
but I can't figure out where I'm losing that factor of 4. Here's the
code in question:
static FT_Error
loadTrueTypeChar(TextInfo *tinf, CharInfo *chr, U16 thisChar,
U16 nextChar)
{
FT_Error tterr;
tterr = FT_Load_Char(tinf->Face, thisChar, 0);
if (tterr==0 && nextChar!=0xffff)
{
FT_Get_Kerning(tinf->Face, thisChar, nextChar,
0, &chr->kern);
}
else
{
chr->kern.x = 0;
chr->kern.y = 0;
}
if (tterr==0)
tterr = FT_Render_Glyph(tinf->Face->glyph,
(tinf->Smooth? ft_render_mode_normal : ft_render_mode_mono));
return(tterr);
}
*** This is the drawing code from my string drawing routine
that's looping over the string ***
if ((FTErr=loadTrueTypeChar(tinf, &chr, ch1, ch2))==0)
{
if (tinf->Smooth)
FTErr = renderGlyph(&chr, Dst, xx, yy);
else
FTErr = renderGlyphMono(&chr, Dst, xx, yy);
xx += chr.glyph->advance.x+chr.kern.x;
yy += chr.glyph->advance.y+chr.kern.y;
}
This code works well except for the kerning. If I multiply chr.kern.x
by 4 in the line that computes xx (third line from bottom), I get
roughly the right kerning behavior.
Can anyone see what I'm doing wrong, or suggest any possibilities?
TIA,
Steve Johnson
Manager of Software Engineering
Equilibrium Technologies, Inc.
- [Freetype] Help with kerning troubles?,
Steve Johnson <=