未验证 提交 da352d0f 编写于 作者: D Dan Field 提交者: GitHub

Revert "Track detailed LibTxt metrics with LineMetrics(#10127)" (#10982)

This reverts commit 8682aaf4.
上级 23700fc1
......@@ -1116,7 +1116,6 @@ FILE: ../../../flutter/third_party/txt/src/txt/font_skia.cc
FILE: ../../../flutter/third_party/txt/src/txt/font_skia.h
FILE: ../../../flutter/third_party/txt/src/txt/font_style.h
FILE: ../../../flutter/third_party/txt/src/txt/font_weight.h
FILE: ../../../flutter/third_party/txt/src/txt/line_metrics.h
FILE: ../../../flutter/third_party/txt/src/txt/paint_record.cc
FILE: ../../../flutter/third_party/txt/src/txt/paint_record.h
FILE: ../../../flutter/third_party/txt/src/txt/paragraph.h
......@@ -1130,7 +1129,6 @@ FILE: ../../../flutter/third_party/txt/src/txt/paragraph_txt.cc
FILE: ../../../flutter/third_party/txt/src/txt/paragraph_txt.h
FILE: ../../../flutter/third_party/txt/src/txt/placeholder_run.cc
FILE: ../../../flutter/third_party/txt/src/txt/placeholder_run.h
FILE: ../../../flutter/third_party/txt/src/txt/run_metrics.h
FILE: ../../../flutter/third_party/txt/src/txt/styled_runs.cc
FILE: ../../../flutter/third_party/txt/src/txt/styled_runs.h
FILE: ../../../flutter/third_party/txt/src/txt/test_font_manager.cc
......
......@@ -87,7 +87,6 @@ source_set("txt") {
"src/txt/font_skia.h",
"src/txt/font_style.h",
"src/txt/font_weight.h",
"src/txt/line_metrics.h",
"src/txt/paint_record.cc",
"src/txt/paint_record.h",
"src/txt/paragraph.h",
......@@ -102,7 +101,6 @@ source_set("txt") {
"src/txt/placeholder_run.cc",
"src/txt/placeholder_run.h",
"src/txt/platform.h",
"src/txt/run_metrics.h",
"src/txt/styled_runs.cc",
"src/txt/styled_runs.h",
"src/txt/test_font_manager.cc",
......
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIB_TXT_SRC_LINE_METRICS_H_
#define LIB_TXT_SRC_LINE_METRICS_H_
#include <map>
#include <vector>
#include "run_metrics.h"
namespace txt {
class LineMetrics {
public:
// The following fields are used in the layout process itself.
// The indexes in the text buffer the line begins and ends.
size_t start_index = 0;
size_t end_index = 0;
size_t end_excluding_whitespace = 0;
size_t end_including_newline = 0;
bool hard_break = false;
// The following fields are tracked after or during layout to provide to
// the user as well as for computing bounding boxes.
// The final computed ascent and descent for the line. This can be impacted by
// the strut, height, scaling, as well as outlying runs that are very tall.
//
// The top edge is `baseline - ascent` and the bottom edge is `baseline +
// descent`. Ascent and descent are provided as positive numbers. Raw numbers
// for specific runs of text can be obtained in run_metrics_map. These values
// are the cumulative metrics for the entire line.
double ascent = 0.0;
double descent = 0.0;
double unscaled_ascent = 0.0;
// Height of the line.
double height = 0.0;
// Width of the line.
double width = 0.0;
// The left edge of the line. The right edge can be obtained with `left +
// width`
double left = 0.0;
// The y position of the baseline for this line from the top of the paragraph.
double baseline = 0.0;
// Zero indexed line number.
size_t line_number = 0;
// Mapping between text index ranges and the FontMetrics associated with
// them. The first run will be keyed under start_index. The metrics here
// are before layout and are the base values we calculate from.
std::map<size_t, RunMetrics> run_metrics;
LineMetrics();
LineMetrics(size_t start,
size_t end,
size_t end_excluding_whitespace,
size_t end_including_newline,
bool hard_break)
: start_index(start),
end_index(end),
end_excluding_whitespace(end_excluding_whitespace),
end_including_newline(end_including_newline),
hard_break(hard_break) {}
};
} // namespace txt
#endif // LIB_TXT_SRC_LINE_METRICS_H_
/*
* Copyright 2017 Google Inc.
*
......@@ -18,7 +17,6 @@
#ifndef LIB_TXT_SRC_PARAGRAPH_H_
#define LIB_TXT_SRC_PARAGRAPH_H_
#include "line_metrics.h"
#include "paragraph_style.h"
class SkCanvas;
......@@ -173,8 +171,6 @@ class Paragraph {
// Finds the first and last glyphs that define a word containing the glyph at
// index offset.
virtual Range<size_t> GetWordBoundary(size_t offset) = 0;
virtual std::vector<LineMetrics>& GetLineMetrics() = 0;
};
} // namespace txt
......
......@@ -24,13 +24,11 @@
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "font_collection.h"
#include "line_metrics.h"
#include "minikin/LineBreaker.h"
#include "paint_record.h"
#include "paragraph.h"
#include "paragraph_style.h"
#include "placeholder_run.h"
#include "run_metrics.h"
#include "styled_runs.h"
#include "third_party/googletest/googletest/include/gtest/gtest_prod.h" // nogncheck
#include "third_party/skia/include/core/SkFontMetrics.h"
......@@ -115,10 +113,6 @@ class ParagraphTxt : public Paragraph {
bool DidExceedMaxLines() override;
// Gets the full vector of LineMetrics which includes detailed data on each
// line in the final layout.
std::vector<LineMetrics>& GetLineMetrics() override;
// Sets the needs_layout_ to dirty. When Layout() is called, a new Layout will
// be performed when this is set to true. Can also be used to prevent a new
// Layout from being calculated by setting to false.
......@@ -178,13 +172,26 @@ class ParagraphTxt : public Paragraph {
minikin::LineBreaker breaker_;
mutable std::unique_ptr<icu::BreakIterator> word_breaker_;
std::vector<LineMetrics> line_metrics_;
size_t final_line_count_;
struct LineRange {
LineRange(size_t s, size_t e, size_t eew, size_t ein, bool h)
: start(s),
end(e),
end_excluding_whitespace(eew),
end_including_newline(ein),
hard_break(h) {}
size_t start, end;
size_t end_excluding_whitespace;
size_t end_including_newline;
bool hard_break;
};
std::vector<LineRange> line_ranges_;
std::vector<double> line_widths_;
// Stores the result of Layout().
std::vector<PaintRecord> records_;
std::vector<double> line_heights_;
std::vector<double> line_baselines_;
bool did_exceed_max_lines_;
// Strut metrics of zero will have no effect on the layout.
......@@ -199,6 +206,11 @@ class ParagraphTxt : public Paragraph {
StrutMetrics strut_;
// Metrics for use in GetRectsForRange(...);
// Per-line max metrics over all runs in a given line.
std::vector<SkScalar> line_max_spacings_;
std::vector<SkScalar> line_max_descent_;
std::vector<SkScalar> line_max_ascent_;
// Overall left and right extremes over all lines.
double max_right_;
double min_left_;
......@@ -281,7 +293,6 @@ class ParagraphTxt : public Paragraph {
Range<double> x_pos;
size_t line_number;
SkFontMetrics font_metrics;
const TextStyle* style;
TextDirection direction;
const PlaceholderRun* placeholder_run;
......@@ -290,7 +301,6 @@ class ParagraphTxt : public Paragraph {
Range<double> x,
size_t line,
const SkFontMetrics& metrics,
const TextStyle& st,
TextDirection dir,
const PlaceholderRun* placeholder);
......
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIB_TXT_SRC_RUN_METRICS_H_
#define LIB_TXT_SRC_RUN_METRICS_H_
#include "text_style.h"
#include "third_party/skia/include/core/SkFontMetrics.h"
namespace txt {
// Contains the font metrics and TextStyle of a unique run.
class RunMetrics {
public:
RunMetrics(const TextStyle* style) : text_style_(style) {}
RunMetrics(const TextStyle* style, SkFontMetrics& metrics)
: text_style_(style), font_metrics_(metrics) {}
SkFontMetrics& GetFontMetrics() { return font_metrics_; }
const TextStyle& GetTextStyle() const { return *text_style_; }
private:
const TextStyle* text_style_;
// SkFontMetrics contains the following metrics:
//
// * Top distance to reserve above baseline
// * Ascent distance to reserve below baseline
// * Descent extent below baseline
// * Bottom extent below baseline
// * Leading distance to add between lines
// * AvgCharWidth average character width
// * MaxCharWidth maximum character width
// * XMin minimum x
// * XMax maximum x
// * XHeight height of lower-case 'x'
// * CapHeight height of an upper-case letter
// * UnderlineThickness underline thickness
// * UnderlinePosition underline position relative to baseline
// * StrikeoutThickness strikeout thickness
// * StrikeoutPosition strikeout position relative to baseline
SkFontMetrics font_metrics_;
};
} // namespace txt
#endif // LIB_TXT_SRC_RUN_METRICS_H_
......@@ -34,349 +34,6 @@ namespace txt {
using ParagraphTest = RenderTest;
TEST_F(ParagraphTest, LineMetricsParagraph1) {
const char* text = "Hello! What is going on?\nSecond line \nthirdline";
auto icu_text = icu::UnicodeString::fromUTF8(text);
std::u16string u16_text(icu_text.getBuffer(),
icu_text.getBuffer() + icu_text.length());
txt::ParagraphStyle paragraph_style;
txt::ParagraphBuilderTxt builder(paragraph_style, GetTestFontCollection());
txt::TextStyle text_style;
// We must supply a font here, as the default is Arial, and we do not
// include Arial in our test fonts as it is proprietary. We want it to
// be Arial default though as it is one of the most common fonts on host
// platforms. On real devices/apps, Arial should be able to be resolved.
text_style.font_families = std::vector<std::string>(1, "Roboto");
text_style.color = SK_ColorBLACK;
builder.PushStyle(text_style);
builder.AddText(u16_text);
builder.Pop();
auto paragraph = BuildParagraph(builder);
paragraph->Layout(GetTestCanvasWidth());
paragraph->Paint(GetCanvas(), 0, 0);
ASSERT_TRUE(Snapshot());
ASSERT_EQ(paragraph->GetLineMetrics().size(), 3ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].start_index, 0ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_index, 24ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_including_newline, 25ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_excluding_whitespace, 24ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].hard_break, true);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].ascent, 12.988281);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].descent, 3.4179688);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].width, 149.67578);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].left, 0.0);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].baseline, 12.582031);
ASSERT_EQ(paragraph->GetLineMetrics()[0].line_number, 0ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].run_metrics.size(), 1ull);
ASSERT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetTextStyle()
.color,
SK_ColorBLACK);
ASSERT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetTextStyle()
.font_families,
std::vector<std::string>(1, "Roboto"));
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fAscent,
-12.988281);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fDescent,
3.4179688);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fXHeight,
7.3964844);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fLeading,
0);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fTop,
-14.786133);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[0].start_index)
->second.GetFontMetrics()
.fUnderlinePosition,
1.0253906);
ASSERT_EQ(paragraph->GetLineMetrics()[1].start_index, 25ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_index, 37ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_including_newline, 38ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_excluding_whitespace, 36ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].hard_break, true);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].ascent, 12.988281);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].descent, 3.4179688);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].width, 72.039062);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].left, 0.0);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].baseline, 28.582031);
ASSERT_EQ(paragraph->GetLineMetrics()[1].line_number, 1ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].run_metrics.size(), 1ull);
ASSERT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetTextStyle()
.color,
SK_ColorBLACK);
ASSERT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetTextStyle()
.font_families,
std::vector<std::string>(1, "Roboto"));
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fAscent,
-12.988281);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fDescent,
3.4179688);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fXHeight,
7.3964844);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fLeading,
0);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fTop,
-14.786133);
ASSERT_FLOAT_EQ(
paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(paragraph->GetLineMetrics()[1].start_index)
->second.GetFontMetrics()
.fUnderlinePosition,
1.0253906);
}
TEST_F(ParagraphTest, LineMetricsParagraph2) {
const char* text = "test string alphabetic";
auto icu_text = icu::UnicodeString::fromUTF8(text);
std::u16string alphabetic(icu_text.getBuffer(),
icu_text.getBuffer() + icu_text.length());
const char* text2 = "测试中文日本語한국어";
auto icu_text2 = icu::UnicodeString::fromUTF8(text2);
std::u16string cjk(icu_text2.getBuffer(),
icu_text2.getBuffer() + icu_text2.length());
txt::ParagraphStyle paragraph_style;
txt::ParagraphBuilderTxt builder(paragraph_style, GetTestFontCollection());
txt::TextStyle text_style;
text_style.font_families = std::vector<std::string>(1, "Roboto");
text_style.font_families.push_back("Noto Sans CJK JP");
text_style.font_size = 27;
text_style.color = SK_ColorBLACK;
builder.PushStyle(text_style);
builder.AddText(alphabetic);
text_style.font_size = 24;
builder.PushStyle(text_style);
builder.AddText(cjk);
builder.Pop();
auto paragraph = BuildParagraph(builder);
paragraph->Layout(350);
paragraph->Paint(GetCanvas(), 0, 0);
ASSERT_TRUE(Snapshot());
ASSERT_EQ(paragraph->GetLineMetrics().size(), 2ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].start_index, 0ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_index, 26ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_including_newline, 26ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].end_excluding_whitespace, 26ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].hard_break, false);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].ascent, 27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].descent, 7.6799998);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].width, 349.22266);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].left, 0.0);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0].baseline, 28.32);
ASSERT_EQ(paragraph->GetLineMetrics()[0].line_number, 0ull);
ASSERT_EQ(paragraph->GetLineMetrics()[0].run_metrics.size(), 2ull);
// First run
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(2)
->second.GetTextStyle()
.font_size,
27);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(2)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(2)
->second.GetFontMetrics()
.fAscent,
-25.048828);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(2)
->second.GetFontMetrics()
.fDescent,
6.5917969);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(21)
->second.GetTextStyle()
.font_size,
27);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(21)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(21)
->second.GetFontMetrics()
.fAscent,
-25.048828);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(21)
->second.GetFontMetrics()
.fDescent,
6.5917969);
// Second run
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(22)
->second.GetTextStyle()
.font_size,
24);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(22)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(22)
->second.GetFontMetrics()
.fAscent,
-27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(22)
->second.GetFontMetrics()
.fDescent,
7.6799998);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(24)
->second.GetTextStyle()
.font_size,
24);
ASSERT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(24)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(24)
->second.GetFontMetrics()
.fAscent,
-27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[0]
.run_metrics.lower_bound(24)
->second.GetFontMetrics()
.fDescent,
7.6799998);
ASSERT_EQ(paragraph->GetLineMetrics()[1].start_index, 26ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_index, 32ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_including_newline, 32ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].end_excluding_whitespace, 32ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].hard_break, true);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].ascent, 27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].descent, 7.6799998);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].width, 138.23438);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].left, 0.0);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1].baseline, 64.32);
ASSERT_EQ(paragraph->GetLineMetrics()[1].line_number, 1ull);
ASSERT_EQ(paragraph->GetLineMetrics()[1].run_metrics.size(), 1ull);
// Indexing below the line will just resolve to the first run in the line.
ASSERT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(3)
->second.GetTextStyle()
.font_size,
24);
ASSERT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(3)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(3)
->second.GetFontMetrics()
.fAscent,
-27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(3)
->second.GetFontMetrics()
.fDescent,
7.6799998);
// Indexing within the line
ASSERT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(31)
->second.GetTextStyle()
.font_size,
24);
ASSERT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(31)
->second.GetTextStyle()
.font_families,
text_style.font_families);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(31)
->second.GetFontMetrics()
.fAscent,
-27.84);
ASSERT_FLOAT_EQ(paragraph->GetLineMetrics()[1]
.run_metrics.lower_bound(31)
->second.GetFontMetrics()
.fDescent,
7.6799998);
}
TEST_F(ParagraphTest, SimpleParagraph) {
const char* text = "Hello World Text Dialog";
auto icu_text = icu::UnicodeString::fromUTF8(text);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册