Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix ideographic baseline to match spec. #6422

Merged
merged 2 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions third_party/txt/src/txt/paragraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion third_party/txt/tests/paragraph_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down