Hi team,
I'm trying to render Strike through for text using SkParagraph
But it seems it is not drawing exactly at center like Notes in mac
I checked for different fonts but still it is not drawing center for most of them.
Is it default behaviour of Skia or can we change it?
I checked for "Roboto", "Droid Sans", "Open Sans", "Archivo" and "DejaVu Sans" fonts
as you can see Strike Though position is not exactly at center
I have tried like
TextStyle textStyle;
textStyle.setFontSize(10);
textStyle.setFontFamily({SkString("Roboto")});
textStyle.setTextDecoration(TextDecoration::kLineThrough);
ParagraphStyle paraStyle;
paraStyle.setTextAlign(TextAlign::kLeft);
paraStyle.setMaxLines(1);
sk_sp<FontCollection> fontCollection = sk_make_sp<FontCollection>();
fontCollection->setDefaultFontManager(SkFontMgr::RefDefault());
auto builder = ParagraphBuilder::make(paraStyle, fontCollection);
builder->pushStyle(textStyle);
builder->addText("Some Strike through text");
builder->pop();
std::shared_ptr<Paragraph> paragraph = builder->Build();
paragraph->layout(1000);
paragraph.get()->paint(canvas, contentRect.left(), contentRect.top());
Is there any better way to draw strike through using SkParagraph?
Thank you,
Hemanth.