foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
2.87k stars 305 forks source link

[Bug & Feature Request] Supporting in-book font faces in EPUB files #1137

Open Teashrock opened 1 year ago

Teashrock commented 1 year ago

It would be great if I could do something like this in my CSS styles:

@font-face {
  font-family:"Cilcir";
  src:url("OEBPS/Fonts/Cilkurleen_Cirlxarli_E.tff");
  unicode-range:U+0021,U+0023-0024,U+0026-0027,U+002B,U+002D,U+0030-0039,U+003D,U+003F-0051,U+0053-005A,U+005C,U+0061-007A;
}

@font-face {
  font-family:"Cirlipa";
  src:url("OEBPS/Fonts/cirlxarli_liparxe_1.tff");
  unicode-range:U+0052;
}

.lineparine {
  font-family: "Cilcir", "Cirlipa";
}

Then in the book's XHTML files:

<head>
  <title>Sample text</title>
  <link rel="stylesheet" href="style.css" type="text/css"/>
</head>

<body>
  <p>The below text is in Lineparine.</p>
  <p>Fqa'd kranteerl es lineparinergeny.</p>
  <p class="lineparine">Fqa'd kranteerl es lineparinergeny.</p>
</body>

To finally get this: image The issue: But it doesn't work from the book itself. The only workaround is to open "Reading settings', then "Custom CSS Code", and finally, explicitly add the above CSS code into it. Then it works. I would be glad if it worked from the book itself.

Additional information: The above works only if I set "Styles" to "Document + User styles". Neither "Document" nor "User styles" don't work at all separately.

pjkaufman commented 11 months ago

I can concur that when Document styles are set,the styles are ignored. However when I set document plus user styles they get applied. All except my content after logic block.