OSDN Git Service

When using the median advance to compute the tile size, round the width to the neares...
authorEric Branlund <ebranlund@fastmail.com>
Sat, 3 Apr 2021 02:09:03 +0000 (19:09 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Sat, 3 Apr 2021 02:09:03 +0000 (19:09 -0700)
src/main-cocoa.m

index 4f016d2..75bc116 100644 (file)
@@ -2341,10 +2341,15 @@ static int compare_advances(const void *ap, const void *bp)
     }
 
     /*
-     * Record the tile size.  Round both values up to have tile boundaries
-     * match pixel boundaries.
+     * Record the tile size.  Round the values (height rounded up; width to
+     * nearest unless that would be zero) to have tile boundaries match pixel
+     * boundaries.
      */
-    self->_tileSize.width = ceil(medianAdvance);
+    if (medianAdvance < 1.0) {
+       self->_tileSize.width = 1.0;
+    } else {
+       self->_tileSize.width = floor(medianAdvance + 0.5);
+    }
     self->_tileSize.height = ceil(self.fontAscender - self.fontDescender);
 
     /*