Skip to content

Commit

Permalink
add support for FreeType variation fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
lsalzman committed Dec 21, 2018
1 parent 75ab412 commit ac5ae58
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 73 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions webrender/Cargo.toml
Expand Up @@ -72,6 +72,7 @@ rand = "0.4"

[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]
freetype = { version = "0.4", default-features = false }
libc = "0.2"

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.6.3"
Expand Down
2 changes: 2 additions & 0 deletions webrender/src/lib.rs
Expand Up @@ -153,6 +153,8 @@ extern crate core_text;

#[cfg(all(unix, not(target_os = "macos")))]
extern crate freetype;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate libc;

#[cfg(target_os = "windows")]
extern crate dwrote;
Expand Down
5 changes: 1 addition & 4 deletions webrender/src/platform/macos/font.rs
Expand Up @@ -339,10 +339,7 @@ impl FontContext {
match self.ct_fonts.entry((font_key, size, variations.to_vec())) {
Entry::Occupied(entry) => Some((*entry.get()).clone()),
Entry::Vacant(entry) => {
let cg_font = match self.cg_fonts.get(&font_key) {
None => return None,
Some(cg_font) => cg_font,
};
let cg_font = self.cg_fonts.get(&font_key)?;
let ct_font = new_ct_font_with_variations(cg_font, size.to_f64_px(), variations);
entry.insert(ct_font.clone());
Some(ct_font)
Expand Down

0 comments on commit ac5ae58

Please sign in to comment.