diff --git a/ios/Text/RNSVGTSpan.m b/ios/Text/RNSVGTSpan.m index fb3fca95..4800b421 100644 --- a/ios/Text/RNSVGTSpan.m +++ b/ios/Text/RNSVGTSpan.m @@ -20,7 +20,7 @@ NSCharacterSet *separators = nil; RNSVGTextPath *textPath; NSArray *lengths; NSArray *lines; - NSInteger lineCount; + NSUInteger lineCount; BOOL isClosed; } @@ -115,7 +115,7 @@ NSCharacterSet *separators = nil; FontData* font = [gc getFont]; NSUInteger n = str.length; bool ligature[n]; - for (int i = 0; i < n; i++){ + for (NSUInteger i = 0; i < n; i++){ ligature[i] = NO; } /* @@ -682,7 +682,6 @@ NSCharacterSet *separators = nil; break; } } - int i = -1; CFDictionaryRef ligattributes; NSNumber *lig = [NSNumber numberWithInt:allowOptionalLigatures ? 2 : 1]; @@ -697,8 +696,7 @@ NSCharacterSet *separators = nil; }; } for(CFIndex g = 0; g < runGlyphCount; g++) { - i++; - bool alreadyRenderedGraphemeCluster = ligature[i]; + bool alreadyRenderedGraphemeCluster = ligature[g]; /* Determine the glyph's charwidth (i.e., the amount which the current text position @@ -721,13 +719,13 @@ NSCharacterSet *separators = nil; kerning = kerned - charWidth; } - char currentChar = [str characterAtIndex:i]; + char currentChar = [str characterAtIndex:g]; bool isWordSeparator = [separators characterIsMember:currentChar]; double wordSpace = isWordSeparator ? wordSpacing : 0; double spacing = wordSpace + letterSpacing; double advance = charWidth + spacing; - double x = [gc nextXWithDouble:kerning + charWidth]; + double x = [gc nextXWithDouble:kerning + advance]; double y = [gc nextY]; double dx = [gc nextDeltaX]; double dy = [gc nextDeltaY]; @@ -739,12 +737,12 @@ NSCharacterSet *separators = nil; continue; } - int len = 2; - int nextIndex = i; + NSUInteger len = 2; + NSUInteger nextIndex = g; CGGlyph glyph = glyphs[g]; bool hasLigature = false; while (++nextIndex < n) { - NSString* nextLigature = [str substringWithRange:NSMakeRange(i, len++)]; + NSString* nextLigature = [str substringWithRange:NSMakeRange(g, len++)]; bool hasNextLigature = hasGlyph(fontRef, nextLigature, &glyph, ligattributes); if (hasNextLigature) { ligature[nextIndex] = true; diff --git a/ios/Text/RNSVGTextPath.h b/ios/Text/RNSVGTextPath.h index 4105dc6f..f6a3bfeb 100644 --- a/ios/Text/RNSVGTextPath.h +++ b/ios/Text/RNSVGTextPath.h @@ -19,7 +19,7 @@ @property (nonatomic, strong) NSString *spacing; @property (nonatomic, strong) NSString *startOffset; -- (void)getPathLength:(CGFloat*)length lineCount:(NSInteger*)lineCount lengths:(NSArray* __strong *)lengths lines:(NSArray* __strong *)lines isClosed:(BOOL*)isClosed; +- (void)getPathLength:(CGFloat*)length lineCount:(NSUInteger*)lineCount lengths:(NSArray* __strong *)lengths lines:(NSArray* __strong *)lines isClosed:(BOOL*)isClosed; @end diff --git a/ios/Text/RNSVGTextPath.m b/ios/Text/RNSVGTextPath.m index db633b60..ab9b5f67 100644 --- a/ios/Text/RNSVGTextPath.m +++ b/ios/Text/RNSVGTextPath.m @@ -167,12 +167,12 @@ void addLine(CGPoint *last, const CGPoint *next, NSMutableArray *lines, CGFloat CGPathRef _path; NSMutableArray *lengths; NSMutableArray *lines; - NSInteger lineCount; + NSUInteger lineCount; CGFloat length; BOOL isClosed; } -- (void)getPathLength:(CGFloat*)lengthP lineCount:(NSInteger*)lineCountP lengths:(NSArray* __strong *)lengthsP lines:(NSArray* __strong *)linesP isClosed:(BOOL*)isClosedP +- (void)getPathLength:(CGFloat*)lengthP lineCount:(NSUInteger*)lineCountP lengths:(NSArray* __strong *)lengthsP lines:(NSArray* __strong *)linesP isClosed:(BOOL*)isClosedP { RNSVGSvgView *svg = [self getSvgView]; RNSVGNode *template = [svg getDefinedTemplate:self.href];