-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
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
TextBlob error when I want to control the horizontal spacing of fonts #200
Comments
You need to count characters (2), not bytes (6). Also, this kind of question is not related to skia-python. Use stackoverflow or just search on Google |
Right, this could be a bug in skia-python. The following size check does not correctly consider character encoding for non-ascii characters. skia-python/src/skia/TextBlob.cpp Line 84 in f71fdee
|
Hmm, every len check in that file is wrong. It is not friendly, but skia returns null when it fails so there is really no need for the check before passing to skia. |
There is another one of the same. #153 |
Skia itself counts and valid input https://github.com/google/skia/blob/cc4f9b3469b92c6fcf87a5f151f9441da6652086/src/core/SkTextBlob.cpp#L793 and returns null if the input cannot be parsed. Why are checks scattered all over the place? It is just unnecessary code... |
Fixed in b79ef6a . Build from source or wait for 117b3.
|
@HinTak Thanks! |
I want to control the horizontal spacing of fonts , and I do not find corresponding control parameters. I find TextBlob that can input position list , however,it occurs error when I test with Chinese characters.
blob = skia.TextBlob("一二", font, [(0, 0), (40.5, 0)])
ValueError: len(text) = 6 does not match len(pos) = 2
What should I do? Looking forward to your reply!
The text was updated successfully, but these errors were encountered: