- From: Johannes Mutter via GitHub <sysbot+gh@w3.org>
- Date: Mon, 19 Aug 2024 17:24:42 +0000
- To: public-css-archive@w3.org
For plaintext font styling (bold/ italic/ ...) without excessive markup, OpenType contextual alternates are another option (unlike the css highlight API this also works with `input` or `textarea`) Instead of defining syntax rules in javascript, they are defined within the font file using the [OpenType Feature File Specification](https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html). These rules enable character substitutions, such as replacing regular characters with their italic or bold variants. ([Intro into OpenType programming](https://simoncozens.github.io/fonts-and-layout/features.html)). Additionally one could use certain markup characters, e.g. markdown to annotate the plaintext with a customised font ([example](https://devpost.com/software/markdown-font), [demo](https://kuanwh.com/markdown-font/)). ![CleanShot 2024-08-19 at 19 17 32@2x](https://github.com/user-attachments/assets/42843ddf-8376-4fbd-870d-1bd6b70b63cd) This technique can be combined with Colr fonts, as demonstrated in [this example](https://x.com/argyleink/status/1824104386320290076) ([original article](https://blog.glyphdrawing.club/font-with-built-in-syntax-highlighting/)), allowing for fully featured styling and syntax highlighting without any html markup transformation. <img width="687" alt="41552" src="https://github.com/user-attachments/assets/fab0b7a1-ca5b-48e9-90b7-f88bdf8ec7a6"> With this approach, only hyperlinks would require rendering as actual DOM nodes. There are some [discussions here on hackernews regarding performance](https://news.ycombinator.com/item?id=41245159) of shifting syntax highlighting from JS to the font. … Though I would favour if `font-weight/ style/ …` would be part of css highlights. -- GitHub Notification of comment by johannesmutter Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8355#issuecomment-2297069302 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 19 August 2024 17:24:43 UTC