Khmer text not being shown properly on Qt6

I’m on an Apple M3 MacBook Air.​​ On the Apple silicon version:

Version <U+2068>24.06.3 (d678e393)<U+2069>
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

the text “ម៉ោង កម្លាំង” in the input box gets rendered like this:

silicon qt6

Ditto for the Intel Qt6 version.

On the Intel version with Qt5 (running on Rosetta):

Version <U+2068>24.06.3 (d678e393)<U+2069>
Python 3.9.18 Qt 5.14.2 PyQt 5.14.1

it gets rendered properly

intel qt5

The same is true for the text on the card itself, not just the input box. My CSS is as follows:

.card {
 font-family: Khmer Mondulkiri, Kh Ang Vassa, arial;
 font-size: 50px;
 text-align: center;
}

input {
 font-family: Khmer Mondulkiri, Kh Ang Vassa, KST CKS Moul, arial !important;
 font-size: 50px !important;
 text-align: center;
}

Perhaps a future toolkit update will fix it. Interestingly, it currently renders (mostly) ok with a stock notetype with no customizations.

Screenshot 2024-07-31 at 9.34.47 PM

2 Likes

Oh wow! Thanks, I never considered that the font itself could be part of the problem. Once I commented the font styling out and added 20px of padding, it works as expected again. I don’t suppose there’s a way to have different CSS apply to different OS’s? :stuck_out_tongue:

What’s this toolkit that you speak of?

As a matter of fact, there is – Styling & HTML - Anki Manual .

1 Like

That’s awesome, thank you all! :slight_smile:

For anyone else running into this in the future, it turns out the native Mac OS font for Khmer (appears to be Khmer Sangam MN) doesn’t render ញ៉ាំ properly:

Screenshot 2024-08-02 at 2.36.42 in the afternoon

Noto Serif Khmer renders that fine, but then the bottom gets lopped off for words like បច្ចុប្បន្ន , no matter how much bottom padding I give it. This appears to be partially the font’s fault for not accurately reporting the height of the text.

Screenshot 2024-08-02 at 2.44.12 in the afternoon

I finally found that the Battambang font renders all the examples (ម៉ោង ញ៉ាំ បច្ចុប្បន្ន) correctly:

Screenshot 2024-08-02 at 3.56.00 in the afternoon

This seems to be something specific to the combination of Mac OS and Qt6, since all these fonts (except for the system one) render fine in Pages on the Mac, or on Anki on other OS’s.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.