Skip to content
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

Sync all changes from servo/font-kit up to version 0.12.0 #13

Merged
merged 29 commits into from
Dec 15, 2023

Conversation

daprahamian
Copy link

Mainly doing this for:

I made this diff that syncs all the other changes rather than cherry-picking the ones we want b/c I wanted to avoid us messing up the history in case we wanted future changes. That said, if we need to, we could probably sync just the changes in those two commits.

CryZe and others added 29 commits November 22, 2021 17:49
The code here just trusted the value to always to be valid, but since
this may be an arbitrary font, the value may not always be valid. In my
case the `usWidthClass` I'm seeing has the value 500, probably the
`usWeightClass` accidentally being assigned to the `usWidthClass`.
Fix panic when parsing invalid `usWidthClass`

The code here just trusted the value to always to be valid, but since this may be an arbitrary font, the value may not always be valid. In my case the `usWidthClass` I'm seeing has the value 500, probably the `usWeightClass` accidentally being assigned to the `usWidthClass`.
Created new struct `BlitRgb24ToRgba32` implementing `Blit` to facilitate the conversion.

Fixes servo#190.
To get rid of a compiler warning
Fix panic when converting from Rgb24 to Rgba32

Created new struct `BlitRgb24ToRgba32` implementing `Blit` to facilitate the conversion.

Fixes servo#190.
instead of servo-fontconfig

servo-fontconfig statically links a vendored fontconfig library if
fontconfig is not found by pkgconfig. Using a vendored fontconfig
library instead of the system fontconfig library doesn't actually work
well though:
slint-ui/slint#88
Building a vendored copy of fontconfig is also problematic because
fontconfig has a lot of C dependencies, which makes it difficult to
cross compile the vendored copy of fontconfig:

$ pkg-config fontconfig --static --libs
-lfontconfig -lfreetype -lz -lbz2 -lpng16 -lm -lm -lz -lharfbuzz -lm
-lglib-2.0 -lm -lpcre -lsysprof-capture-4 -pthread -lgraphite2
-lbrotlidec -lbrotlicommon -lxml2 -lz -llzma -lm

Instead of using a vendored copy, with
yeslogic/fontconfig-rs#12
yeslogic-fontconfig-sys will have a Cargo feature to dlopen fontconfig
at runtime instead of linking it at build time. This is exposed in
font-kit with the new source-fontconfig-dlopen feature, which is
disabled by default. The feature can be enabled by setting the
RUST_FONTCONFIG_DLOPEN environment variable to avoid needing to
propagate the Cargo feature all the way through downstream
Cargo.toml's. This feature makes it considerably easier to cross
compile by avoiding the need to cross compile fontconfig and all its
dependencies.
switch to yeslogic-fontconfig-sys instead of servo-fontconfig

servo-fontconfig statically links a vendored fontconfig library if fontconfig is not found by pkgconfig. Using a vendored fontconfig
library instead of the system fontconfig library doesn't actually work well though:
slint-ui/slint#88
Building a vendored copy of fontconfig is also problematic because fontconfig has a lot of C dependencies, which makes it difficult to cross compile the vendored copy of fontconfig:

```
$ pkg-config fontconfig --static --libs
-lfontconfig -lfreetype -lz -lbz2 -lpng16 -lm -lm -lz -lharfbuzz -lm -lglib-2.0 -lm -lpcre -lsysprof-capture-4 -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lxml2 -lz -llzma -lm
```

Instead of using a vendored copy, with
yeslogic/fontconfig-rs#12
yeslogic-fontconfig-sys will have a Cargo feature to dlopen fontconfig at runtime instead of linking it at build time. This is exposed in font-kit with the new source-fontconfig-dlopen feature, which is disabled by default. This feature makes it considerably easier to cross compile by avoiding the need to cross compile fontconfig and all its dependencies.
…ts, r=jdm

fix compilation errors in tests

With this command line:

```
cargo test --features="source,loader-freetype-default"
```

Then these errors are produced:

```
error[E0428]: the name `get_vertically_hinted_glyph_outline` is defined multiple times
   --> tests/tests.rs:270:1
    |
226 | pub fn get_vertically_hinted_glyph_outline() {
    | -------------------------------------------- previous definition of the value `get_vertically_hinted_glyph_outline` here
...
270 | pub fn get_vertically_hinted_glyph_outline() {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `get_vertically_hinted_glyph_outline` redefined here
    |
    = note: `get_vertically_hinted_glyph_outline` must be defined only once in the value namespace of this module

error[E0428]: the name `get_fully_hinted_glyph_outline` is defined multiple times
   --> tests/tests.rs:360:1
    |
316 | pub fn get_fully_hinted_glyph_outline() {
    | --------------------------------------- previous definition of the value `get_fully_hinted_glyph_outline` here
...
360 | pub fn get_fully_hinted_glyph_outline() {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `get_fully_hinted_glyph_outline` redefined here
    |
    = note: `get_fully_hinted_glyph_outline` must be defined only once in the value namespace of this module
```

This PR fixes those by adding a conditional config, so that the two compiles are exclusive to each other.
Derive Hash for `FamilyName` and `Style`

I needed this for caching implementation and felt it easier to use font-kit's types instead of converting them into my own.
Switch to GitHub Actions badge and use SPDX license format

None
Bump prettytable to 0.10

Fixes some nightly builds and gets rid of unsafe API
Bail out from rendering when bitmap_buffer is null
* Enable the GitHub merge queue

* Only run the push workflow on master

* Fix the Mac runner selection
According to https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_library

> Library objects are normally created by `FT_Init_FreeType`, and destroyed with `FT_Done_FreeType`.
@vorporeal vorporeal merged commit 7fc8e74 into warp Dec 15, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.