Implement kerning, ligatures, etc., and cleanup; in ios.

Implement hasGlyph ligature helper.

Export view property setters for:
 text: textLength, baselineShift, lengthAdjust, alignmentBaseline,
 textPath: side, method, midLine, spacing.

Attempt to fix alignmentBaseline and baselineShift,
but both properties are nil at all times, I must be missing something.
This commit is contained in:
Mikael Sand
2017-08-29 02:34:56 +03:00
parent 0dbddcc2b4
commit 04887af278
15 changed files with 505 additions and 916 deletions
-21
View File
@@ -10,14 +10,12 @@
#import "RNSVGTextPath.h"
#import <React/RCTFont.h>
#import <CoreText/CoreText.h>
#import "RNSVGGlyphContext.h"
#import "GlyphContext.h"
@implementation RNSVGText
{
RNSVGText *_textRoot;
GlyphContext *_glyphContext;
RNSVGGlyphContext *_RNSVGGlyphContext;
}
- (void)renderLayerTo:(CGContextRef)context
@@ -40,8 +38,6 @@
{
_glyphContext = [[GlyphContext alloc] initWithScale:1 width:[self getContextWidth]
height:[self getContextHeight]];
_RNSVGGlyphContext = [[RNSVGGlyphContext alloc] initWithDimensions:[self getContextWidth]
height:[self getContextHeight]];
}
// release the cached CGPathRef for RNSVGTSpan
@@ -95,11 +91,6 @@
return _textRoot;
}
- (RNSVGGlyphContext *)getRNSVGGlyphContext
{
return _RNSVGGlyphContext;
}
- (GlyphContext *)getGlyphContext
{
return _glyphContext;
@@ -107,12 +98,6 @@
- (void)pushGlyphContext
{
/*
[[[self getTextRoot] getRNSVGGlyphContext] pushContext:self.font
deltaX:self.deltaX
deltaY:self.deltaY
positionX:self.positionX
positionY:self.positionY];*/
[[[self getTextRoot] getGlyphContext] pushContextwithRNSVGText:self
reset:false
font:self.font
@@ -125,7 +110,6 @@
- (void)popGlyphContext
{
//[[[self getTextRoot] getRNSVGGlyphContext] popContext];
[[[self getTextRoot] getGlyphContext] popContext];
}
@@ -134,9 +118,4 @@
return [[[self getTextRoot] getGlyphContext] getGlyphFont];
}
- (CGPoint)getGlyphPointFromContext:(CGPoint)offset glyphWidth:(CGFloat)glyphWidth
{
return [[[self getTextRoot] getRNSVGGlyphContext] getNextGlyphPoint:(CGPoint)offset glyphWidth:glyphWidth];
}
@end