sktextblob problem about special width

Skip to first unread message

Xinhua Chen

Apr 18, 2022, 10:37:11 AMApr 18
to skia-discuss
Dear everyone:
i use skshaper to make special width textblob to display the text. i found when input a continuous string without space,the width can not work in the macos, all the characters is in one line. but in the win 10 it can work,when some characters reach the width,newline can be doen . why it causes . i want to get limited width effect in the to do it. Any idea about this is welcome .Thanks for your help.Give my best regards to you.

main function creating textBlob is below.

sk_sp<SkTextBlob> CreateSkTextBlob(const std::string& content,  const FontData& font, double maxWidth, Alignment type) {
    std::unique_ptr<SkShaper> fShaper;
    fShaper = SkShaper::Make();
    const char* utf8 = content.c_str();
    size_t utf8Bytes = content.size();
    SkTextBlobBuilderRunHandler builder(utf8, {0, 0});
    fShaper->shape(utf8, utf8Bytes, get_skia_Font(), true, maxWidth, &builder);
    return builder.makeBlob();

Reply all
Reply to author
0 new messages