4 releases (2 breaking)

0.3.0 May 5, 2022
0.2.1 Apr 6, 2022
0.1.1 Apr 5, 2022
0.1.0 Apr 5, 2022

#2403 in Parser implementations

Download history 9/week @ 2024-03-12 6/week @ 2024-03-19 2/week @ 2024-03-26 23/week @ 2024-04-02 3/week @ 2024-04-09 6/week @ 2024-04-16 20/week @ 2024-04-23 7/week @ 2024-04-30 38/week @ 2024-05-07 23/week @ 2024-05-14 36/week @ 2024-05-21 27/week @ 2024-05-28 16/week @ 2024-06-04 24/week @ 2024-06-11 10/week @ 2024-06-18 15/week @ 2024-06-25

68 downloads per month
Used in 6 crates (3 directly)

Apache-2.0

73KB
1.5K SLoC

Contains (WOFF font, 24KB) lato-v22-latin-regular.woff2

woff2

woff2 is a crate for converting WOFF2 font files to OpenType fonts.

Examples

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

Command line utility

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

Unimplemented features / known issues

  • WOFF2 fonts with 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.
  • WOFF (the original WOFF format) is not supported
  • Converting OpenType to WOFF2 is not supported yet.

Acknowledgements

License

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.

Dependencies

~8.5MB
~311K SLoC