Placeholder at the end of the text right before \n.
Bug: skia:10838
Change-Id: I0f6ebe442d67ba4c91cbef4fcaec6dea02739d34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327339
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
diff --git a/modules/skparagraph/samples/SampleParagraph.cpp b/modules/skparagraph/samples/SampleParagraph.cpp
index 7886f1c..f583983 100644
--- a/modules/skparagraph/samples/SampleParagraph.cpp
+++ b/modules/skparagraph/samples/SampleParagraph.cpp
@@ -3056,6 +3056,40 @@
using INHERITED = Sample;
};
+class ParagraphView49 : public ParagraphView_Base {
+protected:
+ SkString name() override { return SkString("Paragraph49"); }
+
+ void onDrawContent(SkCanvas* canvas) override {
+ canvas->clear(SK_ColorGRAY);
+ auto fontCollection = getFontCollection();
+ fontCollection->disableFontFallback();
+ const char* text = "AAAAAAAAA\n";
+
+ ParagraphStyle paragraph_style;
+ TextStyle text_style;
+ text_style.setColor(SK_ColorBLACK);
+ text_style.setFontFamilies({SkString("Roboto"), SkString("Noto Serif CJK JP")});
+ text_style.setFontSize(16);
+ ParagraphBuilderImpl builder(paragraph_style, fontCollection);
+ builder.pushStyle(text_style);
+ builder.addText(text);
+ PlaceholderStyle placeholder_style;
+ placeholder_style.fHeight = 42;
+ placeholder_style.fWidth = 45;
+ placeholder_style.fBaselineOffset = 42;
+ placeholder_style.fBaseline = TextBaseline::kAlphabetic;
+ placeholder_style.fAlignment = PlaceholderAlignment::kBottom;
+ builder.addPlaceholder(placeholder_style);
+ auto paragraph = builder.Build();
+ paragraph->layout(360);
+ paragraph->paint(canvas, 0, 0);
+ }
+
+private:
+ using INHERITED = Sample;
+};
+
} // namespace
//////////////////////////////////////////////////////////////////////////////
@@ -3105,3 +3139,4 @@
DEF_SAMPLE(return new ParagraphView46();)
DEF_SAMPLE(return new ParagraphView47();)
DEF_SAMPLE(return new ParagraphView48();)
+DEF_SAMPLE(return new ParagraphView49();)