Skip to content

Commit 3265e1f

Browse files
authored
Fix: Can't override font in some epub files
1 parent fe08d6d commit 3265e1f

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2525
- Sometimes right click on reading fails [`b14a26e`](https://github.com/ollm/OpenComic/commit/1a8e145a997c67494e1a6c70c5f73acee7720000)
2626
- Avoid generating thumbnails of images that are still being extracted (Extractions with 7-Zip) [`c415b3f`](https://github.com/ollm/OpenComic/commit/c415b3f0f6eb4bd6eb1bdd6cdd8a191b809df91e)
2727
- Error attempting to open the bookmarks menu after navigating to a bookmark [`80c1b0e`](https://github.com/ollm/OpenComic/commit/80c1b0eb7ea441e1f55a86713d04fe835089ef3d)
28+
- Can't override font in some epub files
2829

2930
## [v1.3.1](https://github.com/ollm/OpenComic/releases/tag/v1.3.1) (05-10-2024)
3031

scripts/ebook.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ var ebook = function(book, config = {}) {
565565
// Apply here margin, letter space, font size, justify, etc
566566
this.applyGeneralStyle = function(head) {
567567

568-
let bodyCss = [];
568+
const allCss = [];
569+
const bodyCss = [];
569570

570571
if(this.config.colors && this.config.colors.background)
571572
{
@@ -574,16 +575,16 @@ var ebook = function(book, config = {}) {
574575
}
575576

576577
if(this.config.fontFamily)
577-
bodyCss.push('font-family: "'+this.config.fontFamily+'" !important');
578+
allCss.push('font-family: "'+this.config.fontFamily+'" !important');
578579

579580
if(this.config.fontSize > 10)
580581
bodyCss.push('font-size: '+this.config.fontSize+'px !important');
581582

582583
if(this.config.fontWeight > 0)
583-
bodyCss.push('font-weight: '+this.config.fontWeight+' !important');
584+
allCss.push('font-weight: '+this.config.fontWeight+' !important');
584585

585586
if(this.config.italic)
586-
bodyCss.push('font-style: italic !important');
587+
allCss.push('font-style: italic !important');
587588

588589
if(this.config.textAlign)
589590
bodyCss.push('text-align: '+this.config.textAlign+' !important');
@@ -592,10 +593,10 @@ var ebook = function(book, config = {}) {
592593
bodyCss.push('margin: '+this.config.margin.top+'px '+this.config.margin.right+'px '+this.config.margin.bottom+'px '+this.config.margin.left+'px !important');
593594

594595
if(this.config.letterSpacing > -0.1)
595-
bodyCss.push('letter-spacing: '+this.config.letterSpacing+'em !important');
596+
allCss.push('letter-spacing: '+this.config.letterSpacing+'em !important');
596597

597598
if(this.config.wordSpacing > -0.4)
598-
bodyCss.push('word-spacing: '+this.config.wordSpacing+'em !important');
599+
allCss.push('word-spacing: '+this.config.wordSpacing+'em !important');
599600

600601
if(this.config.lineHeight > 0.3)
601602
bodyCss.push('line-height: '+this.config.lineHeight+'em !important');
@@ -613,6 +614,7 @@ var ebook = function(book, config = {}) {
613614
614615
body * {
615616
`+(this.config.textAlign ? 'text-align: '+this.config.textAlign+' !important;' : '')+`
617+
`+(allCss.join('; '))+`
616618
}
617619
618620
body p {

0 commit comments

Comments
 (0)