[Impeller] libImpeller: Respect the paragraph style line height specification. (flutter/engine#56066)
cc @lyceel
This commit is contained in:
@@ -2143,7 +2143,12 @@ void ImpellerParagraphStyleSetFontSize(
|
||||
float size);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief Set the paragraph height.
|
||||
/// @brief The height of the text as a multiple of text size.
|
||||
///
|
||||
/// When height is 0.0, the line height will be determined by the
|
||||
/// font's metrics directly, which may differ from the font size.
|
||||
/// Otherwise the line height of the text will be a multiple of font
|
||||
/// size, and be exactly fontSize * height logical pixels tall.
|
||||
///
|
||||
/// @param[in] paragraph_style The paragraph style.
|
||||
/// @param[in] height The height.
|
||||
|
||||
@@ -207,6 +207,7 @@ TEST_P(InteropPlaygroundTest, CanCreateParagraphs) {
|
||||
auto style = Adopt<ParagraphStyle>(ImpellerParagraphStyleNew());
|
||||
ASSERT_TRUE(style);
|
||||
ImpellerParagraphStyleSetFontSize(style.GetC(), 150.0f);
|
||||
ImpellerParagraphStyleSetHeight(style.GetC(), 2.0f);
|
||||
|
||||
{
|
||||
auto paint = Adopt<Paint>(ImpellerPaintNew());
|
||||
|
||||
@@ -28,6 +28,7 @@ void ParagraphStyle::SetFontSize(double size) {
|
||||
|
||||
void ParagraphStyle::SetHeight(double height) {
|
||||
style_.height = height;
|
||||
style_.has_height_override = (height != 0.0);
|
||||
}
|
||||
|
||||
void ParagraphStyle::SetTextAlignment(txt::TextAlign alignment) {
|
||||
|
||||
Reference in New Issue
Block a user