From 0ac9398b919d0475aa68211e460d44a82c1a1ffa Mon Sep 17 00:00:00 2001 From: mengyanluo Date: Thu, 27 Jan 2022 14:43:28 +0800 Subject: [PATCH] feat(ios): set default font size to 14 --- ios/sdk/component/text/HippyShadowText.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/sdk/component/text/HippyShadowText.mm b/ios/sdk/component/text/HippyShadowText.mm index 90029c2eb6f..01ea6c84618 100644 --- a/ios/sdk/component/text/HippyShadowText.mm +++ b/ios/sdk/component/text/HippyShadowText.mm @@ -42,6 +42,8 @@ CGFloat const HippyTextAutoSizeHeightErrorMargin = 0.025f; CGFloat const HippyTextAutoSizeGranularity = 0.001f; +static const CGFloat gDefaultFontSize = 14.f; + @implementation HippyShadowText // MTTlayout static MTTSize x5MeasureFunc( @@ -357,6 +359,10 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily if (_fontSize && !isnan(_fontSize)) { fontSize = @(_fontSize); } + else if (nil == fontSize) { + //default font size is 14 + fontSize = @(gDefaultFontSize); + } if (_fontWeight) { fontWeight = _fontWeight; }