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

Commit c710a98

Browse files
Integrate more SkParagraph builder patches (#13094)
* ParagraphBuilderSkia::AddPlaceholder implementation * StrutStyle height override
1 parent e3b5d8e commit c710a98

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

third_party/txt/src/skia/paragraph_builder_skia.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ skt::ParagraphStyle TxtToSkia(const ParagraphStyle& txt) {
5858
MakeSkFontStyle(txt.strut_font_weight, txt.strut_font_style));
5959
strut_style.setFontSize(SkDoubleToScalar(txt.strut_font_size));
6060
strut_style.setHeight(SkDoubleToScalar(txt.strut_height));
61+
strut_style.setHeightOverride(txt.strut_has_height_override);
6162

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

156157
void ParagraphBuilderSkia::AddPlaceholder(PlaceholderRun& span) {
157-
assert(false);
158+
skt::PlaceholderStyle placeholder_style;
159+
placeholder_style.fHeight = span.height;
160+
placeholder_style.fWidth = span.width;
161+
placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
162+
placeholder_style.fBaselineOffset = span.baseline_offset;
163+
placeholder_style.fAlignment =
164+
static_cast<skt::PlaceholderAlignment>(span.alignment);
165+
166+
builder_->addPlaceholder(placeholder_style);
158167
}
159168

160169
std::unique_ptr<Paragraph> ParagraphBuilderSkia::Build() {

0 commit comments

Comments
 (0)