PublicationStyleFontSet

data class PublicationStyleFontSet(val defaults: PublicationStyleFontDefaults, val fontFaces: List<PublicationStyleFontFace>, val selectors: List<PublicationStyleFontSelector> = emptyList())

NOTE: This interface is being simplified to be easier to use and will be released in an upcoming release.

Overrides the fonts used when rendering the publication.

When you specify this option, all existing fonts defined in the publication will be ignored. Note that this options is not available for all publication formats.

The following example shows how to set override the publication with custom fonts.

fontSet: {
fontFaces: [
{
family: 'CustomSerifFont',
src: customSerifFontBase64, // The whole font file serialized to a base64 string.
mediaType: MediaType.FONT_WOFF
}, {
family: 'CustomSansFont',
src: customSansFontBase64, // The whole font file serialized to a base64 string.
mediaType: MediaType.FONT_WOFF
},
],
defaults: {
fallback: 'CustomSansFont',
serif: 'CustomSerifFont'
},
selectors: [
{
selector: 'h1, h2, h3, h4, h5, h6',
family: 'CustomSerifFont'
}
]
}

If you wish to ignore the publication fonts and only use system fonts, you can use the following configuration:

fontSet: {
fontFaces: [],
defaults: {
default: 'sans-serif',
serif: 'serif',
sansSerif: 'sans-serif',
cursive: 'cursive',
fantasy: 'fantasy',
monospace: 'monospace'
},
selectors: [
{
selector: 'h1, h2, h3, h4, h5, h6',
family: 'serif'
}
]
}

Constructors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun serialize(generator: JsonGenerator)

Properties

Link copied to clipboard

NOTE: This interface is being simplified to be easier to use and will be released in an upcoming release.

Link copied to clipboard

List of all font-faces to use.

Link copied to clipboard

Lets you override font-faces based on CSS selectors. Note that this feature might not work for non-CSS based publication formats. Please refer to the relevant publication format adapter documentation.