fontutils
Note: A development version of this library defined
utility functions in the global namespace. These functions are
still defined by this library, but they have been deprecated.
Use the versions in FontUtils instead.
Returns a font family name that is available on this system.
The method for selecting a font is similar to that used by CSS and HTML:
The string families is a list of candidate font family names
separated by commas, and this function returns the first available entry.
For example, FontUtils.findMatchingFamily( "Bookman Old
Style,Times" ) would return Bookman Old Style if that family
was available. If not then it would return Times if that family was available.
If none of the typefaces in families is available, then defaultFamily
is returned (which may be null).
families | a string listing candidate families |
defaultFamily | an optional default to use if no family matches (may be null; if not specified will use the default body family) |
Returns the first available font family, or the default value.
Returns a list of the available font families on this system.
This will include fonts that have been successfully registered with
FontUtils.registerFontFamily or
FontUtils.registerFontFamilyFromResources.
Create a typeface family by creating fonts from font files. The files
are found by looking up the setting key using the same
Settings provider as is used for $ variables.
The value of this key must be a comma-separated list of font file
resources.
Entries after the first will use the same resource path as the first
entry if they do not include a '/' character. For example, the following
list would load a family of two fonts located in the foo/fonts
resource folder: foot/fonts/bar_regular.ttf, bar_italic.ttf.
Supported font formats include TrueType (.ttf), OpenType (.otf),
and PostScript Type 1 fonts.
The file extension used for the resource file name must be correct
for the format of the font resource, or font creation will fail.
key | the setting key containing the list of font files |
returns the font family name of the registered family
Create a typeface family directly from a list of resource files instead of
reading a list from a key. Instead of passing in a list of separate file
arguments, you can also pass in a string containing a comma-separated
list of resources as if it were the value of a font family key.
resourceFile | one or more arguments denoting location of the font files that make up the family |
returns the font family name of the registered family
Contents