PackageTrack
Sign in Get early access

ttf-parser

A high-level, safe, zero-allocation font parser for TrueType, OpenType, and AAT.

0.25.1 98M downloads/mo #815 most downloaded on crates.io harfbuzz/ttf-parser

What this package is like to depend on

Last release 2 years ago

no release in 18 months

Ships fairly regularly

a new release about every 2 months

Nearly every release is documented

notes for 49 of 49 stable releases

Nothing withdrawn

no release was ever pulled

7 years old

49 releases · first in 2019

0 releases in the last 12 months

see the full history below

Release timeline

49 releases · Jun 2019 to Nov 2024
2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 49
  1. 0.25.1 29 Nov 2024
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v0.25.0...v0.25.1

    Open source →
    Release notes

    Changed

    • Fix some typos and documentation related lints
    • Set MSRV in manifest to actual current value (1.63.0)
    • Update forge URL for ttf-parser and rustybuzz to harfbuzz org
    Open source →
  2. 0.25.0 04 Oct 2024
    Release notes

    Added

    • STAT table parsing. Thanks to inferiorhumanorgans.
    • UnicodeRanges internal field is public now.
    • cargo-c metadata to C API. Thanks to lu-zero.

    Changed

    • Face::is_italic checks for italic angle as well.
    • Face::italic_angle returns just a f32 and not Option<f32> now.
    • Bump MSRV to 1.59

    Fixed

    • Only apply avar table to the variation axis being set. Thanks to maxmelander.
    Open source →
  3. 0.24.1 05 Aug 2024
    Release notes

    Added

    • (glyf) glyf::Table::bbox. Thanks to LaurenzV.

    Fixed

    • (kerx) kerx::SubtablesIter wasn't updating the current subtable index.
    • (GPOS) gpos::AnchorMatrix allows nullable/optional matrices now. Thanks to LaurenzV.
    Open source →
  4. 0.24.0 02 Jul 2024
    Release notes

    Changed

    • Make core_maths dependency optional. When building for no_std one must enable no-std-float build feature now.
    Open source →
  5. 0.23.0 02 Jul 2024
    Release notes

    Changed

    • Use core_maths instead of libm. Should simplify the build process. Thanks to LaurenzV.

    Removed

    • no-std-float build flag. Should be handled automatically now.
    Open source →
  6. 0.22.0 29 Jun 2024
    Release notes

    Added

    • Face::glyph_phantom_points
    • hvar::Table::right_side_bearing_offset. Thanks to LaurenzV.
    • vvar::Table::advance_offset. Thanks to LaurenzV.
    • vvar::Table::top_side_bearing_offset. Thanks to LaurenzV.
    • vvar::Table::bottom_side_bearing_offset. Thanks to LaurenzV.
    • vvar::Table::vertical_origin_offset. Thanks to LaurenzV.
    • colr::Table::clip_box. Thanks to LaurenzV.

    Changed

    • no_std build of ttf-parser requires --features=no-std-float now. This is because we need trigonometry functions to flatten transforms in COLR. Thanks to LaurenzV.
    • colr::Painter no longer has push_translate, push_scale, push_rotate and push_skew. Only push_transform left. Thanks to LaurenzV.
    • Split hvar::Table into hvar::Table and vvar::Table. Previously, we treated both HVAR and VVAR tables as identical, but VVAR actually has additional fields. Thanks to LaurenzV.
    • Rename hvar::Table::side_bearing_offset into hvar::Table::left_side_bearing_offset. Thanks to LaurenzV.

    Fixed

    • Face::glyph_hor_advance and Face::glyph_ver_advance include gvar's phantom points when HVAR/VVAR tables are missing. Affects only variable fonts.
    • (CFF) Allow MoveTo with width commands in nested subroutines.
    • opentype_layout::LookupFlags::mark_attachment_type parsing.
    • (CFF) Allow empty charsets in cff::parse_charset. Thanks to LaurenzV.
    • (gvar) Empty sub-glyphs/components is no longer an error. Thanks to LaurenzV.
    • (GSUB/GPOS) Allow NULL offsets in ChainedContextLookup Format2 subtables. Thanks to LaurenzV.
    • Face::glyph_y_origin properly handles variable fonts now. Thanks to LaurenzV.
    • (kerx) Fix AnchorPoints parsing. Thanks to LaurenzV.

    Removed

    • push_translate, push_scale, push_rotate and push_skew from colr::Painter. Use colr::Painter::push_transform instead. Thanks to LaurenzV.
    Open source →
  7. 0.21.1 11 May 2024
    Release notes

    Fixed

    • Delta set length calculation in variable fonts. Thanks to LaurenzV.<br> Got broken in the previous version.
    Open source →
  8. 0.21.0 10 May 2024
    Release notes

    Added

    • COLR / CPAL v1 support. Thanks to LaurenzV.

    Changed

    • Replace Face::is_bitmap_embedding_allowed with Face::is_outline_embedding_allowed. The old one had a bool flag flipped. Thanks to Fuzzyzilla.
    • Increase lenience of embed permissions for older OS/2 versions. Thanks to Fuzzyzilla.
    • Bump MSRV to 1.51
    Open source →
  9. 0.20.0 15 Oct 2023
    Release notes

    Added

    • COLR / CPAL v0 support. Thanks to laurmaedje.
    • Face::is_color_glyph
    • Face::color_palettes
    • cpal::Table::palettes

    Changed

    • svg::SvgDocumentsList returns svg::SvgDocument and not just &[u8] now. Thanks to wjian23.
    • Face::set_variation allows duplicated axes now.
    • cpal::Color is called cpal::BgraColor now, and cpal::Table::get returns it.
    Open source →
  10. 0.19.2 13 Sep 2023
    Release notes

    Added

    • cff::Table::glyph_cid
    Open source →
  11. 0.19.1 19 Jun 2023
    Release notes

    Fixed

    • cff::Table::glyph_width returns a correct width when subroutines are present.
    Open source →
  12. 0.19.0 17 Apr 2023
    Release notes

    Added

    • bdat, bloc, EBDT and EBLC tables support. Thanks to dzamkov.
    • BitmapMono, BitmapMonoPacked, BitmapGray2, BitmapGray2Packed, BitmapGray4, BitmapGray4Packed, BitmapGray8 and BitmapPremulBgra32 variants to RasterImageFormat.

    Fixed

    • CBLC table parsing. Thanks to dzamkov.
    Open source →
  13. 0.18.1 09 Jan 2023
    Release notes

    Fixed

    • (MATH) Handle NULL offsets. Thanks to laurmaedje.
    Open source →
  14. 0.18.0 25 Dec 2022
    Release notes

    Added

    • name::Name::language
    • Language enum with all Windows languages.
    Open source →
  15. 0.17.1 15 Oct 2022
    Release notes

    Added

    • Face::permissions
    • Face::is_subsetting_allowed
    • Face::is_bitmap_embedding_allowed
    • Face::unicode_ranges
    • os2::Table::permissions
    • os2::Table::is_subsetting_allowed
    • os2::Table::is_bitmap_embedding_allowed
    • os2::Table::unicode_ranges

    Changed

    • Using a non-zero index in Face::parse for a regular font will return FaceParsingError::FaceIndexOutOfBounds now. Thanks to Pietrek14.
    Open source →
  16. 0.17.0 28 Sep 2022
    Release notes

    Added

    Fixed

    • (CFF) Fix large tables parsing.
    Open source →
  17. 0.16.0 28 Sep 2022
    Release notes

    Added

    • CFF Encoding support.
    • cff::Table::glyph_index
    • cff::Table::glyph_index_by_name
    • cff::Table::glyph_width
    • cff::Table::number_of_glyphs
    • cff::Table::matrix
    • post::Table::glyph_name
    • post::Table::glyph_index_by_name
    • post::Table::names
    • Face::glyph_index_by_name
    • RawFace fields and TableRecord struct are public now.

    Changed

    • Face::from_slice was replaced by Face::parse.
    • RawFace::from_slice was replaced by RawFace::parse.
    • post::Table::names is a method and not a field now.
    • Use post::Table::glyph_name instead of post::Table::names.get().

    Fixed

    • (hmtx/vmtx) Allow missing additional side bearings.
    • (loca) Allow incomplete table.
    • Reduce strictness of some table length checks.
    • (post) post::Names::len was returning a wrong value. Now this method is gone completely. You can use post::Table::names().count() instead.
    Open source →
  18. 0.15.2 17 Jun 2022
    Release notes

    Fixed

    • Missing advance and side bearing offsets in HVAR/VVAR is not an error. Simply ignore them.
    Open source →
  19. 0.15.1 04 Jun 2022
    Release notes

    Fixed

    • (cmap) cmap::Subtable4::glyph_index correctly handles malformed glyph offsets now.
    • (cmap) cmap::Subtable4::codepoints no longer includes 0xFFFF codepoint.
    • (SVG) Fixed table parsing. Thanks to Shubhamj280
    Open source →
  20. 0.15.0 20 Feb 2022
    Release notes

    Added

    • apple-layout build feature.
    • ankr, feat, kerx, morx and trak tables.
    • kern AAT subtable format 1.
    • RawFace

    Changed

    • The parser module is private now again.
    Open source →
  21. 0.14.0 28 Dec 2021
    Release notes

    Changed

    • (cmap) cmap::Subtable::glyph_index and cmap::Subtable::glyph_variation_index accept u32 instead of char now.
    • (glyf) ~7% faster outline parsing.
    Open source →
  22. 0.13.4 22 Nov 2021
    Release notes

    Fixed

    • (CFF) Panic during seac resolving.
    • (CFF) Stack overflow during seac resolving.
    Open source →
  23. 0.13.3 19 Nov 2021
    Release notes

    Fixed

    • (glyf) Endless loop during malformed file parsing.
    Open source →
  24. 0.13.2 28 Oct 2021
    Release notes

    Added

    • gvar-alloc build feature that unlocks gvar table limits by using heap. Thanks to OrionNebula
    Open source →
  25. 0.13.1 27 Oct 2021
    Release notes

    Fixed

    • Face::line_gap logic.
    Open source →
  26. 0.13.0 24 Oct 2021
    Release notes

    Added

    • Complete GSUB and GPOS tables support. Available under the opentype-layout feature.
    • Public access to all supported TrueType tables. This allows a low-level, but still safe, access to internal data layout, which can be used for performance optimization, like caching.
    • Style enum and Face::style method.
    • Face::glyph_name can be disabled via the glyph-names feature to reduce binary size.

    Changed

    • Improved ascender/descender/line_gap resolving logic.
    • Face methods: has_glyph_classes, glyph_class, glyph_mark_attachment_class, is_mark_glyph and glyph_variation_delta are moved to gdef::Table.
    • The Names struct is no longer an iterator, but a container. You have to call into_iter() manually.
    • The VariationAxes struct is no longer an iterator, but a container. You have to call into_iter() manually.
    • Most of the Name struct methods become public fields.
    • Face::units_per_em no longer returns Option.
    • (cmap) Improved subtable 12 performance. Thanks to xnuk

    Removed

    • (c-api) ttfp_glyph_class, ttfp_get_glyph_class, ttfp_get_glyph_mark_attachment_class, ttfp_is_mark_glyph, ttfp_glyph_variation_delta and ttfp_has_table.
    • TableName enum and Face::has_table. Tables can be access directly now.
    • Face::character_mapping_subtables. Use Face::tables().cmap instead.
    • Face::kerning_subtables. Use Face::tables().kern instead.

    Fixed

    • Iterator::count implementation for cmap::Subtables, name::Names and LazyArrayIter32.
    Open source →
  27. 0.12.3 27 Jun 2021
    Release notes

    Changed

    • (glyf) Always use a calculated bbox.
    Open source →
  28. 0.12.2 11 Jun 2021
    Release notes

    Fixed

    • Face::glyph_bounding_box for variable glyf.
    • (glyf) Do not skip glyphs with zero-sized bbox.
    Open source →
  29. 0.12.1 24 May 2021
    Release notes

    Added

    • Support Format 13 subtables in cmap::Subtable::is_unicode. Thanks to csmulhern
    • Derive more traits by default. Thanks to dhardy
    Open source →
  30. 0.12.0 14 Feb 2021
    Release notes

    Changed

    • Face::ascender and Face::descender will use usWinAscent and usWinDescent when USE_TYPO_METRICS flag is not set in OS/2 table. Previously, those values were ignored and hhea::ascender and hhea::descender were used. Now hhea table values will be used only when OS/2 table is not present.
    • Face::outline_glyph and Face::glyph_bounding_box in case of a glyf table can fallback to a calculated bbox when the embedded bbox is malformed now.
    Open source →
  31. 0.11.0 04 Feb 2021
    Release notes

    Added

    • FaceTables, which allowed to load Face not only from a single chunk of data, but also in a per-table way. Which is useful for WOFF parsing. No changes to the API. Thanks to fschutt
    Open source →
  32. 0.10.1 21 Jan 2021
    Release notes

    Changed

    • Update a font used for tests.
    Open source →
  33. 0.10.0 16 Jan 2021
    Release notes

    Added

    • variable-fonts build feature. Enabled by default. By disabling it you can reduce ttf-parser binary size overhead almost twice.

    Changed

    • (gvar) Increase the maximum number of variation tuples from 16 to 32. Increases stack usage and makes gvar parsing 10% slower now.

    Fixed

    • (CFF) Fix seac processing. Thanks to wezm
    Open source →
  34. 0.9.0 05 Dec 2020
    Release notes

    Removed

    • kern AAT subtable 1 aka kern::state_machine. Mainly because it's useless without a proper shaping.
    Open source →
  35. 0.8.3 15 Nov 2020
    Release notes

    Added

    • Face::glyph_variation_delta
    • The parser module is public now. Made private again in 0.15.0.
    • (C API) ttfp_glyph_variation_delta

    Fixed

    • Iterator::nth implementation for cmap::Subtables and Names.
    Open source →
  36. 0.8.2 31 Jul 2020
    Release notes

    Added

    • cmap::Subtable::codepoints

    Fixed

    • (cmap) Incorrectly returning glyph ID 0 instead of None for format 0
    • (cmap) Possible invalid glyph mapping for format 2
    Open source →
  37. 0.8.1 29 Jul 2020
    Release notes

    Added

    • Face::is_monospaced
    • Face::italic_angle
    • Face::typographic_ascender
    • Face::typographic_descender
    • Face::typographic_line_gap
    • Face::capital_height
    Open source →
  38. 0.8.0 21 Jul 2020
    Release notes

    Added

    • Allow true magic.
    • FaceParsingError
    • NormalizedCoordinate
    • Face::variation_coordinates
    • Face::has_non_default_variation_coordinates
    • Face::glyph_name can lookup CFF names too.
    • Face::table_data
    • Face::character_mapping_subtables

    Changed

    • (CFF,CFF2) 10% faster parsing.
    • Face::from_slice returns Result now.
    • Name::platform_id returns PlatformId instead of Option<PlatformId> now.
    • The cmap module became public.

    Fixed

    • Face::width parsing.
    • Possible u32 overflow on 32-bit platforms during Face::from_slice.
    • (cmap) Face::glyph_variation_index processing when the encoding table has only one glyph.
    Open source →
  39. 0.7.0 16 Jul 2020
    Release notes

    Added

    • (CFF) CID fonts support.
    • (CFF) seac support.
    • Font::global_bounding_box

    Changed

    • Rename Font to Face, because this is what it actually is.
    • Rename Font::from_data to Font::from_slice to match serde and other libraries.
    • Rename Name::name_utf8 to Name::to_string.

    Removed

    • Font::family_name and Font::post_script_name. They were a bit confusing. Prefer:
      face.names().find(|name| name.name_id() == name_id::FULL_NAME).and_then(|name| name.to_string())
      
    Open source →
  40. 0.6.2 02 Jul 2020
    Release notes

    Added

    • Name::is_unicode
    • Font::family_name will load names with Windows Symbol encoding now.

    Fixed

    • Font::glyph_bounding_box will apply variation in case of gvar fonts.
    Open source →
  41. 0.6.1 19 May 2020
    Release notes

    Fixed

    • (kern) Support fonts that ignore the subtable size limit.
    Open source →
  42. 0.6.0 18 May 2020
    Release notes

    Added

    • sbix, CBLC, CBDT and SVG tables support.
    • Font::glyph_raster_image and Font::glyph_svg_image.
    • Font::kerning_subtables with subtable formats 0..3 support.

    Changed

    • (c-api) The library doesn't allocate ttfp_font anymore. All allocations should be handled by the caller from now.

    Removed

    • Font::glyphs_kerning. Use Font::kerning_subtables instead.
    • (c-api) ttfp_create_font and ttfp_destroy_font. Use ttfp_font_size_of + ttfp_font_init instead.
      ttfp_font *font = (ttfp_font*)alloca(ttfp_font_size_of());
      ttfp_font_init(font_data, font_data_size, 0, font);
      
    • Logging support. We haven't used it anyway.

    Fixed

    • (gvar) Integer overflow.
    • (cmap) Integer overflow during subtable format 2 parsing.
    • (CFF, CFF2) DICT number parsing.
    • Font::glyph_*_advance will return None when glyph ID is larger than the number of metrics in the table.
    • Ignore variation offset in Font::glyph_*_advance and Font::glyph_*_side_bearing when HVAR/VVAR tables are missing. Previously returned None which is incorrect.
    Open source →
  43. 0.5.0 19 Mar 2020
    Release notes

    Added

    • Variable fonts support.
    • C API.
    • gvar, CFF2, avar, fvar, HVAR, VVAR and MVAR tables support.
    • Font::variation_axes
    • Font::set_variation
    • Font::is_variable
    • Tag type.

    Fixed

    • Multiple issues due to arithmetic overflow.
    Open source →
  44. 0.4.0 24 Feb 2020
    Release notes

    A major rewrite.

    Added

    • Font::glyph_bounding_box
    • Font::glyph_name
    • Font::has_glyph_classes
    • Font::glyph_class
    • Font::glyph_mark_attachment_class
    • Font::is_mark_glyph
    • Font::glyph_y_origin
    • Font::vertical_ascender
    • Font::vertical_descender
    • Font::vertical_height
    • Font::vertical_line_gap
    • Optional log dependency.

    Changed

    • Font::outline_glyph now accepts &mut dyn OutlineBuilder and not &mut impl OutlineBuilder.
    • Font::ascender, Font::descender and Font::line_gap will check USE_TYPO_METRICS flag in OS/2 table now.
    • glyph_hor_metrics was split into glyph_hor_advance and glyph_hor_side_bearing.
    • glyph_ver_metrics was split into glyph_ver_advance and glyph_ver_side_bearing.
    • CFFError is no longer public.

    Removed

    • Error enum. All methods will return Option<T> now.
    • All unsafe.

    Fixed

    • glyph_hor_side_bearing parsing when the number of metrics is less than the total number of glyphs.
    • Multiple CFF parsing fixes. The parser is more strict now.
    Open source →
  45. 0.3.0 26 Sep 2019
    Release notes

    Added

    • no_std compatibility.

    Changed

    • The library has one unsafe block now.
    • 35% faster family_name() method.
    • 25% faster from_data() method for TrueType fonts.
    • The Name struct has a new API. Public fields became public functions and data is parsed on demand and not beforehand.
    Open source →
  46. 0.2.2 12 Aug 2019
    Release notes

    Fixed

    • Allow format 12 subtables with Unicode full repertoire in cmap.
    Open source →
  47. 0.2.1 12 Aug 2019
    Release notes

    Fixed

    • Check that cmap subtable encoding is Unicode.
    Open source →
  48. 0.2.0 10 Jul 2019
    Release notes

    Added

    • CFF support.
    • Basic kerning support.
    • All cmap subtable formats except Mixed Coverage (8) are supported.
    • Vertical metrics querying from the vmtx table.
    • OpenType fonts are allowed now.

    Changed

    • A major rewrite. TrueType tables are no longer public.
    • Use GlyphId instead of u16.

    Removed

    • GDEF table parsing.
    Open source →
  49. 0.1.0 18 Jun 2019
    Release notes

    Added

    • Initial release. Parsing of cmap, glyf, head, hhea, hmtx, loca, maxp, name, OS/2, post, vhea and vmtx, with GDEF and font-collection support.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive