From 7439b9847a2c4b44d158afe3a85de2297edfc825 Mon Sep 17 00:00:00 2001 From: GaryQian Date: Wed, 3 Oct 2018 16:01:55 -0700 Subject: [PATCH 1/2] Fix ideographic baseline to match spec. --- third_party/txt/src/txt/paragraph.cc | 2 +- third_party/txt/tests/paragraph_unittests.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index d583615f53cde..e16996db645d5 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -739,7 +739,7 @@ void Paragraph::Layout(double width, bool force) { // 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); diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 7a821d3d00b6b..b3e603866fbf6 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -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()); From 0f76c47eb1ca80c8dc33f7955c586e944d42836b Mon Sep 17 00:00:00 2001 From: GaryQian Date: Wed, 3 Oct 2018 16:05:08 -0700 Subject: [PATCH 2/2] Remove comment --- third_party/txt/src/txt/paragraph.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index e16996db645d5..17e0524beb4ef 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -736,8 +736,6 @@ 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.fDescent - metrics.fAscent) * style.height; }