8000 [css-text] Glyph substitution · Issue #8545 · w3c/csswg-drafts · GitHub 8000
[go: up one dir, main page]

Skip to content

[css-text] Glyph substitution #8545

@romainmenke

Description

@romainmenke

Recently ran into several similar issues:

  • A project where the branding/client liked the visual appearance of Æ, when the actual text content should have been ae.
  • A project where a single character from the brand name was omitted and a space was rendered : f o, when the actual text content should have been foo.

When solving this with actual character replacements we are creating problems for accessibility, SEO, how text breaks and wraps,...

Content editors also find it hard to consistently apply the "special" notation.

The alternative is to solve this in font files with glyph substitutions.
This works really well and avoids all the issues mentioned above.

But adding custom substitutions is technically complex and not always feasible depending on the font file formats. (or impossible with hosted fonts, like google fonts)
It is not something that can be easily and quickly done by a frontend/css developer.


This made me wonder if this could be solved with CSS?

  • Is this something that is useful for more people than just me?
  • Is this implementable?

Syntax might require an at rule to be able to set and reuse multiple properties.
I imagine this also makes it possible to optimize things in implementations when these substitutions are globally defined.

@glyph-substitution Æ_as_ligature_for_a_e {
  type: ligature;
  substitute: a e;
  by: Æ;
}

@font-face {
  font-family: 'Some Font';
  /* regular descriptors for some font face */
  
  glyph-substitution: Æ_as_ligature_for_a_e;
}

.foo {
  font-family: 'Some Font';
}

every name/keyword is made up, I haven't done enough reading on this to suggest meaningful naming here


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0