-
Notifications
You must be signed in to change notification settings - Fork 269
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
Mixed scripts with text shaping failure #902
Comments
I'd like to have a go for this issue |
Awesome! Take a look on our development guidelines and feel free to reach out if you have any question. |
I just tried out this code. Few things I noticed:
I think i should try looking at the code flow when pdf.write() happens, and how it ends up at shaped_text_width() call. |
Looking at the code, the problem boils down to automatic_break_possible() evaluating to true and the line evalues to empty line - characters=[] But in the case when the print() is starting from new line (if i insert a pdf.ln() the code passes through); the line evaluates to something like - characters=[' ', 'इ', 'ण', '्', 'ट', 'र', 'न', 'े', 'ट'] ; as it goes via this code So i think the issue is with it taking a line with no characters, causing styled_txt_width to evaluate to 0 and thereby throw this exception |
I guess the empty fragment is the problem. There is only character that doesnt exist in the font so there is nothing to render. |
My current train of thought is to update add_character(), where if character == SPACE and this is the first space, then im adding a another space into the frag (so that its not empty) before it saves the state into SpaceHint(). I tried this out and it does seem to work (render things), do you think this is an acceptable approach? |
Error details
When trying to use text shaping with text regions combining different scripts, I tripped over one combination that throws an error.
Minimal code
This code executes in the context of "test_text_shaping.py":
The result is this:
Note the space character in front of the devanagari text. Without that, it runs through.
The text was updated successfully, but these errors were encountered: