File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -214,13 +214,13 @@ FontGlyph.prototype.appendBits = function(bits, info) {
214
214
} else {
215
215
xStart = this . fmWidth ;
216
216
xEnd = 0 ;
217
- for ( var x = 0 ; x < this . fmWidth ; x ++ ) {
218
- for ( var y = 0 ; y < this . fmHeight ; y ++ ) {
217
+ for ( var y = 0 ; y < this . fmHeight ; y ++ ) {
218
+ for ( var x = 0 ; x < this . fmWidth ; x ++ ) {
219
219
var set = glyph . getPixel ( x , y ) ;
220
220
if ( set ) {
221
221
// check X max value
222
222
if ( x < xStart ) xStart = x ;
223
- xEnd = x ;
223
+ if ( x > xEnd ) xEnd = x ;
224
224
// check Y max/min
225
225
if ( y < yStart ) yStart = y ;
226
226
if ( y > yEnd ) yEnd = y ;
@@ -236,9 +236,8 @@ FontGlyph.prototype.appendBits = function(bits, info) {
236
236
glyph . width = xEnd + 1 - xStart ;
237
237
glyph . xStart = xStart ;
238
238
glyph . xEnd = xEnd ;
239
- glyph . advance = glyph . width ;
240
- if ( xEnd < this . fmWidth - 1 )
241
- glyph . advance += this . glyphPadX ; // if not full width, add a space after
239
+ glyph . advance = glyph . xEnd + 1 ;
240
+ glyph . advance += this . glyphPadX ; // if not full width, add a space after
242
241
if ( ! this . glyphPadX ) glyph . advance ++ ; // hack - add once space of padding
243
242
244
243
if ( this . fullHeight ) {
@@ -253,6 +252,12 @@ FontGlyph.prototype.appendBits = function(bits, info) {
253
252
glyph . yEnd = yEnd ;
254
253
glyph . height = yEnd + 1 - yStart ;
255
254
255
+ /* if (ch == 41) {
256
+ glyph.debug();
257
+ console.log(glyph);
258
+ process.exit(1);
259
+ }*/
260
+
256
261
return glyph ;
257
262
} ;
258
263
You can’t perform that action at this time.
0 commit comments