diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp index b20b4c900fb9c2..9d4343b2bc25d6 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp @@ -30,7 +30,8 @@ bool ParagraphAttributes::operator==(const ParagraphAttributes& rhs) const { rhs.includeFontPadding, rhs.android_hyphenationFrequency) && floatEquality(minimumFontSize, rhs.minimumFontSize) && - floatEquality(maximumFontSize, rhs.maximumFontSize); + floatEquality(maximumFontSize, rhs.maximumFontSize) && + floatEquality(minimumFontScale, rhs.minimumFontScale); } bool ParagraphAttributes::operator!=(const ParagraphAttributes& rhs) const { diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h index d73f8632b84f6f..4edbf06677c2bf 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h @@ -70,6 +70,13 @@ class ParagraphAttributes : public DebugStringConvertible { Float minimumFontSize{std::numeric_limits::quiet_NaN()}; Float maximumFontSize{std::numeric_limits::quiet_NaN()}; + + /* + * Specifies the smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. + * (values 0.01-1.0). + */ + Float minimumFontScale{std::numeric_limits::quiet_NaN()}; + bool operator==(const ParagraphAttributes&) const; bool operator!=(const ParagraphAttributes&) const; @@ -96,7 +103,8 @@ struct hash { attributes.minimumFontSize, attributes.maximumFontSize, attributes.includeFontPadding, - attributes.android_hyphenationFrequency); + attributes.android_hyphenationFrequency, + attributes.minimumFontScale); } }; } // namespace std diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h index d0271c53acf9c8..bc33f7325ab978 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h @@ -921,6 +921,12 @@ inline ParagraphAttributes convertRawProp( "adjustsFontSizeToFit", sourceParagraphAttributes.adjustsFontSizeToFit, defaultParagraphAttributes.adjustsFontSizeToFit); + paragraphAttributes.minimumFontScale = convertRawProp( + context, + rawProps, + "minimumFontScale", + sourceParagraphAttributes.minimumFontScale, + defaultParagraphAttributes.minimumFontScale); paragraphAttributes.minimumFontSize = convertRawProp( context, rawProps, diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp index 12e1b9780b8b9c..a483643ebdc434 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp @@ -96,6 +96,12 @@ void ParagraphProps::setProp( paragraphAttributes, adjustsFontSizeToFit, "adjustsFontSizeToFit"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + minimumFontScale, + "minimumFontScale"); REBUILD_FIELD_SWITCH_CASE( paDefaults, value,