|
51 | 51 |
|
52 | 52 | from ._cmap import ( |
53 | 53 | build_char_map, |
54 | | - build_font_width_map, |
55 | | - compute_font_width, |
56 | | - get_actual_str_key, |
57 | 54 | ) |
58 | 55 | from ._protocols import PdfCommonDocProtocol |
59 | 56 | from ._text_extraction import ( |
@@ -1656,42 +1653,6 @@ def _debug_for_extract(self) -> str: # pragma: no cover |
1656 | 1653 | out += "No Font\n" |
1657 | 1654 | return out |
1658 | 1655 |
|
1659 | | - def _get_actual_font_widths( |
1660 | | - self, |
1661 | | - cmap: Tuple[ |
1662 | | - Union[str, Dict[int, str]], Dict[str, str], str, Optional[DictionaryObject] |
1663 | | - ], |
1664 | | - text_operands: str, |
1665 | | - font_size: float, |
1666 | | - space_width: float |
1667 | | - ) -> Tuple[float, float, float]: |
1668 | | - font_widths: float = 0 |
1669 | | - font_name: str = cmap[2] |
1670 | | - if font_name not in self._font_width_maps: |
1671 | | - if cmap[3] is None: |
1672 | | - font_width_map: Dict[Any, float] = {} |
1673 | | - space_char = " " |
1674 | | - actual_space_width: float = space_width |
1675 | | - font_width_map["default"] = actual_space_width * 2 |
1676 | | - else: |
1677 | | - space_char = get_actual_str_key(" ", cmap[0], cmap[1]) |
1678 | | - font_width_map = build_font_width_map(cmap[3], space_width * 2) |
1679 | | - actual_space_width = compute_font_width(font_width_map, space_char) |
1680 | | - if actual_space_width == 0: |
1681 | | - actual_space_width = space_width |
1682 | | - self._font_width_maps[font_name] = (font_width_map, space_char, actual_space_width) |
1683 | | - font_width_map = self._font_width_maps[font_name][0] |
1684 | | - space_char = self._font_width_maps[font_name][1] |
1685 | | - actual_space_width = self._font_width_maps[font_name][2] |
1686 | | - |
1687 | | - if text_operands: |
1688 | | - for char in text_operands: |
1689 | | - if char == space_char: |
1690 | | - font_widths += actual_space_width |
1691 | | - continue |
1692 | | - font_widths += compute_font_width(font_width_map, char) |
1693 | | - return (font_widths * font_size, space_width * font_size, font_size) |
1694 | | - |
1695 | 1656 | def _extract_text( |
1696 | 1657 | self, |
1697 | 1658 | obj: Any, |
|
0 commit comments