Skip to content

On Linux, add Noto fonts to fallback list for other languages #31664

Closed

Description

@delan

When a character isn’t supported by any of the fonts chosen by the page, some browsers search through all of the installed fonts to find one that supports text in that language (e.g. Firefox). Servo can’t do that yet, but we currently have hardcoded lists of “fallback fonts” that we try in those situations. There are separate lists for each platform, and on Linux, we use the list in freetype/font_list.rs.

Noto fonts are often installed by default on Linux distros like Ubuntu. We can use char::script() to check what script (language) the character is in.

  1. Find an enum variant in Script that also has a Noto font according to this page
  2. In this function, check if codepoint is in that script
  3. If so, add the Noto Sans font name to the fallback list

For example, for Script::Adlam we can add “Noto Sans Adlam” to the fallback list:

image

Activity

  1. richarddushime commented on Mar 14, 2024

    @richarddushime
    Contributor

    Hi @delan
    i would like to work on this
    can you assign it to me ?

  2. sandeepB3 commented on Mar 14, 2024

    @sandeepB3
    Contributor

    Hey @delan, I think none of the variants in script fall into unicode plane 2, besides the function is_cjk primarily matches unicode blocks containing CJK Unified Ideographs Extension characters.

  3. delan commented on Mar 15, 2024

    @delan
    MemberAuthor

    Hey @delan, I think none of the variants in script fall into unicode plane 2, besides the function is_cjk primarily matches unicode blocks containing CJK Unified Ideographs Extension characters.

    I would expect most of those scripts to be in plane 0 (BMP) or plane 1 (SMP), but yeah, this would be separate to the is_cjk() check (if the character is CJK, add the CJK fonts, if the character is Adlam, add Noto Sans Adlam, and so on).

  4. komutumu commented on May 3, 2024

    @komutumu
    Contributor

    Hello @delan , has this been addressed or I can have a go at it?
    I see more fonts added to the list.

  5. added 6 commits that reference this issue on May 18, 2024
    f23e5c2
    8d212c1
    8111d28
    e7542aa
    5d414b9
    d8ecea9
  6. added a commit that references this issue on May 27, 2024
    43a3c9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions