Discourse font rendering

Hello,

I’m running into a font rendering issue while using a custom Urdu font i.e. Jameel Noori Nastaliq (a variant of Noto Nastaliq Urdu) in Discourse. My setup is:

  • Browser: Chrome Version 138.0.7204.183

  • Font: Jameel Noori Nastaliq

  • Platform: Discourse (I am using theme component following this)

Problem

When I apply Jameel Noori Nastaliq to Discourse, the text does not render as expected:

  • Certain words are shaped incorrectly. In the attached image, the text on the right shows how Discourse currently renders it, whereas the left shows the expected rendering (using the same font and browser).

  • Other urdu fonts (non-Nastaliq) display correctly in the same environment.

  • Additionally, Noto Nastaliq Urdu renders with an unusually large font size compared to other fonts. This makes the text appear oversized and inconsistent with the rest of the UI.

What I’ve Tried

  • Testing multiple Nastaliq fonts: All Nastaliq fonts i.e. Jameel, Mehr and Noto has this issue.

  • Comparing with different browsers: (tested on Firefox/Edge)

  • Verifying CSS overrides: The font is correctly applied via @font-face and loaded by Discourse.

Expected vs Actual

  • Expected: Correct Nastaliq ligatures and proportional sizing (see left side of image).

  • Actual: Broken word shaping and oversized text (see right side of image).

Has anyone else run into this issue with Noto Nastaliq Urdu on Chrome + Discourse? Is this a Chrome shaping bug, a font issue, or something in the way Discourse handles custom fonts?

Thanks in advance for any guidance.

2 Likes

There’s a chance Discourse is doing something to the fonts with regards to font weights.

Are you familiar with css? You may be able to tweak some of the font weight variables defined in Styling Discourse with variables: Show & Tell in a theme component.

4 Likes

yes, I think it’s mainly the bolding that’s causing the distortion.
Either turn off all the bold fonts with a global overrule, or make sure that the font you’re using has a specific bold variant.

I read that this one might work betterr: Jameel Noori Nastaleeq Kasheeda: Download for free at Urdu Fonts : Urdu Fonts

2 Likes

@chapoi Thank you for the reply. I will go on to turn off bold fonts. how do you rekon will be easier to do it?

1 Like

Hmm, to be very thorough, adding this to your custom css should work:

* {
  font-weight: normal !important;
 }

@chapoi Unfortunately this is not working. What do you think about

overflow-wrap: break-word;
white-space: nowrap;
text-overflow: ellipsis;

These three are common to these words

1 Like

None of those will do anything for your font.

I tried my solution locally, and that seemed to do the trick. Are you saying the css is not getting applied, or it doe get applied but doesn’t solve the problem?

@chapoi thank you. What I want to say that CSS rule is applied but it is not producing desired effects. Below are the links for you to reproduce what I am experiencing

/* Jameel Noori Nastaliq v4 */
@font-face {
  font-family: "Jameel-Noori";
  src: url("https://cdn.jsdelivr.net/npm/jameel-noori/fonts/jameel-noori-nastaleeq4.woff2") format("woff2"),
  url("https://unpkg.com/jameel-noori/fonts/jameel-noori-nastaleeq4.woff2") format("woff2");
}

This perticular varient is producing this sort of overlapped characters and is miles away from desired effect which is down there.

/* Mehr Nastaliq Web Font v2 */
@font-face {
  font-family: "Mehr";
  src: url("https://cdn.jsdelivr.net/npm/mehr-nastaliq/fonts/mehr.woff2") format("woff2")
}