diff -ur icu-4.6.orig/source/layout/LEFontInstance.cpp icu-4.6/source/layout/LEFontInstance.cpp --- icu-4.6.orig/source/layout/LEFontInstance.cpp 2007-01-25 20:57:43.000000000 +0100 +++ icu-4.6/source/layout/LEFontInstance.cpp 2010-12-02 15:24:41.000000000 +0100 @@ -145,5 +145,10 @@ return getAscent() + getDescent() + getLeading(); } +void LEFontInstance::getKernPair(LEGlyphID leftGlyph, LEGlyphID rightGlyph, LEPoint &kern) const +{ + kern.fX = kern.fY = 0; +} + U_NAMESPACE_END diff -ur icu-4.6.orig/source/layout/LEFontInstance.h icu-4.6/source/layout/LEFontInstance.h --- icu-4.6.orig/source/layout/LEFontInstance.h 2010-12-02 15:12:11.000000000 +0100 +++ icu-4.6/source/layout/LEFontInstance.h 2010-12-02 15:26:01.000000000 +0100 @@ -510,6 +510,11 @@ static UClassID getStaticClassID(); /** + * Returns kern value for a glyph pair, if the font has a kern pair list. + */ + virtual void getKernPair(LEGlyphID leftGlyph, LEGlyphID rightGlyph, LEPoint &kern) const; + + /** * Returns true if writing direction is vertical. */ virtual inline bool getLayoutDirVertical() const; diff -ur icu-4.6.orig/source/layout/LayoutEngine.cpp icu-4.6/source/layout/LayoutEngine.cpp --- icu-4.6.orig/source/layout/LayoutEngine.cpp 2009-03-03 00:35:48.000000000 +0100 +++ icu-4.6/source/layout/LayoutEngine.cpp 2010-12-02 15:28:25.000000000 +0100 @@ -369,9 +369,25 @@ if (fTypoFlags & 0x1) { /* kerning enabled */ static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG; - - KernTable kt(fFontInstance, getFontTable(kernTableTag)); - kt.process(glyphStorage); + const void* kernTableData = getFontTable(kernTableTag); + if (kernTableData != NULL) { + KernTable kt(fFontInstance, kernTableData); + kt.process(glyphStorage); + } + else { /* no 'kern' table, but the font might know kern pairs from an AFM file, for instance */ + float xAdjust = 0.0, yAdjust = 0.0; + LEGlyphID leftGlyph = glyphStorage.getGlyphID(0, success); + for (le_int32 i = 1; i < glyphStorage.getGlyphCount(); ++i) { + LEGlyphID rightGlyph = glyphStorage.getGlyphID(i, success); + LEPoint kern; + fFontInstance->getKernPair(leftGlyph, rightGlyph, kern); + xAdjust += fFontInstance->xUnitsToPoints(kern.fX); + yAdjust += fFontInstance->yUnitsToPoints(kern.fY); + glyphStorage.adjustPosition(i, xAdjust, yAdjust, success); + leftGlyph = rightGlyph; + } + glyphStorage.adjustPosition(glyphStorage.getGlyphCount(), xAdjust, yAdjust, success); + } } // default is no adjustments