mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-31 05:51:47 +00:00
[ios] Fix kerning for Korean and Chinese characters. Issue #719
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user