Crates.io | woff2-patched |
lib.rs | woff2-patched |
version | 0.3.0 |
source | src |
created_at | 2024-05-24 15:44:17.737713 |
updated_at | 2024-05-24 15:44:17.737713 |
description | WOFF2 decompression library, forked with some fixes |
homepage | |
repository | https://github.com/zimond/woff2-rs |
max_upload_size | |
id | 1251265 |
size | 133,204 |
woff2-patched
woff2
is a crate for converting WOFF2 font files to OpenType fonts. This is a patched version
with some fixes.
use woff2::decode::{convert_woff2_to_ttf, is_woff2};
let buffer = std::fs::read("src/test_resources/lato-v22-latin-regular.woff2").unwrap();
assert!(is_woff2(&buffer));
let ttf = convert_woff2_to_ttf(&mut std::io::Cursor::new(buffer)).unwrap();
// ... use `ttf` however you would use a loaded TTF file
The decoder
example is a simple command-line application to convert a WOFF2
font to OpenType format:
cargo run --example decoder input-filename.woff2 output-filename.ttf
hmtx
transformations are not yet supported. It seems like these transformations are rare and we haven't found one yet. You can help by submitting a sample font that has them.glyf
decoding logic from Allsorts.Copyright 2022 Cimpress
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.