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):
Currently, there are several issues on how Servo generates
font_listonOpenHarmonyplatform:style,weight, &widthinformation by parsing the filename of the font itself. For example, if the name of the file isHarmonyOS_Sans_Condensed.ttf, then thewidthwill be set tocondensed, because the filename contains the wordCondensed.Androidand maybe other platforms as well, butOpenHarmonydoesn't consider language during font matching, when it actually should according to the specs.Ideas (feel free to add):
UsePR #44061Fontationsto obtain the font'sfamily name,style,weight, &width.Implement a mechanism that stores the generated font list in the device. This way, Servo won't need to usePR #44158Fontationsto read the font files one by one on subsequent boots.Use OpenHarmony's native API to get a list of system fonts available instead of manually traversingPR #44061/system/fontsdirectory.languageduring font matching to be more compliant to the specs. This means that we'll need to addlangfield in theFont(from font_list) struct & add language check (this can also be extended to other platforms as well).TrueTypecollection processing.