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

Commit 061cc66

Browse files
authored
Fix ideographic baseline to match spec. (#6422)
* Fix ideographic baseline to match spec.
1 parent 74eac1f commit 061cc66

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

third_party/txt/src/txt/paragraph.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,8 @@ void Paragraph::Layout(double width, bool force) {
736736
max_line_spacing = line_spacing;
737737
if (line_number == 0) {
738738
alphabetic_baseline_ = line_spacing;
739-
// TODO(garyq): Properly implement ideographic_baseline_ and update
740-
// tests.
741739
ideographic_baseline_ =
742-
(metrics.fUnderlinePosition - metrics.fAscent) * style.height;
740+
(metrics.fDescent - metrics.fAscent) * style.height;
743741
}
744742
}
745743
max_line_spacing = std::max(line_spacing, max_line_spacing);

third_party/txt/tests/paragraph_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ TEST_F(ParagraphTest, BaselineParagraph) {
18761876
GetCanvas()->drawLine(0, paragraph->GetAlphabeticBaseline(),
18771877
paragraph->GetMaxWidth(),
18781878
paragraph->GetAlphabeticBaseline(), paint);
1879-
ASSERT_DOUBLE_EQ(paragraph->GetIdeographicBaseline(), 70.180000305175781);
1879+
ASSERT_DOUBLE_EQ(paragraph->GetIdeographicBaseline(), 79.035003662109375);
18801880
ASSERT_DOUBLE_EQ(paragraph->GetAlphabeticBaseline(), 63.305000305175781);
18811881

18821882
ASSERT_TRUE(Snapshot());

0 commit comments

Comments
 (0)