diff options
Diffstat (limited to 'Build/source/libs/icu/icu-4.2.1-PATCHES/patch-60-KernPair')
-rw-r--r-- | Build/source/libs/icu/icu-4.2.1-PATCHES/patch-60-KernPair | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-4.2.1-PATCHES/patch-60-KernPair b/Build/source/libs/icu/icu-4.2.1-PATCHES/patch-60-KernPair new file mode 100644 index 00000000000..983f0d685cf --- /dev/null +++ b/Build/source/libs/icu/icu-4.2.1-PATCHES/patch-60-KernPair @@ -0,0 +1,61 @@ +diff -ur icu-4.2.1.orig/source/layout/LEFontInstance.cpp icu-4.2.1/source/layout/LEFontInstance.cpp +--- icu-4.2.1.orig/source/layout/LEFontInstance.cpp 2009-07-01 20:51:24.000000000 +0200 ++++ icu-4.2.1/source/layout/LEFontInstance.cpp 2009-10-23 00:16:48.000000000 +0200 +@@ -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.2.1.orig/source/layout/LEFontInstance.h icu-4.2.1/source/layout/LEFontInstance.h +--- icu-4.2.1.orig/source/layout/LEFontInstance.h 2009-10-23 00:14:44.000000000 +0200 ++++ icu-4.2.1/source/layout/LEFontInstance.h 2009-10-23 00:16:48.000000000 +0200 +@@ -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.2.1.orig/source/layout/LayoutEngine.cpp icu-4.2.1/source/layout/LayoutEngine.cpp +--- icu-4.2.1.orig/source/layout/LayoutEngine.cpp 2009-07-01 20:51:24.000000000 +0200 ++++ icu-4.2.1/source/layout/LayoutEngine.cpp 2009-10-23 00:16:48.000000000 +0200 +@@ -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 |