mcfonts.providers.reference
¶
A reference provider, including other fonts.
Module Contents¶
Classes¶
The |
Attributes¶
A UnionType that does not include |
|
- mcfonts.providers.reference.AnyProviderNotReference¶
A UnionType that does not include
ReferenceProvider
.
- mcfonts.providers.reference.PROVIDER_SHORTCUT_MAP : dict[type[AnyProviderNotReference], str]¶
- class mcfonts.providers.reference.ReferenceProvider(provider, origin, children)¶
Bases:
mcfonts.providers.base.Provider
The
reference
provider is used to include and load another font only once.It has one field,
id
, which points to a font JSON to include. If more than 1 reference provider points to the same font JSON, it will be ignored.Construct a Provider base class.
- Parameters:¶
- provider_type
A string of the value in the JSON "type" field.
- origin : os.PathLike[str] | str¶
The absolute path to the provider's JSON file.
- chars_covered
A set of the individual characters covered by this provider.
- provider : mcfonts.utils.types.TypedProviderReference¶
- children : list[AnyProviderNotReference]¶
- construct_glyphs()¶
Yield a tuple of (character, glyph) for every glyph available in the provider's resource.
Some glyphs may be empty or have no content.
- Returns:¶
A yield of
(character, Glyph)
, or None if there are no glyphs.- Return type:¶
collections.abc.Iterable[tuple[str, mcfonts.glyphs.Glyph]]
- get_contents()¶
Return the contents of the provider.
- get_icon()¶
Return a Unicode character that can be used to represent this provider in shorthand descriptions.
- get_pack_versions()¶
Return a tuple of the minimum and maximum pack versions for which this provider is valid.
The first element is guaranteed to be an integer. There will always be a minimum version, even if it's 0. The second element may be an integer, or None. If it is None, there is no maximum version bound.
- pretty_print()¶
Return a short one line description of the provider.
- validate()¶
Specific tests for validating a provider.
This function checks values to ensure that they're correct and in an acceptable range.
If applicable, textures are checked to ensure all characters have a defined glyph, and that the dimensions are correct.
Warnings are printed through
mcfonts.logger.warning()
.
- yield_characters()¶
Yield strings of the individual characters this provider supports.
- yield_children()¶
Yield all the providers that this reference provider is referring to.
- yield_glyphs()¶
Yield a tuple of (character, glyph) for every glyph available in the provider's resource.
This is different from
construct_glyphs()
because it yields glyphs that have already been constructed and stored.- Returns:¶
A yield of
(character, Glyph)
.- Return type:¶
collections.abc.Iterable[tuple[str, mcfonts.glyphs.Glyph | None]]
- yield_glyphs_in_unirange(unirange_notation)¶
Given unirange_notation, return a dictionary of the requested characters to their glyphs.
- Parameters:¶
- unirange_notation : str¶
A string representing the requested range of chars. See https://pypi.org/project/unirange/.
- Returns:¶
A yield of the requested glyphs that match unirange_notation.
- Return type:¶
collections.abc.Iterable[tuple[str, mcfonts.glyphs.Glyph | None]]