# Khmer text not being shown properly on Qt6

**URL:** <https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667>\
**Category:** Card Design\
**Created:** [July 31, 2024, 5:24am UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667 "2024-07-31T05:24:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amosjyng](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@amosjyng](https://forums.ankiweb.net/u/amosjyng)\
**Post date:** [July 31, 2024, 5:24am UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/1 "2024-07-31T05:24:26Z")

</div>

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

```auto
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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/0/009881844bf4fbad7302cfcfa15f4f0bf3a81292.png)

Ditto for the Intel Qt6 version.

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

```auto
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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/4/c/4cea1671cb06299c4e6464cc674ab2441c2e2143.png)

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

```css
.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;
}

```

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [July 31, 2024, 2:35pm UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/2 "2024-07-31T14:35:26Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/e/d/ed49e7a1979c4701f4ea5cb0110e62d728459c0e.png)

---

<div class="post-metadata">

**Author:** ![amosjyng](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@amosjyng](https://forums.ankiweb.net/u/amosjyng)\
**Post date:** [August 1, 2024, 10:39am UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/3 "2024-08-01T10:39:36Z")

</div>

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? 😛

What’s this toolkit that you speak of?

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [August 1, 2024, 2:24pm UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/4 "2024-08-01T14:24:38Z")

</div>

> [@amosjyng](#):
>
> I don’t suppose there’s a way to have different CSS apply to different OS’s? 😛

As a matter of fact, there is – [Styling & HTML - Anki Manual](https://docs.ankiweb.net/templates/styling.html#platform-specific-css) .

---

<div class="post-metadata">

**Author:** ![amosjyng](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@amosjyng](https://forums.ankiweb.net/u/amosjyng)\
**Post date:** [August 2, 2024, 9:12am UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/5 "2024-08-02T09:12:29Z")

</div>

That’s awesome, thank you all! 🙂

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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/8/087039e6d7530822c17fd6d2870db88418b43ecc.png)

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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/1/a/1a930a29b95bdec209307b9bcda1c4f3737cae25.png)

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

![Screenshot 2024-08-02 at 3.56.00 in the afternoon](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/5/f/5f4fe8c5b8ceb6a4b3001a0d868ba722fea78ce6.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [September 1, 2024, 9:13am UTC](https://forums.ankiweb.net/t/khmer-text-not-being-shown-properly-on-qt6/47667/6 "2024-09-01T09:13:08Z")

</div>

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