MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / measure

Method measure

assets/generate-language-tiles.py:120–124  ·  view source on GitHub ↗
(self, text, size, weight, track=TRACK)

Source from the content-addressed store, hash-verified

118 return self._by_weight[weight]
119
120 def measure(self, text, size, weight, track=TRACK):
121 ft, cmap, _, hmtx = self._font(weight)
122 scale = size / ft["head"].unitsPerEm
123 w = sum(hmtx[cmap[ord(ch)]][0] * scale + track for ch in text)
124 return w - track
125
126 def cap_height(self, size, weight):
127 ft, _, _, _ = self._font(weight)

Callers 1

centeredMethod · 0.95

Calls 2

_fontMethod · 0.95
sumFunction · 0.85

Tested by

no test coverage detected