Skip to content

Support minimumFontScale in paragraphAttributes #50933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ 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;

Expand All @@ -96,7 +103,8 @@ struct hash<facebook::react::ParagraphAttributes> {
attributes.minimumFontSize,
attributes.maximumFontSize,
attributes.includeFontPadding,
attributes.android_hyphenationFrequency);
attributes.android_hyphenationFrequency,
attributes.minimumFontScale);
}
};
} // namespace std
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading