I am getting countGlyphs = 0 and drawSimpleText() is not drawing any thing.

Skip to first unread message

javaid ahmad Wani

Jun 15, 2022, 10:39:52 AM (13 days ago) Jun 15
to skia-discuss

I am using Skia c++ api  to draw test on android system  using function "
  drawSimpleText( text, strlen(text), SkTextEncoding::kUTF8, SkIntToScalar(x), SkIntToScalar(y), font, paint); "
 but it is not drawing anything on the screen, then i checked  countGlyphs   using  below code, i am getting  countGlyphs  Zero  


SkTypeface *typeface;
SkFont font;
typeface = font.getTypefaceOrDefault();

printf("typeface->countGlyphs = %d", typeface->countGlyphs()

On Fiddle same code is working 

Ben Wagner

Jun 15, 2022, 12:49:41 PM (13 days ago) Jun 15
to skia-d...@googlegroups.com
This implies that font.getTypefaceOrDefault(); is returning the
fallback empty SkTypeface (which has no glyphs and draws nothing).
Your build of Skia needs to contain some means of creating SkTypefaces
from data (generally by building the proper SkFontMgr implementations
and using them). In general SkFont::getTypefaceOrDefault and
SkCanvas::drawSimpleText are both "toy" APIs. They are interesting to
get something working quickly, but should not be used in any serious
application. It is best to avoid use of a default SkFontMgr and
drawSimpleText does no text shaping (only works as expected with
simple fonts without any shaping information and does no font
> --
> You received this message because you are subscribed to the Google Groups "skia-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/ec3dcd94-b613-46c8-b99a-3669770a6544n%40googlegroups.com.
Reply all
Reply to author
Message has been deleted
0 new messages