Skip to content

font.getsize() changes after installing libraqm #4483

@seasker

Description

@seasker

I am using PIL to render text on images with position annotation. The text size changes after installing libraqm.

from PIL import Image, ImageFont, ImageDraw
font=ImageFont.truetype('Microsoft/msyhl.ttc',size=14,layout_engine=ImageFont.LAYOUT_RAQM)
print(font.getsize('a'))  
print(font.getsize('b'))  
print(font.getsize('c'))  
print(font.getsize('abc'))  

Result without libraqm

(7, 16)
(8, 16)
(7, 16)
(22, 16)

The sum of character's width 7+8+7=22 is correct.
Result after installing libraqm

(8, 16)
(9, 16)
(7, 16)
(23, 16)

The sum of character's width 8+9+7=24 doesn't equal to 23.
Also I find that the text size changes differently on different font after installing libraqm.
Why are these happening after installing libraqm?

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