cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/UIKitExtensions/UIFont+QMUI.h

104 lines
4.6 KiB
C
Raw Normal View History

2023-07-27 09:20:00 +08:00
/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2021 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 UIFontMediumMake(size) [UIFont qmui_mediumSystemFontOfSize:size]
#define UIFontMediumWithFont(_font) [UIFont qmui_mediumSystemFontOfSize:_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 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]
#define UIDynamicFontMediumMake(_pointSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize weight:QMUIFontWeightMedium italic:NO]
#define UIDynamicFontMediumMakeWithLimit(_pointSize, _upperLimitSize, _lowerLimitSize) [UIFont qmui_dynamicSystemFontOfSize:_pointSize upperLimitSize:_upperLimitSize lowerLimitSize:_lowerLimitSize weight:QMUIFontWeightMedium 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]
typedef NS_ENUM(NSUInteger, QMUIFontWeight) {
QMUIFontWeightLight, // 对应 UIFontWeightLight
QMUIFontWeightNormal, // 对应 UIFontWeightRegular
QMUIFontWeightMedium, // 对应 UIFontWeightMedium
QMUIFontWeightBold // 对应 UIFontWeightSemibold
};
@interface UIFont (QMUI)
/**
*
*
* @param fontSize
*
* @return UIFont
* @see UIFontLightMake
*/
+ (UIFont *)qmui_lightSystemFontOfSize:(CGFloat)fontSize;
/**
* Medium
*
* @param fontSize
*
* @return Medium UIFont
* @see UIFontMediumMake
*/
+ (UIFont *)qmui_mediumSystemFontOfSize:(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