def getSFNTResIndices(path):
    """Determine whether a file has a 'sfnt' resource fork or not."""
    try:
        reader = ResourceReader(path)
        indices = reader.getIndices('sfnt')
        reader.close()
        return indices
    except ResourceError:
        return []
Esempio n. 2
0
def getSFNTResIndices(path):
	"""Determine whether a file has a 'sfnt' resource fork or not."""
	try:
		reader = ResourceReader(path)
		indices = reader.getIndices('sfnt')
		reader.close()
		return indices
	except ResourceError:
		return []
Esempio n. 3
0
def _getTTFontFromSuitcase(path, psFontName, searchOrder=((1, 0), (3, 1))):
    # Support for .dfont and especially "regular" suitcases is minimal,
    # and we will not raise an error when the requested font isn't found,
    # but will return None.
    rr = ResourceReader(path)
    if "sfnt" not in rr:
        return None
    for index in rr.getIndices("sfnt"):
        font = TTFont(path, lazy=True, res_name_or_index=index)
        for platID, platEncID in searchOrder:
            nameRecord = font["name"].getName(6, platID, platEncID)
            if nameRecord is not None and str(nameRecord) == psFontName:
                return font
    return None