From 0fd5c12fd0f11341455899aa52c0f08776203517 Mon Sep 17 00:00:00 2001 From: "aditya.chandel" Date: Mon, 30 Jun 2025 18:32:37 -0600 Subject: [PATCH] Fix font size not applying on initial load in EPUB viewer --- .../components/epub-viewer/component/epub-viewer.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts index b73deb188..03e60e539 100644 --- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts +++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.ts @@ -131,7 +131,6 @@ export class EpubViewerComponent implements OnInit, OnDestroy { body: { ...baseTheme.body, ...(this.selectedFontType ? {'font-family': this.selectedFontType} : {}), - ...(this.fontSize != null ? {'font-size': `${this.fontSize}%`} : {}), ...(this.lineHeight != null ? {'line-height': this.lineHeight} : {}), ...(this.letterSpacing != null ? {'letter-spacing': `${this.letterSpacing}em`} : {}), }, @@ -142,6 +141,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { }, }; + this.rendition.themes.override('font-size', `${this.fontSize}%`); this.rendition.themes.register('custom', combinedTheme); this.rendition.themes.select('custom'); @@ -214,7 +214,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy { updateFontSize(): void { if (this.rendition) { - this.rendition.themes.fontSize(`${this.fontSize}%`); + this.rendition.themes.override('font-size', `${this.fontSize}%`); this.updateViewerSetting(); } }