mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Extend ParagraphAttribute to store the includeFontPadding prop
Summary: This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop. Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code. changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric Reviewed By: shergin Differential Revision: D21446738 fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86
This commit is contained in:
committed by
Facebook GitHub Bot
parent
16ea9ba813
commit
4e59508a8e
@@ -20,12 +20,14 @@ bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
|
||||
maximumNumberOfLines,
|
||||
ellipsizeMode,
|
||||
textBreakStrategy,
|
||||
adjustsFontSizeToFit) ==
|
||||
adjustsFontSizeToFit,
|
||||
includeFontPadding) ==
|
||||
std::tie(
|
||||
rhs.maximumNumberOfLines,
|
||||
rhs.ellipsizeMode,
|
||||
rhs.textBreakStrategy,
|
||||
rhs.adjustsFontSizeToFit) &&
|
||||
rhs.adjustsFontSizeToFit,
|
||||
rhs.includeFontPadding) &&
|
||||
floatEquality(minimumFontSize, rhs.minimumFontSize) &&
|
||||
floatEquality(maximumFontSize, rhs.maximumFontSize);
|
||||
}
|
||||
@@ -44,7 +46,8 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
|
||||
debugStringConvertibleItem("textBreakStrategy", textBreakStrategy),
|
||||
debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
|
||||
debugStringConvertibleItem("minimumFontSize", minimumFontSize),
|
||||
debugStringConvertibleItem("maximumFontSize", maximumFontSize)};
|
||||
debugStringConvertibleItem("maximumFontSize", maximumFontSize),
|
||||
debugStringConvertibleItem("includeFontPadding", includeFontPadding)};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,6 +49,12 @@ class ParagraphAttributes : public DebugStringConvertible {
|
||||
*/
|
||||
bool adjustsFontSizeToFit{};
|
||||
|
||||
/*
|
||||
* (Android only) Leaves enough room for ascenders and descenders instead of
|
||||
* using the font ascent and descent strictly.
|
||||
*/
|
||||
bool includeFontPadding{true};
|
||||
|
||||
/*
|
||||
* In case of font size adjustment enabled, defines minimum and maximum
|
||||
* font sizes.
|
||||
@@ -82,7 +88,8 @@ struct hash<facebook::react::ParagraphAttributes> {
|
||||
attributes.textBreakStrategy,
|
||||
attributes.adjustsFontSizeToFit,
|
||||
attributes.minimumFontSize,
|
||||
attributes.maximumFontSize);
|
||||
attributes.maximumFontSize,
|
||||
attributes.includeFontPadding);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
Reference in New Issue
Block a user