Skip to content

Incorrect Font style and Size #4232

Closed
Closed
@davidcbhunter

Description

@davidcbhunter

Description of the bug

PyMuPDF incorrectly inserts text when the fontsize and fontname are not explictly passed to the insert_text function.

How to reproduce the bug

` font_size = 35
font_name = "helvetica-bold"

#this is fine
text = "some random text"

point = pymupdf.Point(
page.rect.width / 2 - (pymupdf.get_text_length(text , font_name,font_size) / 2), 100)
page.insert_text(point, text , fontsize = font_size, fontname = font_name)

#this uses a slightly different font and size, despite giving the function the arguments in the expected order
point = pymupdf.Point(
page.rect.width / 2 - (pymupdf.get_text_length(text, font_name,font_size) / 2), 150)
page.insert_text(point, text , font_size, font_name)`

PyMuPDF version

1.25.1

Operating system

Windows

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions