רינדור פונטים ב-Discourse

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 לייקים

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 לייקים

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 לייקים

תודה על התשובה. אני אמשיך לכבות גופנים מודגשים. איך אתה חושב שיהיה קל יותר לעשות זאת?

לייק 1

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

אף אחד מאלה לא יעשה דבר לגבי הגופן שלך.

ניסיתי את הפתרון שלי באופן מקומי, וזה נראה שעשה את העבודה. האם אתה אומר שה-CSS לא מופעל, או שהוא מופעל אבל לא פותר את הבעיה?

@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")
}

הבעיה נגרמת מהגדרות ברירת המחדל של תכונות הגופנים ב-CSS של Discourse, המפריעות לעיבוד תסריטים מורכבים:

css

// הגדרות ברירת מחדל בעייתיות
font-variant-ligatures: none;
font-feature-settings: "calt" 0;

// הפתרון הוא לדרוס
 font-variant-ligatures: normal;
 font-feature-settings: normal;

זה פתר את הבעיה עם שני הגופנים.

2 לייקים

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