insert_text and overlapping text! . #3521
-
Hello, I have a problem here:
Also I noticed that output when I print(text_instances): |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Several things may go wrong with this approach:
To exactly fill the original rectangle, use the def adjust_matrix(font, bbox, text, fontsize):
"""Compute matrix performing a horizontal scale.
Args:
font: Font object
bbox: bbox of the text to fill
text: text
fontsize: fontsize to use
Returns:
Horizontal scaling matrix
"""
tl = font.text_length(text, fontsize=fontsize)
width = bbox[2] - bbox[0]
scale = width / tl
return fitz.Matrix(scale, 1) As parameter |
Beta Was this translation helpful? Give feedback.
-
@JorjMcKie I have last question. there is any method or approach can handle this case: |
Beta Was this translation helpful? Give feedback.
Several things may go wrong with this approach:
To exactly fill the original rectangle, use the
morph
parameter with a scaling matrix (fixpoint is the origin of course). The matrix should look like…