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

Set glyph widths automatically #95

Merged
merged 1 commit into from
Jul 3, 2013

Conversation

adamhooper
Copy link
Contributor

fontcustom sets every glyph width to 512.

That's a problem: a right-pointing chevron might have a width of 200, for instance; and when the glyph is set in a text-align: right; container, we'd expect it to align all the way to the right.

The solution is to let fontforge figure out glyph widths and write them to the font. This patch does the trick: notice, in generated svg fonts, the new "horiz-adv-x" entries.

This shouldn't have any dramatic negative consequences on users' existing fonts unless users are setting the wrong margins/paddings in their CSS because the icons have the wrong width. And if that's the case, it's probably better to fix this as soon as possible.

endtwist added a commit that referenced this pull request Jul 3, 2013
Set glyph widths automatically
@endtwist endtwist merged commit e019603 into FontCustom:master Jul 3, 2013
@endtwist
Copy link
Member

endtwist commented Jul 3, 2013

This looks good, thanks for submitting the pull request. I didn't know about the 'autoWidth' method. Merged and will deploy it in the next point release :)

@naltatis
Copy link

This should be an option. I am using multicolor icons by positioning two glyphs on top of each other. With autoWidth this is not really possible any more.

multi color icons

@adamhooper adamhooper deleted the horiz-adv-x branch August 15, 2013 14:06
@paljasma
Copy link

paljasma commented Sep 3, 2013

So, how this works now?
Mine still compiles the same width for 2 different widths in input .svg files.
Can't make a rectangle glyph in width, only as a square.

@zenoamaro
Copy link

Actually this seems able to produce only tall glyphs, but not long ones.

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

Successfully merging this pull request may close these issues.

5 participants