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
Add a character-specific class to letters #41
Conversation
It can be useful to kern every instance of certain letter combinations. With these extra classes, you can now apply more broad css rules. For example, to consistently tighten the space between the characters "A" and "W", you could use the css rule `.char-a + .char-w { margin-left:-2px; }`
Looks pretty good. Have you put any thought into non-Latin languages? – Dave On Sep 5, 2013, at 10:18 PM, Jason Tremblay notifications@github.com wrote:
|
I hadn't thought about non-latin characters when I started tweaking. After submitting the pull request though, I went back and looked at some of the older issues and realized this enhancement idea has come up before, several times. After doing a little research, I'd say there are a few options:
I haven't tested the first option thoroughly and couldn't quickly find info about browser support for unicode in css/html, so I'm not sure if it's viable. But the second would work well enough, and I'd like to at least have that in my branch. |
Now adding classes using the encodeURIComponent() function for anything other than alphanumeric characters (or the special case of single-quote character). I stripped out the '%' from the encoded characters to keep the class names valid. For example:
I don't really like that |
Hrmmm.... Maybe |
…separate methods for legibility
… character is ampersand or double-quote
Per your suggestion, I messed around with data-char attributes. If I'm reading the spec correctly, the only characters that need special treatment are the ampersand and the double-quote. (see http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#attributes-0) The attributes get added like so:
The corresponding CSS selectors look like:
I'm wondering how compatible this is... i.e. will non-latin characters only work if the character encoding is declared -- |
Going to merge this into #45. Thanks for your original commits @alertmybanjos. Appreciate it. |
It can be useful to kern every instance of certain letter combinations. With these extra classes, you can apply broad css rules. For example, to consistently tighten the space between the characters "A" and "W" in headlines, you could use the css rule
.char-a + .char-w { margin-left:-2px; }