"""
This type stub file was generated by pyright.
"""

import functools

"""
A class representing a Type 1 font.

This version reads pfa and pfb files and splits them for embedding in
pdf files. It also supports SlantFont and ExtendFont transformations,
similarly to pdfTeX and friends. There is no support yet for subsetting.

Usage::

    font = Type1Font(filename)
    clear_part, encrypted_part, finale = font.parts
    slanted_font = font.transform({'slant': 0.167})
    extended_font = font.transform({'extend': 1.2})

Sources:

* Adobe Technical Note #5040, Supporting Downloadable PostScript
  Language Fonts.

* Adobe Type 1 Font Format, Adobe Systems Incorporated, third printing,
  v1.1, 1993. ISBN 0-201-57044-0.
"""
_log = ...
class _Token:
    """
    A token in a PostScript stream.

    Attributes
    ----------
    pos : int
        Position, i.e. offset from the beginning of the data.
    raw : str
        Raw text of the token.
    kind : str
        Description of the token (for debugging or testing).
    """
    __slots__ = ...
    kind = ...
    def __init__(self, pos, raw) -> None:
        ...
    
    def __str__(self) -> str:
        ...
    
    def endpos(self):
        """Position one past the end of the token"""
        ...
    
    def is_keyword(self, *names): # -> Literal[False]:
        """Is this a name token with one of the names?"""
        ...
    
    def is_slash_name(self): # -> Literal[False]:
        """Is this a name token that starts with a slash?"""
        ...
    
    def is_delim(self): # -> Literal[False]:
        """Is this a delimiter token?"""
        ...
    
    def is_number(self): # -> Literal[False]:
        """Is this a number token?"""
        ...
    
    def value(self): # -> Unknown:
        ...
    


class _NameToken(_Token):
    kind = ...
    def is_slash_name(self):
        ...
    
    def value(self):
        ...
    


class _BooleanToken(_Token):
    kind = ...
    def value(self):
        ...
    


class _KeywordToken(_Token):
    kind = ...
    def is_keyword(self, *names): # -> bool:
        ...
    


class _DelimiterToken(_Token):
    kind = ...
    def is_delim(self): # -> Literal[True]:
        ...
    
    def opposite(self): # -> str:
        ...
    


class _WhitespaceToken(_Token):
    kind = ...


class _StringToken(_Token):
    kind = ...
    _escapes_re = ...
    _replacements = ...
    _ws_re = ...
    @functools.lru_cache
    def value(self): # -> str | bytes:
        ...
    


class _BinaryToken(_Token):
    kind = ...
    def value(self):
        ...
    


class _NumberToken(_Token):
    kind = ...
    def is_number(self): # -> Literal[True]:
        ...
    
    def value(self): # -> int | float:
        ...
    


class _BalancedExpression(_Token):
    ...


class Type1Font:
    """
    A class representing a Type-1 font, for use by backends.

    Attributes
    ----------
    parts : tuple
        A 3-tuple of the cleartext part, the encrypted part, and the finale of
        zeros.

    decrypted : bytes
        The decrypted form of ``parts[1]``.

    prop : dict[str, Any]
        A dictionary of font properties. Noteworthy keys include:

        - FontName: PostScript name of the font
        - Encoding: dict from numeric codes to glyph names
        - FontMatrix: bytes object encoding a matrix
        - UniqueID: optional font identifier, dropped when modifying the font
        - CharStrings: dict from glyph names to byte code
        - Subrs: array of byte code subroutines
        - OtherSubrs: bytes object encoding some PostScript code
    """
    __slots__ = ...
    def __init__(self, input) -> None:
        """
        Initialize a Type-1 font.

        Parameters
        ----------
        input : str or 3-tuple
            Either a pfb file name, or a 3-tuple of already-decoded Type-1
            font `~.Type1Font.parts`.
        """
        ...
    
    def transform(self, effects): # -> Type1Font:
        """
        Return a new font that is slanted and/or extended.

        Parameters
        ----------
        effects : dict
            A dict with optional entries:

            - 'slant' : float, default: 0
                Tangent of the angle that the font is to be slanted to the
                right. Negative values slant to the left.
            - 'extend' : float, default: 1
                Scaling factor for the font width. Values less than 1 condense
                the glyphs.

        Returns
        -------
        `Type1Font`
        """
        ...
    


_StandardEncoding = ...
