Skip to content

Missing Implementation of GSUB Table in php-font-lib #149

@jonte-farn

Description

@jonte-farn

It seems like the php-font-lib library doesn't currently have support for the GSUB (Glyph Substitution) table. The GSUB table is crucial for working with advanced OpenType font features, such as ligatures. When trying to access the GSUB table, I am receiving NULL as a result when using $font->getData('GSUB').

Since the GSUB table is necessary for features like ligatures, it would be very useful to have an implementation that allows access to these substitution rules.

Steps to Reproduce:

  • Load a font with ligatures or OpenType features.
  • Attempt to retrieve the GSUB table using $font->getData('GSUB').
  • The result returned is NULL, indicating that the GSUB table is not available or not supported.

Expected Behavior:
It would be ideal if the library could correctly parse and return the data from the GSUB table, allowing me to work with features like ligatures. Accessing $font->getData('GSUB') should return the relevant data structure rather than NULL.

Possible Solution:
Although I'm not fully certain of the exact implementation details, adding support for parsing the GSUB table would likely involve extending the Table class. I noticed that src/FontLib/Table/Type does non contain a GSUB.php while cmap.php does exist.

Additional Context:
This feature is important for a project I'm working on that requires working with OpenType features like ligatures. Without access to the GSUB table, it becomes difficult to manipulate these font features.

// Example code to demonstrate the issue
$font = Font::load($font_file); // Assuming a font_file is specified
$gsubData = $font->getData('GSUB'); // Returns NULL instead of the GSUB table data

Version Information:
php-font-lib version: ^1.0
PHP version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions