Skip to content
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

[Bug]-add_text: Some characters will be hidden if using Simplified Chinese, but it is normal to use Traditional Chinese #5

Open
wenbopeng opened this issue Feb 11, 2023 · 6 comments

Comments

@wenbopeng
Copy link

If you use Simplified Chinese, some characters will be hidden(fig1), but it is normal to use Traditional Chinese(fig2)

image

image

@ahrm
Copy link
Owner

ahrm commented Feb 18, 2023

I am not familiar enough with Chinese to know what the problem is exactly, but I assume the issue is with add_freetext_annot which is a pymupdf function. I can't really fix that.

@wenbopeng
Copy link
Author

Ok, wish add_text to be able to automatically wrap

@ahrm
Copy link
Owner

ahrm commented Feb 19, 2023

It can (at least for english text), again, it is not something that I imlemented. It is part of add_freetext_annot.

@wenbopeng
Copy link
Author

I upgraded Windows and solved the problem. I suspected it was a font issue. Now everything is perfect. Thank you. I will close this issue.

@wenbopeng
Copy link
Author

It can (at least for english text), again, it is not something that I imlemented. It is part of .add_freetext_annot

PyMuPDF-Utilities/freetext-annot-lang.py at master · pymupdf/PyMuPDF-Utilities, 2023-03-07 11:34

Might be helpful to fix fonts and text wrap in different languages

@wenbopeng
Copy link
Author

It can (at least for english text), again, it is not something that I imlemented. It is part of add_freetext_annot.

Here are the commands for the sioyek add-text extension:

new_command _add_red_text python -m sioyek.add_text "%{sioyek_path}" "%{local_database}" "%{shared_database}" "%{file_path}" "%{selected_rect}" "%{command_text}" fontsize=12 text_color=255,0,0

This is the add_freetext_annot function that sets the font , see Page - PyMuPDF 1.22.3 documentation :

add_freetext_annot(rect, text, fontsize=12, fontname='helv', border_color=None, text_color=0, fill_color=1, rotate=0, align=TEXT_ALIGN_LEFT)

Can you refer to this function and add a fontname command for the add-text extension? It supports Chinese, see Does it support inserting Chinese text? · Issue #329 · pymupdf/PyMuPDF

@wenbopeng wenbopeng reopened this May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants