MCPcopy
hub / github.com/ArtifexSoftware/pdf2docx / get

Method get

pdf2docx/font/Fonts.py:39–55  ·  view source on GitHub ↗

Get matched font by font name, or return None.

(self, font_name:str)

Source from the content-addressed store, hash-verified

37 '''Extracted fonts properties from PDF.'''
38
39 def get(self, font_name:str):
40 '''Get matched font by font name, or return None.'''
41 target = self._to_descriptor(font_name)
42
43 # 1st priority: check right the name
44 for font in self:
45 if target==font.descriptor: return font
46
47 # 2nd priority: target name is contained in font name
48 for font in self:
49 if target in font.descriptor: return font
50
51 # 3rd priority: target name contains font name
52 for font in self:
53 if font.descriptor in target: return font
54
55 return None
56
57
58 @classmethod

Callers 15

test_oneFunction · 0.80
restoreMethod · 0.80
convertMethod · 0.80
debugMethod · 0.80
tableMethod · 0.80
restoreMethod · 0.80
process_fontMethod · 0.80
restoreMethod · 0.80
_preprocess_textMethod · 0.80
createMethod · 0.80
restoreMethod · 0.80
restoreMethod · 0.80

Calls 1

_to_descriptorMethod · 0.95

Tested by 1

test_oneFunction · 0.64