Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Targetting specific characters with CSS rules (shkspr.mobi)
42 points by mtlynch 4 months ago | hide | past | favorite | 7 comments


Since the article doesn't mention this, the intended use for this property is to act as a hint to the browser about what characters are supported by the font, and if the page doesn't have those characters then the browser can choose to not download the font. https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-fac...

This also mean you don't technically even need this property to achieve this, you can also recompile a font with limited glyphs, this property just makes it easier to do this with an existing font file, though of course the user would be downloading a lot of unused glyphs.


This is exactly what I was looking for a few months ago. I spent hours trying to figure it out and eventually gave up. Thanks so much for sharing this!


You can do more than individual characters, you can use ligatures to adjust combinations of characters

https://research.securitum.com/stealing-data-in-great-style-...


Can ligatures be used like regexps? Like, a letter followed by two digits should have this appearance?


https://blog.glyphdrawing.club/font-with-built-in-syntax-hig...

This write-up demonstrates that OpenType contextual alternates are pretty powerful, but not as much as regular expressions.


Love it! It's so much fun to see hacky stuff. Reminds me of the good ol' days. 'course then things were much less secure due to all the hacky stuff, but it was still FUN!


If you like this sort of thing, https://xsleaks.dev/ is a great resource




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: