[ios] Fix kerning for Korean and Chinese characters. Issue #719

This commit is contained in:
Mikael Sand
2018-07-02 08:16:05 +03:00
parent e5da8acdbf
commit 85729ee658
+1 -8
View File
@@ -683,11 +683,7 @@ static double RNSVGTSpan_radToDeg = 180 / M_PI;
/*
Determine the glyph's charwidth (i.e., the amount which the current text position
advances horizontally when the glyph is drawn using horizontal text layout).
*/
double unkernedAdvance = CTFontGetAdvancesForGlyphs(fontRef, kCTFontOrientationHorizontal, &glyph, NULL, 1);
CGFloat charWidth = unkernedAdvance * scaleSpacingAndGlyphs;
/*
For each subsequent glyph, set a new startpoint-on-the-path as the previous
endpoint-on-the-path, but with appropriate adjustments taking into account
horizontal kerning tables in the font and current values of various attributes
@@ -696,10 +692,7 @@ static double RNSVGTSpan_radToDeg = 180 / M_PI;
adjustments are calculated as distance adjustments along the path, calculated
using the user agent's distance along the path algorithm.
*/
if (autoKerning) {
double kerned = advances[g].width * scaleSpacingAndGlyphs;
kerning = kerned - charWidth;
}
CGFloat charWidth = advances[g].width * scaleSpacingAndGlyphs;
CFIndex currIndex = indices[g];
char currentChar = [str characterAtIndex:currIndex];