Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows you to set styling options of the rendered publication.

Note that support depends on the publication format. Fixed-layout formats such as PDF and fixed-layout EPUB will by default NOT be affected by these options, with the exception of defaultFontFamily (see defaultFontFamily documentation). Some of these options can be enabled for fixed-layout EPUBs by setting IEpubReaderPublicationOptions.fixedLayoutStyleOptions.

Hierarchy

  • IPublicationStyleOptions

Index

Properties

Optional defaultFontFamily

defaultFontFamily?: "serif" | "sans-serif" | "monospace" | "cursive" | "fantasy"

The default font-family to use for documents that has does not defined a font-family. Defaults to 'serif'

default

serif

Optional fontSet

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: customSerifFontBuffer,
mediaType: MediaType.FONT_WOFF
}, {
family: 'CustomSansFont',
src: customSansFontBuffer,
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: {
fallback: 'sans-serif',
serif: 'serif',
sansSerif: 'sans-serif',
cursive: 'cursive',
fantasy: 'fantasy',
monospace: 'monospace'
}
}
default

null

Optional fontSizeScaleFactor

fontSizeScaleFactor?: number

Applies font-size scaling to the rendered publication. This is typically only supported on reflowable content documents and ignored otherwise.

double
default

1.0

Optional lineHeightScaleFactor

lineHeightScaleFactor?: number

Applies line-height scaling to the rendered publication. This is typically only supported on reflowable content documents and ignored otherwise.

double
default

1.0

Optional pageMargins

pageMargins?: IRectMargins

Sets the individual page margins. This is typically only supported on reflowable content documents and ignored otherwise.

Defaults to 6% for each side.

nodefault

Optional palette

Allows you to override the palette used for rendering the publication.

This is done by mapping background colors and foreground colors to new values.

The colors must be specified as HEX color strings: #RGB (#090) #RGBA (#090a) #RRGGBB (#009900) #RRGGBBAA (#009900aa)

The following example palette displays publications in night mode. As we are "inverting" colors we map the lightest original color to darkest color:

{
backgroundLight: '#303030',
backgroundDark: '#424242',
foregroundLight: '#ffffffb3',
foregroundDark: '#ffffff',
accent: '#d48872'
}
default

null

Optional textAlignment

Allows overriding the text alignment used in the publication

default

null

Generated using TypeDoc