MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / Sfnt

Class Sfnt

tools/subset.py:336–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334
335# code for extracting vertical metrics from a TrueType font
336class Sfnt:
337 def __init__(self, data):
338 _, numTables, _, _, _ = struct.unpack('>IHHHH', data[:12])
339 self.tables = {}
340 for i in range(numTables):
341 tag, _, offset, length = struct.unpack(
342 '>4sIII', data[12 + 16 * i: 28 + 16 * i])
343 self.tables[tag] = data[offset: offset + length]
344
345 def hhea(self):
346 r = {}
347 d = self.tables['hhea']
348 r['Ascender'], r['Descender'], r['LineGap'] = struct.unpack(
349 '>hhh', d[4:10])
350 return r
351
352 def os2(self):
353 r = {}
354 d = self.tables['OS/2']
355 r['fsSelection'], = struct.unpack('>H', d[62:64])
356 r['sTypoAscender'], r['sTypoDescender'], r['sTypoLineGap'] = \
357 struct.unpack('>hhh', d[68:74])
358 r['usWinAscender'], r['usWinDescender'] = struct.unpack(
359 '>HH', d[74:78])
360 return r
361
362
363def set_os2(pe, name, val):

Callers 1

extract_vert_to_scriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…