Skip to content

Commit 86d7c4a

Browse files
committed
MAINT: TextAppearanceStream: Don't use _default_fonts_space_width
We need the info that is in CORE_FONT_METRICS, and that is the same information as in _default_fonts_space_width anyway. So this patch removes a bit of redundancy.
1 parent 5548f0e commit 86d7c4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pypdf/generic/_appearance_stream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
from typing import Any, Optional, Union, cast
33

4-
from .._cmap import _default_fonts_space_width, build_char_map_from_dict
4+
from .._cmap import build_char_map_from_dict
55
from .._codecs.core_fontmetrics import CORE_FONT_METRICS
66
from .._font import FontDescriptor
77
from .._utils import logger_warning
@@ -418,8 +418,8 @@ def from_text_annotation(
418418
).get_object(),
419419
)
420420
document_font_resources = document_resources.get("/Font", DictionaryObject()).get_object()
421-
# _default_fonts_space_width keys is the list of Standard fonts
422-
if font_name not in document_font_resources and font_name not in _default_fonts_space_width:
421+
# CORE_FONT_METRICS is the dict with Standard font metrics
422+
if font_name not in document_font_resources and font_name.removeprefix("/") not in CORE_FONT_METRICS:
423423
# ...or AcroForm dictionary
424424
document_resources = cast(
425425
dict[Any, Any],

0 commit comments

Comments
 (0)