Skip to content

Commit 4e59508

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent 16ea9ba commit 4e59508

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
2020
maximumNumberOfLines,
2121
ellipsizeMode,
2222
textBreakStrategy,
23-
adjustsFontSizeToFit) ==
23+
adjustsFontSizeToFit,
24+
includeFontPadding) ==
2425
std::tie(
2526
rhs.maximumNumberOfLines,
2627
rhs.ellipsizeMode,
2728
rhs.textBreakStrategy,
28-
rhs.adjustsFontSizeToFit) &&
29+
rhs.adjustsFontSizeToFit,
30+
rhs.includeFontPadding) &&
2931
floatEquality(minimumFontSize, rhs.minimumFontSize) &&
3032
floatEquality(maximumFontSize, rhs.maximumFontSize);
3133
}
@@ -44,7 +46,8 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
4446
debugStringConvertibleItem("textBreakStrategy", textBreakStrategy),
4547
debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
4648
debugStringConvertibleItem("minimumFontSize", minimumFontSize),
47-
debugStringConvertibleItem("maximumFontSize", maximumFontSize)};
49+
debugStringConvertibleItem("maximumFontSize", maximumFontSize),
50+
debugStringConvertibleItem("includeFontPadding", includeFontPadding)};
4851
}
4952
#endif
5053

ReactCommon/fabric/attributedstring/ParagraphAttributes.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class ParagraphAttributes : public DebugStringConvertible {
4949
*/
5050
bool adjustsFontSizeToFit{};
5151

52+
/*
53+
* (Android only) Leaves enough room for ascenders and descenders instead of
54+
* using the font ascent and descent strictly.
55+
*/
56+
bool includeFontPadding{true};
57+
5258
/*
5359
* In case of font size adjustment enabled, defines minimum and maximum
5460
* font sizes.
@@ -82,7 +88,8 @@ struct hash<facebook::react::ParagraphAttributes> {
8288
attributes.textBreakStrategy,
8389
attributes.adjustsFontSizeToFit,
8490
attributes.minimumFontSize,
85-
attributes.maximumFontSize);
91+
attributes.maximumFontSize,
92+
attributes.includeFontPadding);
8693
}
8794
};
8895
} // namespace std

0 commit comments

Comments
 (0)