def _check_font_configuration(font_config):  # pragma: no cover
    """Check whether the given font_config has fonts.

    The default fontconfig configuration file may be missing (particularly
    on Windows or macOS, where installation of fontconfig isn't as
    standardized as on Linux), resulting in "Fontconfig error: Cannot load
    default config file".

    Fontconfig tries to retrieve the system fonts as fallback, which may or
    may not work, especially on macOS, where fonts can be installed at
    various loactions. On Windows (at least since fontconfig 2.13) the
    fallback seems to work.

    If there’s no default configuration and the system fonts fallback
    fails, or if the configuration file exists but doesn’t provide fonts,
    output will be ugly.

    If you happen to have no fonts and an HTML document without a valid
    @font-face, all letters turn into rectangles.

    If you happen to have an HTML document with at least one valid
    @font-face, all text is styled with that font.

    On Windows and macOS we can cause Pango to use native font rendering
    instead of rendering fonts with FreeType. But then we must do without
    @font-face. Expect other missing features and ugly output.

    """
    # Having fonts means: fontconfig's config file returns fonts or
    # fontconfig managed to retrieve system fallback-fonts. On Windows the
    # fallback stragegy seems to work since fontconfig >= 2.13.
    fonts = fontconfig.FcConfigGetFonts(font_config, fontconfig.FcSetSystem)
    # Of course, with nfont == 1 the user wont be happy, too…
    if fonts.nfont > 0:
        return

    # Find the reason why we have no fonts.
    config_files = fontconfig.FcConfigGetConfigFiles(font_config)
    config_file = fontconfig.FcStrListNext(config_files)
    if config_file == ffi.NULL:
        warn('FontConfig cannot load default config file. Expect ugly output.')
    else:
        # Useless config file, or indeed no fonts.
        warn('No fonts configured in FontConfig. Expect ugly output.')
Check whether the given font_config has fonts.

The default fontconfig configuration file may be missing (particularly
on Windows or macOS, where installation of fontconfig isn't as
standardized as on Linux), resulting in "Fontconfig error: Cannot load
default config file".

Fontconfig tries to retrieve the system fonts as fallback, which may or
may not work, especially on macOS, where fonts can be installed at
various loactions. On Windows (at least since fontconfig 2.13) the
fallback seems to work.

If there’s no default configuration and the system fonts fallback
fails, or if the configuration file exists but doesn’t provide fonts,
output will be ugly.

If you happen to have no fonts and an HTML document without a valid
@font-face, all letters turn into rectangles.

If you happen to have an HTML document with at least one valid
@font-face, all text is styled with that font.

On Windows and macOS we can cause Pango to use native font rendering
instead of rendering fonts with FreeType. But then we must do without
@font-face. Expect other missing features and ugly output.
weasyprint/text/fonts.py