EpubSettings

data class EpubSettings(val pageWidth: Double = 400.0, val pageHeight: Double = 640.0, val fontSize: Double = 12.0, val margin: Double = 36.0, val fontFamily: ReaderFontFamily? = null, val lineHeightScale: Double = 1.0, val textColor: RgbColor? = null, val backgroundColor: RgbColor? = null, val justify: Boolean? = null, val usePublisherCss: Boolean = true, val layoutCacheBytes: Long = 48L * 1024 * 1024, val hyphenate: Boolean? = null, val resourceFetcher: EpubResourceFetcher? = null, val scrolled: Boolean? = null)(source)

Reader layout settings. All values in points. Change them at runtime with EpubDocument.withSettings (or the withFontSize/withPageSize/withMargin shorthands) to re-flow without re-parsing the book.

The typography overrides (font family, colors, justification, hyphenation) are applied as a reader-origin cascade layer that outranks author-important CSS: the user's explicit preference beats the publisher's stylesheet. All-default settings change nothing.

Constructors

Link copied to clipboard
constructor(pageWidth: Double = 400.0, pageHeight: Double = 640.0, fontSize: Double = 12.0, margin: Double = 36.0, fontFamily: ReaderFontFamily? = null, lineHeightScale: Double = 1.0, textColor: RgbColor? = null, backgroundColor: RgbColor? = null, justify: Boolean? = null, usePublisherCss: Boolean = true, layoutCacheBytes: Long = 48L * 1024 * 1024, hyphenate: Boolean? = null, resourceFetcher: EpubResourceFetcher? = null, scrolled: Boolean? = null)

Properties

Link copied to clipboard

Painted under everything on every page; null = no page background.

Link copied to clipboard

Force every run onto a generic family (null = publisher fonts).

Link copied to clipboard

Body font size in points; author CSS scales relative to it.

Link copied to clipboard

Hyphenation for the whole book, whatever its CSS says: true breaks long words at line ends, false never does, null follows the book's hyphens. Each chapter uses the patterns of its own language. The book is not changed.

Link copied to clipboard

true forces justify, false forces start alignment; null = as authored.

Link copied to clipboard

How much laid-out text the book keeps in memory, as an estimate in bytes.

Link copied to clipboard

Multiplies every line's height (1.0 = as authored).

Link copied to clipboard

Uniform page margin in points (reflowable books only).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Fetches the resources that the book names by an absolute https URL instead of a file in its container (EPUB 3.3, 3.6, #38). kitepdf-net ships one on a Ktor client. Null fetches nothing: a remote image takes its manifest fallback, else keeps the room its markup gives, and a remote font takes the next source of its rule. See EpubDocument.fetchRemoteResources for when the bytes count.

Link copied to clipboard

Whether a reflowable chapter scrolls instead of being cut into pages: true lays each one out as a single page as wide as pageWidth and as tall as its content, false always cuts it into pages, and null follows the book's rendition:flow (EPUB 3.3, #505). A chapter in vertical writing is always cut into pages, and a pre-paginated chapter is always one page.

Link copied to clipboard

Force all text to this color (night mode); null = as authored.

Link copied to clipboard

False drops the publisher's CSS (author rules + inline styles): UA + reader layers only.