Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
dothinking committed May 5, 2022
1 parent 94f9451 commit 30835d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pdf2docx/common/Element.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def pure_rotation_matrix(cls):

def __init__(self, raw:dict=None, parent=None):
''' Initialize Element and convert to the real (rotation considered) page coordinate system.'''
self.bbox = fitz.Rect()
self.bbox = fitz.Rect() # type: fitz.Rect
self._parent = parent # type: Element

# NOTE: Any coordinates provided in raw is in original page CS (without considering page rotation).
Expand Down Expand Up @@ -130,7 +130,7 @@ def union_bbox(self, e):
# --------------------------------------------
# location relationship to other Element instance
# --------------------------------------------
def contains(self, e, threshold:float=1.0):
def contains(self, e:'Element', threshold:float=1.0):
"""Whether given element is contained in this instance, with margin considered.
Args:
Expand Down
6 changes: 4 additions & 2 deletions pdf2docx/font/Fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def extract(cls, fitz_doc):
name = cls._normalized_font_name(basename)

try:
# process embedded and supported fonts (true type) only
assert ext not in ('n/a', 'ccf'), "base font or not supported font"
# supported fonts: open/true type only
# - n/a: base 14 fonts
# - cff: Adobe Compact File Format, i.e. Type 1 font
assert ext not in ('n/a', 'cff'), "base font or not supported font"

# try to get more font metrices with fonttool
tt = TTFont(BytesIO(buffer))
Expand Down

0 comments on commit 30835d0

Please sign in to comment.