Upgrade to fontdue 0.8

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
This commit is contained in:
今何求 2023-11-29 17:52:27 +08:00 committed by GitHub
parent 3e71d1b559
commit 607bdbfcf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 5 deletions

View file

@ -132,6 +132,7 @@ itertools = { version = "0.12" }
softbuffer = { version = "0.3.3", default-features = false }
bytemuck = { version = "1.13.1" }
glutin = { version = "0.31.1", default-features = false }
fontdue = { version = "0.8.0" }
[profile.release]
lto = true

View file

@ -58,7 +58,7 @@ linked_hash_set = "0.1.4"
image = { version = "0.24", optional = true }
resvg = { workspace = true, optional = true }
# font embedding
fontdue = { version = "0.7.1", optional = true }
fontdue = { workspace = true, optional = true }
[dev-dependencies]
i-slint-parser-test-macro = { path = "./parser-test-macro" }

View file

@ -200,7 +200,7 @@ fn embed_glyphs_with_fontdb<'a>(
fontdb.with_face_data(face_id, |font_data, face_index| {
let fontdue_font = match fontdue::Font::from_bytes(
font_data,
fontdue::FontSettings { collection_index: face_index, scale: 40. },
fontdue::FontSettings { collection_index: face_index, scale: 40., ..Default::default() },
) {
Ok(fontdue_font) => fontdue_font,
Err(fontdue_msg) => {
@ -321,7 +321,11 @@ fn get_fallback_fonts(fontdb: &sharedfontdb::FontDatabase) -> Vec<fontdue::Font>
.with_face_data(face_id, |face_data, face_index| {
fontdue::Font::from_bytes(
face_data,
fontdue::FontSettings { collection_index: face_index, scale: 40. },
fontdue::FontSettings {
collection_index: face_index,
scale: 40.,
..Default::default()
},
)
.ok()
})

View file

@ -97,7 +97,7 @@ web-sys = { version = "0.3", features = [ "HtmlImageElement" ] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
fontdb = { workspace = true, optional = true, default-features = true }
rustybuzz = { version = "0.11.0", optional = true }
fontdue = { version = "0.7.1", optional = true }
fontdue = { workspace = true, optional = true }
[dev-dependencies]
slint = { path = "../../api/rs/slint", default-features = false, features = ["std", "compat-1-2"] }

View file

@ -26,7 +26,11 @@ fn get_or_create_fontdue_font(fontdb: &fontdb::Database, id: fontdb::ID) -> Rc<f
.with_face_data(id, |face_data, font_index| {
fontdue::Font::from_bytes(
face_data,
fontdue::FontSettings { collection_index: font_index, scale: 40. },
fontdue::FontSettings {
collection_index: font_index,
scale: 40.,
..Default::default()
},
)
.expect("fatal: fontdue is unable to parse truetype font")
.into()