Adafruit_CircuitPython_Bitm.../adafruit_bitmap_font/glyph_cache.py
2019-02-12 10:19:13 -08:00

17 lines
393 B
Python

import gc
import collections
class GlyphCache:
def __init__(self):
self._glyphs = {}
def get_glyph(self, code_point):
if code_point in self._glyphs:
return self._glyphs[code_point]
s = set()
s.add(code_point)
self._glyphs[code_point] = None
self.load_glyphs(s)
gc.collect()
return self._glyphs[code_point]