[Impeller] libImpeller: Respect the paragraph style line height specification. (flutter/engine#56066)

cc @lyceel
This commit is contained in:
Chinmay Garde
2024-10-24 17:19:24 -07:00
committed by GitHub
parent 641814ad61
commit 97be50d961
3 changed files with 8 additions and 1 deletions

View File

@@ -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.

View File

@@ -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());

View File

@@ -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) {