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

[WIP] Basic text shaping and rendering using HarfBuzz #2181

Closed
wants to merge 5 commits into from

Conversation

anirudhb
Copy link

@anirudhb anirudhb commented Mar 16, 2019

Doesn't render properly yet, though.
I'd like it if someone could figure out why it's not rendering the proper glyphs!

edit for using:
Compile Alacritty with the feature hb-ft. This will enable FreeType on all platforms, and use HarfBuzz.

Closes #50 (I think)

Doesn't render properly yet, though.
CI and everything should now work.
@anirudhb
Copy link
Author

How would I make the raw glyphs go through the glyph cache? Right now it's being re-rasterized each time, so it's really, really slow.

@z2oh
Copy link

z2oh commented Apr 9, 2019

Thanks so much for working on this! This is the last feature I'm waiting for before I switch to alacritty as my daily driver!

I wanted to test out your PR and see if there was any way I could help; I ran into some build issues but was able to fix them.

I'm on OSx, and the font crate's manifest has not yet been updated to bring in servo-fontconfig and freetype-rs dependencies on non linux platforms. I'm sure this was already on your radar, but I thought I would mention it in case others try to test this PR.

Once I did add the freetype-rs and servo-fontconfig dependencies to the font crate, I had to rm all Cargo.lock files to get anything building. At this point, I ran into a weird build error for harfbuzz about a missing file during the build. Following the suggestion here, I added the harfbuzz-sys dependency and was able to get it running!

Here's my font/Cargo.toml

[package]
name = "font"
version = "0.1.0"
authors = ["Joe Wilm <joe@jwilm.com>"]
description = "Font rendering using the best available solution per platform"
license = "Apache-2.0"

[dependencies]
euclid = "0.19.2"
libc = "0.2"
foreign-types = "0.3"
log = "0.4"

harfbuzz-sys = { version = "=0.3.0", optional = true }
harfbuzz = { version = "0.3.0", optional = true }
servo-fontconfig = { version = "0.4.0", optional = true }
freetype-rs = { version = "0.19", optional = true }

[target.'cfg(not(any(target_os = "macos", windows)))'.dependencies]
servo-fontconfig = "0.4.0"
freetype-rs = "0.19"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.6"
core-text = "13"
core-graphics = "0.17"
core-foundation-sys = "0.6"

[target.'cfg(windows)'.dependencies]
font-loader = "0.6.0"
rusttype = "0.4.1"

[features]
default = []
hb-ft = ["harfbuzz-sys", "harfbuzz", "servo-fontconfig", "freetype-rs"]

I plan to continue poking around your PR to see if I can help. If you have any pointers on what I might be able to do to maximize usefulness please let me know!!

@anirudhb
Copy link
Author

anirudhb commented Apr 12, 2019

@z2oh Thanks! Actually, I've been planning to create a common, font-rasterizer-independent shaper that works directly on the font file, but I've not had the time to do it 😅

@anirudhb
Copy link
Author

Additionally, this is also the thing stopping me from switching too!

@BYK
Copy link
Contributor

BYK commented Jul 20, 2019

I can help testing (and potentially fixing) on Windows once this gets to a more mature state.

@chrisduerr
Copy link
Member

Looks like there was some additional work done for this in #2677. Since this PR hasn't been updated in a while, I'll close this one in favor of #2677.

If you have any contributions you wish to make on top of #2677 you can send a PR to the author, if he is unresponsive we can just re-open a new PR. This way we don't run into trouble with multiple people working on the same thing.

@chrisduerr chrisduerr closed this Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support for ligatures
4 participants