bitmap2ttf icon indicating copy to clipboard operation
bitmap2ttf copied to clipboard

Space character width

Open tobia opened this issue 7 years ago • 1 comments

I'm trying to convert the Tamsyn 8x15 font (or its derivative Tamzen) for use with Sublime Text, but the resulting TTF has the space character come out the wrong size. Hard tabs line up correctly with the text, but single spaces do not:

space_width

I'm not sure whether this is a bug in the font definition, in bitmap2ttf, or in Sublime Text. Other editors don't seem to have this bug, using the same TTF file. Does anybody know how to fix it?

Edit: all metrics returned from self._load_metrics() are the same exact tuple (8, 15, 0, 8, 8, 12, 3, 0) and all SetWidth(%d) generated by convert.py have the same width (533). I really can't see what's causing this issue.

tobia avatar Sep 19 '17 09:09 tobia

The generated SVG files for space characters have empty paths (d="") and so their glyphs are zero-width:

/tmp/tmprKeQ4w/00032.svg:<svg width="500.0" height="1000"><path d="" fill="currentColor"/></svg>
/tmp/tmprKeQ4w/00160.svg:<svg width="500.0" height="1000"><path d="" fill="currentColor"/></svg>

sunaku avatar Sep 23 '17 20:09 sunaku