mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 08:45:00 +00:00
Disable ligatures on ios (doesn't account for per character advance width correctly yet)
This commit is contained in:
@@ -77,11 +77,13 @@
|
|||||||
if (font != nil) {
|
if (font != nil) {
|
||||||
attributes = (__bridge CFDictionaryRef)@{
|
attributes = (__bridge CFDictionaryRef)@{
|
||||||
(NSString *)kCTFontAttributeName: (__bridge id)font,
|
(NSString *)kCTFontAttributeName: (__bridge id)font,
|
||||||
(NSString *)kCTForegroundColorFromContextAttributeName: @YES
|
(NSString *)kCTForegroundColorFromContextAttributeName: @YES,
|
||||||
|
(NSString *)NSLigatureAttributeName: @0
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
attributes = (__bridge CFDictionaryRef)@{
|
attributes = (__bridge CFDictionaryRef)@{
|
||||||
(NSString *)kCTForegroundColorFromContextAttributeName: @YES
|
(NSString *)kCTForegroundColorFromContextAttributeName: @YES,
|
||||||
|
(NSString *)NSLigatureAttributeName: @0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,8 +683,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFIndex runEnd = CFArrayGetCount(runs);
|
CFIndex runEnd = CFArrayGetCount(runs);
|
||||||
for (CFIndex i = 0; i < runEnd; i++) {
|
for (CFIndex r = 0; r < runEnd; r++) {
|
||||||
CTRunRef run = CFArrayGetValueAtIndex(CTLineGetGlyphRuns(line), i);
|
CTRunRef run = CFArrayGetValueAtIndex(runs, r);
|
||||||
|
|
||||||
CFIndex runGlyphCount = CTRunGetGlyphCount(run);
|
CFIndex runGlyphCount = CTRunGetGlyphCount(run);
|
||||||
CGPoint positions[runGlyphCount];
|
CGPoint positions[runGlyphCount];
|
||||||
@@ -693,14 +695,14 @@
|
|||||||
CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs);
|
CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs);
|
||||||
CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName);
|
CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName);
|
||||||
|
|
||||||
for(CFIndex i = 0; i < runGlyphCount; i++) {
|
for(CFIndex g = 0; g < runGlyphCount; g++) {
|
||||||
CGPathRef letter = CTFontCreatePathForGlyph(runFont, glyphs[i], nil);
|
CGPathRef letter = CTFontCreatePathForGlyph(runFont, glyphs[g], nil);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Determine the glyph's charwidth (i.e., the amount which the current text position
|
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).
|
advances horizontally when the glyph is drawn using horizontal text layout).
|
||||||
*/
|
*/
|
||||||
CGFloat charWidth = glyph_advances[i].width * scaleSpacingAndGlyphs;
|
CGFloat charWidth = glyph_advances[g].width * scaleSpacingAndGlyphs;
|
||||||
//CGPoint glyphPoint = [self getGlyphPointFromContext:positions[i] glyphWidth:CGRectGetWidth(CGPathGetBoundingBox(letter))];
|
//CGPoint glyphPoint = [self getGlyphPointFromContext:positions[i] glyphWidth:CGRectGetWidth(CGPathGetBoundingBox(letter))];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user