Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite glyphs are not displayed correctly in the Khmer language #2900

Open
Marius666 opened this issue May 28, 2022 · 3 comments
Open

Composite glyphs are not displayed correctly in the Khmer language #2900

Marius666 opened this issue May 28, 2022 · 3 comments

Comments

@Marius666
Copy link

Hi,

I am trying to write បា in pdf (which is made of ប and ា) but I am getting two separate symbols near each other instead.

What I am getting:
incorrect-with-dompdf.pdf
image

How it should be:
correct-in-word.pdf
image

The font I am using: Battambang (https://fonts.google.com/specimen/Battambang?preview.text=%E1%9E%94%E1%9E%B6&preview.text_type=custom)

HTML: https://pastebin.com/JDfTbsGD
PHP: https://pastebin.com/WEh1MUVX

I've also tried to run with isFontSubsettingEnabled => false

Dompdf versions tried: 1.0.2, 1.2.2
php-font-lib: 0.5.2 and 0.5.4

PHP versions I've tried: 8.0, 8.1

Tried on Windows and ubuntu. Both had fonts installed in the system. Also, I've run it with load_font.php.

The same happens with other fonts like anlongvill-khek, Hanuman, KhmerOT.

It seems like the font itself is being embedded, the issue appears only with composite glyphs. Singular characters are displayed correctly.

@bsweeney
Copy link
Member

Without doing more research this sounds like an issues related to complex text layout, which Dompdf does not currently support (#2619). Current option for correct handling is to pre-process your text so that the glyph combination is already performed prior to rendering.

@Lospepes
Copy link

Lospepes commented Apr 4, 2023

Hello,

I'm having an issue with the Khmer language too.

DOMPDF version used : 0.6.0 beta 3 and 2.0.3
PHP version : 7.3

In HTML and word :
image

In PDF :
image

The glyphs do not match and some of them have a + below the character.

I was wondering if you could explainto me how to preprocess my texts in Khmer and try to solve this problem.

I tried about twenty fonts including the one from GoogleFont.

Maybe php-font-lib is not working? I tried to add versions 0.5.1 and 0.5.4 to the project. And I have exactly the same result without it.

Thank you in advance for your help

@bsweeney
Copy link
Member

bsweeney commented Apr 4, 2023

I'm not familiar enough with Khmer to say for certain how to address the issue. The issue is not really with php-font-lib (unless the font itself is unable to be processed). The poor display is likely due to multiple issues: insufficient subsetting logic, and lack of shaping support.

If shaping were performed prior to rendering by Dompdf the PDF would render as expected because the embedded characters would already be joined as required. Unfortunately, I do not know of a tool that can perform the necessary shaping.

You can try disabling font subsetting to see if that's enough to get you where you need, but I do not believe that to be the case.

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

No branches or pull requests

3 participants