mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Disable font scaling when an explicit font handler is set
Reviewed By: sahrens Differential Revision: D7003464 fbshipit-source-id: f36ff344c50a9c63af6c852138041c1c918259c8
This commit is contained in:
committed by
Facebook Github Bot
parent
cff522d283
commit
f96dfb9468
@@ -20,6 +20,7 @@ typedef UIFont *(^RCTFontHandler)(CGFloat fontSize, NSString *fontWeightDescript
|
||||
* "semibold", "extrabold", "bold", "heavy", or "black".
|
||||
*/
|
||||
RCT_EXTERN void RCTSetDefaultFontHandler(RCTFontHandler handler);
|
||||
RCT_EXTERN BOOL RCTHasFontHandlerSet();
|
||||
|
||||
@interface RCTFont : NSObject
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ void RCTSetDefaultFontHandler(RCTFontHandler handler) {
|
||||
defaultFontHandler = handler;
|
||||
}
|
||||
|
||||
BOOL RCTHasFontHandlerSet() {
|
||||
return defaultFontHandler != nil;
|
||||
}
|
||||
|
||||
// We pass a string description of the font weight to the defaultFontHandler because UIFontWeight
|
||||
// is not defined pre-iOS 8.2.
|
||||
// Furthermore, UIFontWeight's are lossy floats, so we must use an inexact compare to figure out
|
||||
|
||||
Reference in New Issue
Block a user