Skip to content

models

Class info

Classes

Name Children Inherits
FontInfo
pycons.font_providers.models
Information about a font package.
    Icon
    pycons.font_providers.models
    Represents a font icon with all its context.

      🛈 DocStrings

      Models.

      FontInfo dataclass

      Information about a font package.

      Source code in src/pycons/font_providers/models.py
      @dataclass
      class FontInfo:
          """Information about a font package."""
      
          name: str  # e.g. "fontawesome"
          prefix: str  # e.g. "fa"
          display_name: str  # e.g. "Font Awesome 6 Free Regular"
          current_version: str  # e.g. "6.7.2"
          ttf_path: Path  # Path to the downloaded TTF file
          mapping_path: Path  # Path to the downloaded mapping file
      

      Icon dataclass

      Represents a font icon with all its context.

      Source code in src/pycons/font_providers/models.py
      @dataclass
      class Icon:
          """Represents a font icon with all its context."""
      
          character: str  # The actual Unicode character
          provider: str  # The provider name (e.g. "fontawesome-regular")
          prefix: str  # The provider prefix (e.g. "fa")
          name: str  # The icon name (e.g. "home")
          ttf_path: Path  # Path to the font file
      
          @property
          def css_class(self) -> str:
              """CSS class to use for this icon."""
              return f"icon-{self.prefix}"
      
          @property
          def font_family(self) -> str:
              """Font family name for CSS."""
              # This might need to be mapped from provider to actual font family name
              return self.provider
      

      css_class property

      css_class: str
      

      CSS class to use for this icon.

      font_family property

      font_family: str
      

      Font family name for CSS.