Fix ideographic baseline to match spec. (flutter/engine#6422)
* Fix ideographic baseline to match spec.
This commit is contained in:
@@ -736,10 +736,8 @@ void Paragraph::Layout(double width, bool force) {
|
||||
max_line_spacing = line_spacing;
|
||||
if (line_number == 0) {
|
||||
alphabetic_baseline_ = line_spacing;
|
||||
// TODO(garyq): Properly implement ideographic_baseline_ and update
|
||||
// tests.
|
||||
ideographic_baseline_ =
|
||||
(metrics.fUnderlinePosition - metrics.fAscent) * style.height;
|
||||
(metrics.fDescent - metrics.fAscent) * style.height;
|
||||
}
|
||||
}
|
||||
max_line_spacing = std::max(line_spacing, max_line_spacing);
|
||||
|
||||
@@ -1876,7 +1876,7 @@ TEST_F(ParagraphTest, BaselineParagraph) {
|
||||
GetCanvas()->drawLine(0, paragraph->GetAlphabeticBaseline(),
|
||||
paragraph->GetMaxWidth(),
|
||||
paragraph->GetAlphabeticBaseline(), paint);
|
||||
ASSERT_DOUBLE_EQ(paragraph->GetIdeographicBaseline(), 70.180000305175781);
|
||||
ASSERT_DOUBLE_EQ(paragraph->GetIdeographicBaseline(), 79.035003662109375);
|
||||
ASSERT_DOUBLE_EQ(paragraph->GetAlphabeticBaseline(), 63.305000305175781);
|
||||
|
||||
ASSERT_TRUE(Snapshot());
|
||||
|
||||
Reference in New Issue
Block a user