Insert_text may add or delete original spaces after a word/character when writing word by word, any solution? #4630
Replies: 5 comments 1 reply
-
We cannot deal with this without an example. Also not an issue but a Discussions post. |
Beta Was this translation helpful? Give feedback.
-
See below effect and sample pdf. ![]() |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
font_path = r'F:\fonts\Arial Unicode MS.ttf' # 下载字体文件simhei.ttf page.insert_text((rect.x0, rect.y0 + fontsize), text, fontsize=fontsize_fit, fontname="F0", insert_text((228.75428571428571, 851.0742857142857), text='信', fontsize=20.4, fontname='F0', overlay=False, color=(0.0, 0.0, 0.0), stroke_opacity=1, fill_opacity=1, morph=(fitz.Point(228.75428571428571, 830.6742857142857), Matrix(1.0, 0.0, 0.0, 1.3109243697478987, 0.0, 0.0))) |
Beta Was this translation helpful? Give feedback.
-
fontsize*0.85 copied text as below, many additional spaces尔 兰和挪威都是小 国, oth Ireland and Norway are small 爱地 处欧 洲 的 边陲。 十二 Bcountries on the fringes of Europe.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description of the bug
Sometimes, apply font_fit according to line image height, then apply a transform_matrix,
Insert_text may add or delete original spaces after a word/character when writing word by word, any solution?
Spaces are appended to end of word as text before writing.
For example, if font is reduced to 0.8font fit, there may be additional spaces when copied from written pdf result.
If font is 0.95font_fit or 1.0*font fit, some spaces may be missing when copied from written pdf result.
How to reproduce the bug
See above
PyMuPDF version
1.26.3
Operating system
Windows
Python version
3.9
Beta Was this translation helpful? Give feedback.
All reactions