0

I compiled skia for macosx using cmake. Everything works except SkParagraph. Can render using canvas->drawString. Compiles and runs fine but does not wrap or show any text. Am I missing something while compiling skia?

This is what I tried,

 ParagraphStyle paraStyle;
 paraStyle.setTextAlign(skia::textlayout::TextAlign::kLeft);
 auto builder =
 ParagraphBuilderImpl::make(paraStyle, sk_make_sp<FontCollection>());

 builder->pushStyle(style);
 std::string text = "Hello";
 builder->addText(text.c_str(), text.length());
 builder->pop();

 // canvas->drawString("Hello", 20, 20, SkFont(), SkPaint());

 auto para = builder->Build();
 para.get()->layout(27);
 para.get()->paint(canvas, 300, 300);
ratj
  • 86
  • 1
  • 6

1 Answers1

1

As suggested here, try setting default font manager:

fontCollection->setDefaultFontManager(SkFontMgr::RefDefault());

Also check if you have set:

  • Color
  • Font style.setFontFamilies({SkString("Roboto")});
  • Width is enough
Niki Tonsky
  • 1,327
  • 11
  • 19