You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.8 KiB

/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2020 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
//
// UIFont+QMUI.h
// qmui
//
// Created by QMUI Team on 15/7/20.
//
#import <UIKit/UIKit.h>
#define UIFontLightMake(size) [UIFont qmui_lightSystemFontOfSize:size]
#define UIFontLightWithFont(_font) [UIFont qmui_lightSystemFontOfSize:_font.pointSize]
#define UIDynamicFontMake(_pointSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize weight:QMUIFontWeightNormal italic:NO]
#define UIDynamicFontMakeWithLimit(_pointSize, _upperLimitSize, _lowerLimitSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize upperLimitSize:_upperLimitSize lowerLimitSize:_lowerLimitSize weight:QMUIFontWeightNormal italic:NO]
#define UIDynamicFontBoldMake(_pointSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize weight:QMUIFontWeightBold italic:NO]
#define UIDynamicFontBoldMakeWithLimit(_pointSize, _upperLimitSize, _lowerLimitSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize upperLimitSize:_upperLimitSize lowerLimitSize:_lowerLimitSize weight:QMUIFontWeightBold italic:NO]
#define UIDynamicFontLightMake(_pointSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize weight:QMUIFontWeightLight italic:NO]
#define UIDynamicFontLightMakeWithLimit(_pointSize, _upperLimitSize, _lowerLimitSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize upperLimitSize:_upperLimitSize lowerLimitSize:_lowerLimitSize weight:QMUIFontWeightLight italic:NO]
typedef NS_ENUM(NSUInteger, QMUIFontWeight) {
QMUIFontWeightLight, // 对应 UIFontWeightLight
QMUIFontWeightNormal, // 对应 UIFontWeightRegular
QMUIFontWeightBold // 对应 UIFontWeightSemibold
};
@interface UIFont (QMUI)
/**
*
*
* @param fontSize
*
* @return UIFont
*/
+ (UIFont *)qmui_lightSystemFontOfSize:(CGFloat)fontSize;
/**
* UIFont
* @param size
* @param weight
* @param italic
*/
+ (UIFont *)qmui_systemFontOfSize:(CGFloat)size
weight:(QMUIFontWeight)weight
italic:(BOOL)italic;
/**
* UIFont
* @param size
* @param weight
* @param italic
* @return UIFont
*/
+ (UIFont *)qmui_dynamicSystemFontOfSize:(CGFloat)size
weight:(QMUIFontWeight)weight
italic:(BOOL)italic;
/**
* UIFont
*
* @param pointSize size
* @param upperLimitSize
* @param lowerLimitSize
* @param weight
* @param italic
*
* @return UIFont
*/
+ (UIFont *)qmui_dynamicSystemFontOfSize:(CGFloat)pointSize
upperLimitSize:(CGFloat)upperLimitSize
lowerLimitSize:(CGFloat)lowerLimitSize
weight:(QMUIFontWeight)weight
italic:(BOOL)italic;
@end