Module

health.validators.fonts

Font validator - checks font downloads and CSS generation.

Validates:

  • Font files downloaded successfully
  • CSS generated correctly
  • Font variants match config
  • No broken font references
  • Reasonable font file sizes

Classes

FontValidator
Validates font downloads and CSS generation. Checks: - Font configuration is valid - Font files do…
5

Validates font downloads and CSS generation.

Checks:

  • Font configuration is valid
  • Font files downloaded (if fonts configured)
  • CSS generated with correct @font-face rules
  • Font file sizes are reasonable
  • No broken font references in CSS
Inherits from BaseValidator

Methods 1

validate
Run font validation checks.
2 list[CheckResult]
def validate(self, site: Site, build_context: BuildContext | Any | None = None) -> list[CheckResult]

Run font validation checks.

Parameters 2
site Site
build_context BuildContext | Any | None
Returns

list[CheckResult]

Internal Methods 4
_check_font_files
Check font files are downloaded.
2 list[CheckResult]
def _check_font_files(self, fonts_dir: Path, font_config: dict[str, Any]) -> list[CheckResult]

Check font files are downloaded.

Parameters 2
fonts_dir Path
font_config dict[str, Any]
Returns

list[CheckResult]

_check_font_css
Check font CSS structure and references.
2 list[CheckResult]
def _check_font_css(self, fonts_css_path: Path, fonts_dir: Path) -> list[CheckResult]

Check font CSS structure and references.

Parameters 2
fonts_css_path Path
fonts_dir Path
Returns

list[CheckResult]

_check_font_references
Check if font files referenced in CSS exist.
2 list[str]
def _check_font_references(self, css_content: str, fonts_dir: Path) -> list[str]

Check if font files referenced in CSS exist.

Parameters 2
css_content str
fonts_dir Path
Returns

list[str]

_check_font_sizes
Check font file sizes are reasonable.
1 list[CheckResult]
def _check_font_sizes(self, fonts_dir: Path) -> list[CheckResult]

Check font file sizes are reasonable.

Parameters 1
fonts_dir Path
Returns

list[CheckResult]