opentype.js icon indicating copy to clipboard operation
opentype.js copied to clipboard

added support for friendly stylistic set names.

Open ollimeier opened this issue 2 years ago • 2 comments
trafficstars

Description

Added featureParams to get friendly stylistic set name via given nameID if given. For reference, see OT spec: https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-ss01---ss20

Motivation and Context

It's possible to give stylistc set features name name via ID. They are stored in the name table. This was not implemented into opentype.js, yet.

How Has This Been Tested?

I added unittests.

Screenshots (if appropriate):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] I did npm run test and all tests passed green (including code styling checks).
  • [x] I have added tests to cover my changes.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the README accordingly.
  • [x] I have read the CONTRIBUTING document.

ollimeier avatar Apr 16 '23 17:04 ollimeier

This will break the writing of the value in https://github.com/opentypejs/opentype.js/blob/master/src/table.js#L170 - could you implement that as well?

edit: also, the format used for feature parameters is different for each feature tag, see https://learn.microsoft.com/en-us/typography/opentype/spec/chapter2#feature-table We should implement that accordingly, so it does not only work for 'ss01' – 'ss20', but also 'cv01' – 'cv99' and 'size'

Connum avatar Oct 19 '23 10:10 Connum

I just noticed this seems to be a duplicate of #452

Connum avatar Oct 21 '23 19:10 Connum