fontello / svg2ttf

SVG -> TTF font convertor
MIT License
521 stars 79 forks source link

Descent can be 0 #14

Closed nfroidure closed 10 years ago

nfroidure commented 10 years ago

I had problem with generating ttf fonts from svg font that had a descent attribute value set to 0. It is legal to have a descent velue equal to 0.

puzrin commented 10 years ago

Looks that patch should be improved. Please, post test sample, and what is wrong with it.

nfroidure commented 10 years ago

@puzrin i taken your comments in count

About tests, any SVG font with a null descent value will do the job, your an create one here : http://nfroidure.github.io/svgiconfont/. I could have add tests for the issue but it seems nothing is tested for now and i don't think it's my role to choose witch test framework should be used.

puzrin commented 10 years ago

@nfroidure i have no time to play with your app, sorry. Just post minimalistic SVG sample here as text. Tests not needed.

nfroidure commented 10 years ago

@puzrin here it is.

<?xml version="1.0" standalone="no"?> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
  <font id="iconfont" horiz-adv-x="150">
    <font-face font-family="iconfont"
      units-per-em="150" ascent="150"
      descent="0" />
    <missing-glyph horiz-adv-x="0" />
    <glyph glyph-name="arrow-down"
      unicode="&#xE008;"
      horiz-adv-x="150" d=" M75 30L120 80L30 80z" />
    <glyph glyph-name="arrow-right"
      unicode="&#xE013;"
      horiz-adv-x="150" d=" M100 75L50 120L50 30z" />
    <glyph glyph-name="arrow-up"
      unicode="&#xE014;"
      horiz-adv-x="150" d=" M75 80L120 30L30 30z" />
  </font>
</defs>
</svg>
nfroidure commented 10 years ago

By ttfing it you'll notice a y decal corresponding to the fact the ascent is change from 0 to -150

nfroidure commented 10 years ago

here goes the rollback

puzrin commented 10 years ago

By ttfing it you'll notice a y decal corresponding to the fact the ascent is change from 0 to -150

What do you mean ? Don't understand you

puzrin commented 10 years ago

Ah, ok. Can you rebase (squash all commits into one) ?

nfroidure commented 10 years ago
svg2ttf my-svg.svg font.tff

When using font.ttf, glyphs aren't well positioned.

They are upper than expected.

It is due to the fact that the ascent value of 0 is replaced by the -150 value.