kcahtoor is experiencing font rendering issues with the Jameel Noori Nastaliq font in Discourse, particularly with incorrect word shaping and oversized text. The problem persists across multiple Nastaliq fonts and browsers. nat and chapoi suggest that bolding might be causing the distortion and recommend disabling bold fonts or ensuring the font has a bold variant. kcahtoor attempts to turn off bold fonts but finds it ineffective. chapoi provides a CSS solution to set font weight to normal, but kcahtoor reports that it doesn’t resolve the issue. Further investigation reveals that Discourse’s default CSS settings interfere with complex script rendering. kcahtoor ultimately solves the problem by overriding the default font feature settings with font-variant-ligatures: normal; and font-feature-settings: normal;. The solution addresses the rendering issues for both Jameel Noori Nastaliq and Mehr Nastaliq fonts.
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?
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 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
/* Mehr Nastaliq Web Font v2 */
@font-face {
font-family: "Mehr";
src: url("https://cdn.jsdelivr.net/npm/mehr-nastaliq/fonts/mehr.woff2") format("woff2")
}