Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Interface IPublicationStyleOptions

    Defines styling options for customizing the appearance of the rendered publication.

    Note that support for these options depends on the publication format. By default, they do not apply to fixed-layout formats (such as PDF and fixed-layout EPUB), with the exception of defaultFontFamily (see property documentation for details).

    Some of these options can be enabled for fixed-layout EPUBs by configuring IEpubReaderPublicationOptions.fixedLayoutStyleOptions.

    interface IPublicationStyleOptions {
        defaultFontFamily?:
            | "serif"
            | "sans-serif"
            | "monospace"
            | "cursive"
            | "fantasy";
        disableCssAnimations?: boolean;
        fontSet?: IPublicationStyleFontSet;
        fontSizeScaleFactor?: number;
        hyphens?: Hyphens;
        letterSpacing?: ILength;
        lineHeightScaleFactor?: number;
        pageMargins?: IRectMargins;
        palette?: IPublicationStylePalette;
        removePublicationDefinedHorizontalPageMargins?: boolean;
        textAlignment?: IPublicationStyleTextAlignmentOptions;
        typographyResetOptions?: IPublicationStyleTypographyResetOptions;
        wordSpacing?: ILength;
    }

    Properties

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

    The default font-family to use for documents that do not define a font-family. Defaults to 'serif'

    serif
    
    disableCssAnimations?: boolean

    Determines whether CSS animations and transitions should be disabled in the rendered publication.

    This option won't affect animations performed by scripts in content-documents.

    false
    

    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 these options are 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'
    }
    }
    null
    
    fontSizeScaleFactor?: number

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

    1.0
    
    hyphens?: Hyphens

    Allows overriding the hyphenation behavior of the text in the publication.

    This option determines how words should be hyphenated when text wraps across multiple lines. It maps to the CSS hyphens property. Set to null to preserve the publication's default behavior.

    null
    
    letterSpacing?: ILength

    Controls the spacing between letters.

    Positive values add spacing, while negative values reduce spacing.

    When the LengthUnit is PERCENT, the value is relative to the font-size.

    This option does not affect fixed layout documents.

    null
    
    lineHeightScaleFactor?: number

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

    1.0
    
    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.

    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 the darkest color:

    {
    backgroundLight: '#303030',
    backgroundDark: '#424242',
    foregroundLight: '#ffffffb3',
    foregroundDark: '#ffffff',
    accent: '#d48872'
    }
    null
    
    removePublicationDefinedHorizontalPageMargins?: boolean

    When this option is enabled, the horizontal page margin and padding defined in the publication CSS are removed.

    Note that this option only applies to reflowable publication content.

    false
    

    Allows overriding the text alignment used in the publication

    null
    

    Various options for removing publication defined style rules related to fonts and typography.

    IPublicationStyleTypographyResetOptions
    
    wordSpacing?: ILength

    Controls the spacing between words.

    Positive values add spacing, while negative values reduce spacing.

    When the LengthUnit is PERCENT, the value is relative to the font-size.

    This option does not affect fixed layout documents.

    null