mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support minimumFontScale in paragraphAttributes (#50933)
Summary: Support minimumFontScale in paragraphAttributes Resolves https://github.com/facebook/react-native/issues/50934 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [GENERAL] [ADDED] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Support minimumFontScale in paragraphAttributes Pull Request resolved: https://github.com/facebook/react-native/pull/50933 Test Plan: Tested via this code here: https://github.com/microsoft/react-native-windows/pull/14617 Before:  After:  https://github.com/user-attachments/assets/fb9ae889-7d01-4317-a6e6-61e6b0708bc4 Reviewed By: NickGerleman Differential Revision: D73658489 Pulled By: cipolleschi fbshipit-source-id: 87ed27c0de2363e2ce0d908cc26670349586e7a6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0abd5d63e1
commit
f53d066d26
+2
-1
@@ -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 {
|
||||
|
||||
+8
-1
@@ -70,6 +70,12 @@ class ParagraphAttributes : public DebugStringConvertible {
|
||||
Float minimumFontSize{std::numeric_limits<Float>::quiet_NaN()};
|
||||
Float maximumFontSize{std::numeric_limits<Float>::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<Float>::quiet_NaN()};
|
||||
|
||||
bool operator==(const ParagraphAttributes&) const;
|
||||
bool operator!=(const ParagraphAttributes&) const;
|
||||
|
||||
@@ -96,7 +102,8 @@ struct hash<facebook::react::ParagraphAttributes> {
|
||||
attributes.minimumFontSize,
|
||||
attributes.maximumFontSize,
|
||||
attributes.includeFontPadding,
|
||||
attributes.android_hyphenationFrequency);
|
||||
attributes.android_hyphenationFrequency,
|
||||
attributes.minimumFontScale);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
@@ -948,6 +948,12 @@ inline ParagraphAttributes convertRawProp(
|
||||
"adjustsFontSizeToFit",
|
||||
sourceParagraphAttributes.adjustsFontSizeToFit,
|
||||
defaultParagraphAttributes.adjustsFontSizeToFit);
|
||||
paragraphAttributes.minimumFontScale = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"minimumFontScale",
|
||||
sourceParagraphAttributes.minimumFontScale,
|
||||
defaultParagraphAttributes.minimumFontScale);
|
||||
paragraphAttributes.minimumFontSize = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user