Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for enabling alternate characters/stylistic sets #478

Open
bgmort opened this issue Jun 23, 2021 · 4 comments
Open

Support for enabling alternate characters/stylistic sets #478

bgmort opened this issue Jun 23, 2021 · 4 comments

Comments

@bgmort
Copy link

bgmort commented Jun 23, 2021

I'm trying to use alternate characters in fonts (specific example: use Raleway with its more geometric and less weird stylistic alternates) for an application I'm building. I've been trying to debug why the following doesn't work:

font.forEachGlyph('wow such W', 0, 0, 24, {
  ss01: true,
})

And I finally realized that only liga and rlig are supported right now, unless I have overlooked something. What's the status of this? Is there a plan for implementing it? Is there currently any workaround (without the application having specific knowledge of the font in use)?

I'm willing to contribute as well, but not sure how to effiiciently go about acquiring the necessary base knowledge. I'm brand new to opentype, but a seasoned JS/TS developer.

Expected Behavior

font.forEachGlyph should make use of alternate characters and stylistic sets, such as a conventional geometric W in the linked example.

Current Behavior

Only the liga and rlig features are supported

Steps to Reproduce (for bugs)

This example uses makerjs to simplify the code and render to SVG, but it's a relatively simple wrapper around font.forEachGlyph.
https://codesandbox.io/s/cool-boyd-3r6ls?file=/src/index.js

Context

Wanting to provide access to stylistic alternates in a design webapp.

Your Environment

@alexkolodko
Copy link

I used SvgTextToPath library to generate design layouts. This library works with opentype.js. І will use OpenType features in CSS (tabular numbers or alternates stylistic set). But script replaces alternate symbols with the ordinary. Demo: tabular symbols "1" at the top replaced to ordinary.

Can you add support of other OT features (stylistic sets and tabular numbers)?

@Typogram
Copy link

Typogram commented Feb 11, 2023

Please support more opentype features like smcp and c2sc and others. I mean it is called opentype.js!

@ILOVEPIE
Copy link
Contributor

@Typogram if you'd like to contribute support for those, we'd be happy to accept a PR for them.

@ILOVEPIE
Copy link
Contributor

@bgmort I'd take a look at the microsoft typography documentation for the features you want implemented, that should get you started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants