Skip to content

Implement a new method to generate font_list on OpenHarmony platform #43596

@RichardTjokroutomo

Description

@RichardTjokroutomo

Currently, there are several issues on how Servo generates font_list on OpenHarmony platform:

  • Servo obtains the style, weight, & width information by parsing the filename of the font itself. For example, if the name of the file is HarmonyOS_Sans_Condensed.ttf, then the width will be set to condensed, because the filename contains the word Condensed.
  • Servo only process fonts whose filename is prefixed with "HarmonyOS" or "Noto".
  • This also extends to Android and maybe other platforms as well, but OpenHarmony doesn't consider language during font matching, when it actually should according to the specs.

Ideas (feel free to add):

  • Use Fontations to obtain the font's family name, style, weight, & width. PR #44061
  • Implement a mechanism that stores the generated font list in the device. This way, Servo won't need to use Fontations to read the font files one by one on subsequent boots. PR #44158
  • Use OpenHarmony's native API to get a list of system fonts available instead of manually traversing /system/fonts directory. PR #44061
  • Consider language during font matching to be more compliant to the specs. This means that we'll need to add lang field in the Font (from font_list) struct & add language check (this can also be extended to other platforms as well).
  • Parallelize TrueType collection processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions