linebender / skribo

A Rust library for low-level text layout.
Apache License 2.0
327 stars 35 forks source link

Fix issue where glyphs were renderered as outlines #35

Open adamnemecek opened 3 years ago

adamnemecek commented 3 years ago

Closes #18

I came across this while trying out the canvas_nanovg example in pathfinder.

The glyphs were rendered like this

skribo

This is the result after this patch:

skribo fix

Credit goes to @jeroentervoorde and @Stoeoef, who figured this out.

Links: https://github.com/servo/pathfinder/issues/194 https://github.com/maps4print/azul/issues/125#issuecomment-479172471

raphlinus commented 3 years ago

I'm confused, the linked HB doc suggests that the funcs are already set by default. Looking at the HB source, it seems like they are, unless HB_NO_OT_FONT is set. Do we think the Rust HB build is setting that symbol?

RazrFalcon commented 3 years ago

@raphlinus Unless they are using harfbuzz < 2.0. For example, Ubuntu 18.04 uses 1.7.2.

adamnemecek commented 3 years ago

The rust harfbuzz bindings use 2.6.4.

raphlinus commented 3 years ago

Thanks @RazrFalcon, that really helps clear up my confusion. If I understand it, the crate is designed to dynamically link the system HarfBuzz when available, but statically build when not? That would explain diversity of behavior. It's also potentially a very serious problem if we want to depend on newer behavior.

In any case, do you think this is a good fix?

RazrFalcon commented 3 years ago

@adamnemecek It uses system one on linux. You have to set HARFBUZZ_SYS_NO_PKG_CONFIG=1 to opt it.

RazrFalcon commented 3 years ago

@raphlinus Personally, I think using HARFBUZZ_SYS_NO_PKG_CONFIG=1 to always use the embedded version is preferred. I've already had strange bugs in resvg because of relying on a system version.

raphlinus commented 3 years ago

Right, I agree. There's just way too much that can go wrong. Adam, would you be willing to make that PR?

adamnemecek commented 3 years ago

I can give it a shot. That would be a different PR right?

On Fri, Jul 17, 2020 at 11:36 Raph Levien notifications@github.com wrote:

Right, I agree. There's just way too much that can go wrong. Adam, would you be willing to make that PR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/linebender/skribo/pull/35#issuecomment-660275014, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABMRD6XSHBZ56FKUBO3Z7TR4CK2NANCNFSM4O6VAKOQ .