Skip to content

Unable to disable font ligatures in insert_htmlbox method #4981

Description

@kishaningithub

Description of the bug

I would like to disable font ligatures when creating a page using insert_htmlbox method.

I tried creating the following css to disable the same but it had no effect

 body {
   font-family:  'Calibri';
   font-size: 12pt;
   font-feature-settings: "liga" 0, "calt" 0 !important;
   font-variant-ligatures: none !important;
 }

Image

If you notice the image below in the word "Introduction" the letters "ti" as compressed into one

Image

Impact

  • If a user tries to copy the word from the PDF and pastes it into another app it becomes "Introducon" (Notice that the characters "ti" are dropped here.
  • This also affecting the search_for() function, when i pass "Introduction" as the parameter i.e. page.search_for("Introduction") it is unable to find the same

How to reproduce the bug

  • Create a pdf using insert_htmlbox method with Calibri font with content as "Introduction"

PyMuPDF version

1.27.2.3

Operating system

MacOS

Python version

3.14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

not a bugnot a bug / user error / unable to reproducewontfixno intention to resolve

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions