Skip to content

Commit

Permalink
Integrate more SkParagraph builder patches (flutter#13094)
Browse files Browse the repository at this point in the history
* ParagraphBuilderSkia::AddPlaceholder implementation
* StrutStyle height override
  • Loading branch information
jason-simmons authored Oct 14, 2019
1 parent e3b5d8e commit c710a98
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion third_party/txt/src/skia/paragraph_builder_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ skt::ParagraphStyle TxtToSkia(const ParagraphStyle& txt) {
MakeSkFontStyle(txt.strut_font_weight, txt.strut_font_style));
strut_style.setFontSize(SkDoubleToScalar(txt.strut_font_size));
strut_style.setHeight(SkDoubleToScalar(txt.strut_height));
strut_style.setHeightOverride(txt.strut_has_height_override);

std::vector<SkString> strut_fonts;
std::transform(txt.strut_font_families.begin(), txt.strut_font_families.end(),
Expand Down Expand Up @@ -154,7 +155,15 @@ void ParagraphBuilderSkia::AddText(const std::u16string& text) {
}

void ParagraphBuilderSkia::AddPlaceholder(PlaceholderRun& span) {
assert(false);
skt::PlaceholderStyle placeholder_style;
placeholder_style.fHeight = span.height;
placeholder_style.fWidth = span.width;
placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
placeholder_style.fBaselineOffset = span.baseline_offset;
placeholder_style.fAlignment =
static_cast<skt::PlaceholderAlignment>(span.alignment);

builder_->addPlaceholder(placeholder_style);
}

std::unique_ptr<Paragraph> ParagraphBuilderSkia::Build() {
Expand Down

0 comments on commit c710a98

Please sign in to comment.