Fix fontWeight and fontStyle

This commit is contained in:
Horcrux
2017-11-07 19:29:36 +08:00
parent 2998aa1bb6
commit 6081b27822
3 changed files with 4 additions and 5 deletions
-2
View File
@@ -14,10 +14,8 @@
NSString * fontSize_;
NSString *fontFamily;
enum FontStyle fontStyle;
NSString * fontStyle_;
NSDictionary * fontData;
enum FontWeight fontWeight;
NSString * fontWeight_;
NSString *fontFeatureSettings;
enum FontVariantLigatures fontVariantLigatures;
enum TextAnchor textAnchor;
+1 -1
View File
@@ -9,7 +9,7 @@ enum FontWeight FontWeightFromString( NSString* s )
{
const NSUInteger l = sizeof(FontWeightStrings) / sizeof(NSString*);
for (NSUInteger i = 0; i < l; i++) {
if ([s isEqualToString:FontWeightStrings[i]]) {
if ([[s capitalizedString] isEqualToString:FontWeightStrings[i]]) {
return i;
}
}
+3 -2
View File
@@ -82,8 +82,9 @@
{
NSString *fontFamily = topFont_->fontFamily;
NSNumber * fontSize = [NSNumber numberWithDouble:topFont_->fontSize];
NSString * fontWeight = topFont_->fontWeight_;
NSString * fontStyle = topFont_->fontStyle_;
NSString * fontWeight = [FontWeightToString(topFont_->fontWeight) lowercaseString];
NSString * fontStyle = FontStyleStrings[topFont_->fontStyle];
BOOL fontFamilyFound = NO;
NSArray *supportedFontFamilyNames = [UIFont familyNames];