Skip to content

Commit 1724754

Browse files
committed
pcf: Support vewwy big letters
When glyphs lie entirely within 127 pixels of the glyph origin, they get "compressed metrics". Otherwise, they get "uncompressed metrics". Some of the calculations for "uncompressed metrics" were wrong. This only affects extremely unusual or large point-size fonts, which is why it wasn't found initially. Testing performed: rendered the letter 'a' at 200 points from pcf.
1 parent d96e66f commit 1724754

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_bitmap_font/pcf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _read_accelerator_tables(self):
233233
format_ = self._seek_table(accelerators)
234234

235235
has_inkbounds = format_ & _PCF_ACCEL_W_INKBOUNDS
236-
compressed_metrics = False # format_ & _PCF_COMPRESSED_METRICS
236+
compressed_metrics = format_ & _PCF_COMPRESSED_METRICS
237237

238238
(
239239
no_overlap,
@@ -325,7 +325,7 @@ def load_glyphs(self, code_points):
325325
)
326326
metrics_compressed = self.tables[_PCF_METRICS].format & _PCF_COMPRESSED_METRICS
327327
first_metric_offset = (
328-
self.tables[_PCF_METRICS].offset + 6 if metrics_compressed else 8
328+
self.tables[_PCF_METRICS].offset + (6 if metrics_compressed else 8)
329329
)
330330
metrics_size = 5 if metrics_compressed else 12
331331

0 commit comments

Comments
 (0)