New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add font-fallback on OpenHarmony and fix several compilation issues #32141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps pay special attention to this file. It's based on an earlier version of android/font_list.rs
, which received some updates in the recent days.
My current approach was to just hardcode one version of the HarmonyOS Sans
font family available on ohos devices and update the list of fallback families for codepoints.
There are quite a few HarmonyOS_Sans_*.ttf
files available on ohos devices. I chose one with the largest filesize, and that seemed to work well in practice.
There is also a fontconfig.json available, which could be parsed (for an example see https://github.com/jschwe/ohos-fontconfig/blob/main/src/lib.rs)
Instead of a new port do you mind creating a custom path in the existing servoshell? I think it's better that all platforms have their own servoshell implementation rather than a custom build target, which makes the mach scripts much more complicated. |
The native code for OpenHarmony is loaded as a dynamic library into a TypeScript / Javascript app, and the OH port is very similar to the android port, and doesn't share much (perhaps even any) code with servoshell at the moment. |
@mrobinson How about merging the OH app into the same package as the android app instead? |
My goal is to merge the Android app into servoshell as well since they are both effectively "servoshell" but for different platforms. The hope is that they can eventually share more code.
The OpenHarmony shared library built here isn't useful with the Servo repository. This is different from the Android application, because you can actually build the entire application with the Servo repository. I don't see too much of an advantage to keep this code in the repository since the CI isn't testing it and there is no way to run it without the other part. Can you submit just the parts that fix the build for Open Harmony and maintain the part that builds a servo shared object with the rest of your application? |
My hope was to open-source/upstream everything required to build servo for OpenHarmony - I just didn't want to make one huge pull request and instead split things up into multiple smaller PRs (with CI planned to be one of the last ones, as I wouldn't have time before RustNL).
Sure, for now I will drop the skeleton app commit. For the future I would still hope that I can upstream the full demo app. Just let me know if you would accept it (in general), and if yes, if you want everything to be in one big PR, with CI and everything, or if splitting things up would be preferable. |
348d427
to
ba7fbab
Compare
ba7fbab
to
5a9fa0b
Compare
5a9fa0b
to
916bce1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine though there is one small thing I noticed:
static ref FONT_LIST: FontList = FontList::new(); | ||
} | ||
|
||
/// An identifier for a local font on Android systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should likely be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Adjusted this comment while rebasing.
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Updates `freetype-sys` to v0.20.1, which includes a build fix for OpenHarmony. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Hardcode HarmonyOS_Sans_SC_Regular for Chinese Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
916bce1
to
ba2bd9a
Compare
Adds a fallback font and fixes several compilation issues when compiling for OpenHarmony.
./mach build -d
does not report any errors./mach test-tidy
does not report any errors