Skip to content

Release 1.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 14 Oct 23:41
· 22 commits to main since this release

Release Note

Update get_supported_characters for Enhanced Glyph Validation in Fonts

In this release, we have significantly improved the functionality of the get_supported_characters function to provide more accurate and detailed checks for glyph availability in both TrueType and OpenType fonts. The enhancements ensure that the module can now more effectively determine whether characters are supported by the font, even considering cases where glyphs may be empty or missing.

Key Changes:

  1. Detailed Glyph Validation with RecordingPen:

    • Introduced RecordingPen from fontTools.pens.recordingPen to accurately validate glyphs in fonts, especially when dealing with complex fonts such as CFF-based OpenType fonts.
    • The RecordingPen ensures that glyphs are not just present but also contain actual drawing commands. This prevents empty or undefined glyphs from being falsely reported as valid.
  2. Enhanced TrueType and OpenType Font Support:

    • The function now supports both TrueType (glyf table) and CFF-based OpenType (CFF table) fonts.
    • For TrueType fonts, glyphs are validated by checking the numberOfContours attribute to ensure they contain outlines, while for OpenType fonts, the RecordingPen is used to verify the presence of actual path data.
  3. Optional Glyph Empty Check:

    • Added the check_glyph_empty argument, which when enabled, checks for empty glyphs to ensure that only characters with valid visual representations are returned.
    • This feature can be toggled off for performance optimization when empty glyphs are not a concern.
  4. Cache Mechanism for Supported Characters:

    • A caching mechanism is introduced for storing and retrieving previously computed supported character sets. This optimizes repeated font checks by saving the results in a JSON cache file.
    • The cache is located in a directory relative to the script path, ensuring easy management and quick access to previously validated fonts.
  5. Verbose Output for Debugging:

    • The verbose option has been enhanced to provide more granular feedback when errors occur, or when certain glyphs are missing or empty.
    • If a glyph is not found or contains no drawing commands, detailed messages are printed, helping developers identify potential font issues more easily.

This release is recommended for all users who require precise font validation in their applications, especially in environments dealing with complex fonts or high-performance requirements.

Full Changelog: 0.5.2...1.0.0