Skip to content

Commit b3fd981

Browse files
committed
fix: woff2 feature gate
1 parent e44deba commit b3fd981

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fontkit"
3-
version = "0.6.0-beta.3"
3+
version = "0.6.0-beta.4"
44
edition = "2021"
55
authors = ["Zimon Dai <[email protected]>"]
66
description = "A simple library for font loading and indexing"

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum Error {
1616
Io(#[from] std::io::Error),
1717
#[error("Glyph {c} not found in font")]
1818
GlyphNotFound { c: char },
19-
#[cfg(feature = "woff2")]
19+
#[cfg(feature = "woff2-patched")]
2020
#[error(transparent)]
2121
Woff2(#[from] woff2_patched::decode::DecodeError),
2222
#[error("Metrics mismatch: values {value:?} metrics {metrics:?}")]

src/font.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl Font {
177177

178178
#[cfg(feature = "parse")]
179179
fn from_buffer_with_variant(mut buffer: Vec<u8>, variant: Variant) -> Result<Vec<Self>, Error> {
180-
#[cfg(feature = "woff2")]
180+
#[cfg(feature = "woff2-patched")]
181181
if is_woff2(&buffer) {
182182
buffer = woff2_patched::convert_woff2_to_ttf(&mut buffer.as_slice())?;
183183
}

tests/basic.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ pub fn test_variable_font_loading() -> Result<(), Error> {
3434
Ok(())
3535
}
3636

37+
#[test]
38+
pub fn test_search_font() -> Result<(), Error> {
39+
let fontkit = FontKit::new();
40+
fontkit.search_fonts_from_path("examples/AlimamaFangYuanTiVF.ttf")?;
41+
assert_eq!(fontkit.len(), 18);
42+
Ok(())
43+
}
44+
3745
#[test]
3846
pub fn test_text_wrap() -> Result<(), Error> {
3947
let fontkit = FontKit::new();

0 commit comments

Comments
 (0)