//
//  UIFont+HP.m
//  Hippo
//

#import "UIFont+HP.h"

// PingFang SC 字族名称常量
static NSString * const kHPFontPingFangLight    = @"PingFangSC-Light";
static NSString * const kHPFontPingFangRegular  = @"PingFangSC-Regular";
static NSString * const kHPFontPingFangMedium   = @"PingFangSC-Medium";
static NSString * const kHPFontPingFangSemibold = @"PingFangSC-Semibold";

@implementation UIFont (HP)

#pragma mark - PingFang SC Light（细体）

+ (UIFont *)hp_pingFangLight:(CGFloat)size {
    UIFont *font = [UIFont fontWithName:kHPFontPingFangLight size:size];
    // 若系统不支持该字体，回退到系统字体对应字重
    return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightLight];
}

#pragma mark - PingFang SC Regular（常规）

+ (UIFont *)hp_pingFangRegular:(CGFloat)size {
    UIFont *font = [UIFont fontWithName:kHPFontPingFangRegular size:size];
    return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
}

#pragma mark - PingFang SC Medium（中等）

+ (UIFont *)hp_pingFangMedium:(CGFloat)size {
    UIFont *font = [UIFont fontWithName:kHPFontPingFangMedium size:size];
    return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
}

#pragma mark - PingFang SC Semibold（半粗）

+ (UIFont *)hp_pingFangSemibold:(CGFloat)size {
    UIFont *font = [UIFont fontWithName:kHPFontPingFangSemibold size:size];
    return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightSemibold];
}

@end
