Skip to content

FontProvider

Sub classes

Name Children Inherits
FontAwesomeBase
pycons.font_providers.providers
Base class for all FontAwesome providers.
CommunityMaterialDesignProvider
pycons.font_providers.providers
Provider for Material Design icons.
    CodiconsProvider
    pycons.font_providers.providers
    Provider for Microsoft's Codicons.
      PhosphorProvider
      pycons.font_providers.providers
      Provider for Phosphor icons.
        RemixProvider
        pycons.font_providers.providers
        Provider for Remix icons.
          ElusiveIconsProvider
          pycons.font_providers.providers
          Provider for Elusive Icons.
            BaseGoogleMaterialSymbolsProvider
            pycons.font_providers.providers
            Base provider for Google's official Material Symbols.

            Base classes

            Name Children Inherits
            ABC
            abc
            Helper class that provides a standard way to create an ABC using

            ⋔ Inheritance diagram

            graph TD
              2987344157["base.FontProvider"]
              925645236["abc.ABC"]
              2751680898["builtins.object"]
              925645236 --> 2987344157
              2751680898 --> 925645236

            🛈 DocStrings

            Bases: ABC

            Base class for font providers.

            Source code in src/pycons/font_providers/base.py
            class FontProvider(ABC):
                """Base class for font providers."""
            
                # Override in subclasses
                NAME: ClassVar[str]
                PREFIX: ClassVar[str]
                DISPLAY_NAME: ClassVar[str]
            
                def __init__(self, use_cache: bool = True) -> None:
                    super().__init__()
                    self.use_cache = use_cache
            
                @abstractmethod
                async def get_latest_version(self) -> str:
                    """Get the latest version from the source."""
                    ...
            
                @abstractmethod
                def get_download_urls(self, version: str) -> tuple[str, str]:
                    """Get URLs for the font file and mapping.
            
                    Returns:
                        Tuple of (ttf_url, mapping_url)
                    """
                    ...
            
                @abstractmethod
                def process_mapping(self, mapping_data: bytes) -> dict[str, str]:
                    """Process the raw mapping data into a name->unicode dict.
            
                    Different fonts provide their mappings in different formats (JSON, CSS, etc).
                    This method handles the font-specific processing.
            
                    Args:
                        mapping_data: Raw bytes of the mapping file
            
                    Returns:
                        Dict mapping icon names to unicode points
                    """
                    ...
            

            get_download_urls abstractmethod

            get_download_urls(version: str) -> tuple[str, str]
            

            Get URLs for the font file and mapping.

            Returns:

            Type Description
            tuple[str, str]

            Tuple of (ttf_url, mapping_url)

            Source code in src/pycons/font_providers/base.py
            @abstractmethod
            def get_download_urls(self, version: str) -> tuple[str, str]:
                """Get URLs for the font file and mapping.
            
                Returns:
                    Tuple of (ttf_url, mapping_url)
                """
                ...
            

            get_latest_version abstractmethod async

            get_latest_version() -> str
            

            Get the latest version from the source.

            Source code in src/pycons/font_providers/base.py
            @abstractmethod
            async def get_latest_version(self) -> str:
                """Get the latest version from the source."""
                ...
            

            process_mapping abstractmethod

            process_mapping(mapping_data: bytes) -> dict[str, str]
            

            Process the raw mapping data into a name->unicode dict.

            Different fonts provide their mappings in different formats (JSON, CSS, etc). This method handles the font-specific processing.

            Parameters:

            Name Type Description Default
            mapping_data bytes

            Raw bytes of the mapping file

            required

            Returns:

            Type Description
            dict[str, str]

            Dict mapping icon names to unicode points

            Source code in src/pycons/font_providers/base.py
            @abstractmethod
            def process_mapping(self, mapping_data: bytes) -> dict[str, str]:
                """Process the raw mapping data into a name->unicode dict.
            
                Different fonts provide their mappings in different formats (JSON, CSS, etc).
                This method handles the font-specific processing.
            
                Args:
                    mapping_data: Raw bytes of the mapping file
            
                Returns:
                    Dict mapping icon names to unicode points
                """
                ...
            

            :fa-brands-github: Show source on GitHub