Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all system fonts are supported #372

Open
ArniDexian opened this issue Jun 22, 2017 · 1 comment
Open

Not all system fonts are supported #372

ArniDexian opened this issue Jun 22, 2017 · 1 comment

Comments

@ArniDexian
Copy link

ArniDexian commented Jun 22, 2017

The docs saying:

FontName - A font name. See available values here. Can also be one of the following:
system
boldSystem
italicSystem
blackSystem
heavySystem
lightSystem
mediumSystem
semiboldSystem
thinSystem
ultraLightSystem

But, only some types are supported:

[NUISettings.m, line 202]
+ (UIFont*)getFontWithClass:(NSString*)className baseFont:(UIFont *)baseFont
{
    NSString *propertyName;
    CGFloat fontSize;
    UIFont *font = nil;
...
    propertyName = @"font-name";
    
    if ([self hasProperty:propertyName withClass:className]) {
        NSString *fontName = [self get:propertyName withClass:className];
        
        if ([fontName isEqualToString:@"system"]) {
            font = [UIFont systemFontOfSize:fontSize];
        } else if ([fontName isEqualToString:@"boldSystem"]) {
            font = [UIFont boldSystemFontOfSize:fontSize];
        } else if ([fontName isEqualToString:@"italicSystem"]) {
            font = [UIFont italicSystemFontOfSize:fontSize];
        } else {
            font = [UIFont fontWithName:fontName size:fontSize];
        }
    } else {
        font = baseFont ? [baseFont fontWithSize:fontSize] : [UIFont systemFontOfSize:fontSize];
    }
    
    return font;
}

Moreover I think it would great to throw assert if some font is not found.

@ArniDexian
Copy link
Author

Can be fixed by using [UIFont systemFontOfSize:fontSize weight:UIFontWeightSemibold/UIFontWeightHeavy etc];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant