We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当我想替换lottie的文字的时候,如果shape中没有对应的字符,就不绘制这个字符了,这回引起极大的困扰,建议应该做一个保底方案,找不到对应字符的shape时,就通过默认字体绘制,只需要改一处简单的代码就行。 这是源代码: if (fontManager.chars) { charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily); cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100; } else { // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize); // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily; cLength = fontManager.measureText(val, documentData.f, documentData.finalSize); } // 希望可以对getCharData的返回值做一个判断,如果找不到,就执行下方的else中的代码。 辛苦大佬们google翻译一下看看吧哈哈哈哈,感谢!
if (fontManager.chars) { charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily); cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100; } else { // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize); // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily; cLength = fontManager.measureText(val, documentData.f, documentData.finalSize); } //
PS: 我现在用了一个方法规避,就是拿到lootie的json后,删除chars这个数组,如此,就会全部走入else的默认字体绘制了。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当我想替换lottie的文字的时候,如果shape中没有对应的字符,就不绘制这个字符了,这回引起极大的困扰,建议应该做一个保底方案,找不到对应字符的shape时,就通过默认字体绘制,只需要改一处简单的代码就行。
这是源代码:
if (fontManager.chars) { charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily); cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100; } else { // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize); // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily; cLength = fontManager.measureText(val, documentData.f, documentData.finalSize); } //
希望可以对getCharData的返回值做一个判断,如果找不到,就执行下方的else中的代码。
辛苦大佬们google翻译一下看看吧哈哈哈哈,感谢!
PS:
我现在用了一个方法规避,就是拿到lootie的json后,删除chars这个数组,如此,就会全部走入else的默认字体绘制了。
The text was updated successfully, but these errors were encountered: