For conditional loading you can just use the CSS `unicode-range` property (
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range)
and the browser will only load the font if one of the codepoints that you
specified that it handles is present in the page.

-Travis

On Sun, Nov 2, 2025 at 12:28 PM Amir Sarabadani <[email protected]> wrote:

> In Persian Wikipedia, people who want to use a different font (e.g. Vazir)
> that are free, they just load them through a gadget: For example
> https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-Vazir.css
> (See the full list of font gadgets
> https://fa.wikipedia.org/wiki/ویژه:ابزارها in fonts section)
>
> If you're working to allow better rendering of rare characters, my
> suggestion would be to load the font only conditionally on pages that use
> the rare characters, for example using categories (you can now load a
> gadget if a category exists:
> https://www.mediawiki.org/wiki/Extension:Gadgets#Options) or
> alternatively a js detecting the issue and loading the gadget (which might
> cause FOUC so not really recommended). In Persian Wikipedia, we wanted to
> load poems with a different look (Nastaliq) and the idea we came up with
> was to basically, if Template:Poem is used, then load a font gadget to show
> the poems differently.
>
> HTH
>
> Am So., 2. Nov. 2025 um 21:14 Uhr schrieb Brian Wolff <[email protected]>:
>
>> I'd really hope an alternative could be found here. Either let a new font
>> into ULS or allow the webfont to be uploaded to the local wiki as a file on
>> a one-off basis.
>>
>> I personally think loading anything by default from toolforge is really
>> bad policy. (To be clear, im just a rando, this is just my personal opinion)
>>
>> On Sunday, 2 November 2025, diskdance via Wikitech-l <
>> [email protected]> wrote:
>>
>>> Hello everyone,
>>>
>>> The Chinese Wikipedia is holding a discussion [1][2] about wiping out
>>> tofus when displaying rare Chinese characters. During the discussion, one
>>> option turned out to be serving a webfont covering all CJK planes, which
>>> was the practice on Chinese Wikipedia more than a decade ago before it was
>>> disabled for security reasons. Since the reasons are still valid and ULS is
>>> no longer accepting new font additions, so the only feasible way to achieve
>>> this is to serve the webfont via a Toolforge domain.
>>>
>>> Due to potential impacts of this proposal, I'm writing to ask:
>>>
>>>    1. Is it acceptable to serve a webfont (conditionally or not
>>>    conditionally) via Toolforge by default, policy-wise?
>>>    2. And is it acceptable in terms of performance (since Toolforge is
>>>    not using Wikimedia's CDN)?
>>>
>>>
>>> [1]
>>> https://zh.wikipedia.org/wiki/Wikipedia:%E4%BA%92%E5%8A%A9%E5%AE%A2%E6%A0%88/%E6%8A%80%E6%9C%AF#%E7%94%9F%E5%83%BB%E5%AD%97webfont
>>> [2]
>>> https://zh.wikipedia.org/wiki/Wikipedia:%E4%BA%92%E5%8A%A9%E5%AE%A2%E6%A0%88/%E6%8A%80%E6%9C%AF#%E4%BB%8B%E7%BB%8D%EF%BC%9AWebFont-ZH%E6%9C%8D%E5%8A%A1%E5%8F%8A%E5%B0%8F%E5%B7%A5%E5%85%B7
>>>
>>> Best regards,
>>> diskdance
>>>
>> _______________________________________________
>> Wikitech-l mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>>
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
>
>
> --
> Amir (he/him)
>
> _______________________________________________
> Wikitech-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
_______________________________________________
Wikitech-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to