seumasjeltzz / LinguaeGraecaePerSeIllustrata

LGPSI: An open, expansive Greek-reading composition project
139 stars 24 forks source link

Kobo missing characters #19

Open ldutra opened 5 years ago

ldutra commented 5 years ago

Having charged lgpsi.epub in my Kobo Aura One, I realised it is nearly unusable. While it works OK in the Android ePub readers I have tried until now — Google Play Books, for instance — in Kobo most accented characters are missing. I am really clueless about this. I guess it is either the lack of a good Greek font in my device, or some character codification issue in lgpsi.epub itself. Any pointers would be welcome.

ldutra commented 5 years ago

I managed to put in title.txt:

---
lang: grc
---

But still the Kobo does not show most accented characters. Embedding SIL Gentium makes the file unreadable, even if epubcheck works nice. My best guess would be to load a suitable font in the Kobo’s fonts directory, but how to make the ePub use it, preferrably from something in title.txt?

honza commented 5 years ago

Is there a way to reproduce it in the calibre previewer by fiddling with the settings?

ldutra commented 5 years ago

I have no idea. I guess I could try an alternative reader in my Kobo, but it usually needs rebooting the device and foregoing the standard interface. For now I will keep looking for a way to ask pandoc to specify a font I have charged at the Kobo. It seems there is a YAML parameter called greekfont.

ldutra commented 5 years ago

I managed to get a working ePub in Kobo. Instead of manipulating the ePub after the fact, I used the pandoc --epub-embed-font and --css options. So, my ebook.sh reads:

pandoc --epub-embed-font=/usr/share/fonts-sil-gentiumplus/woff/GentiumPlus-R.woff --epub-embed-font=/usr/share/fonts-sil-gentiumplus/woff/GentiumPlus-I.woff --css=src/epub.css -s --toc -o docs/lgpsi.epub src/title.txt $(ls -1 src/*.md)

Obviously, this is highly specific for my system, but I guess if one knows enough about pandoc, ePub and fonts one would be able to generalise and create something more useful.

My epub.css — the first part was just the generated CSS file I conserved for good measure:

/* This defines styles and classes used in the book */
body { margin: 5%; text-align: justify; font-size: medium; }
code { font-family: monospace; }
h1 { text-align: left; }
h2 { text-align: left; }
h3 { text-align: left; }
h4 { text-align: left; }
h5 { text-align: left; }
h6 { text-align: left; }
h1.title { }
h2.author { }
h3.date { }
ol.toc { padding: 0; margin-left: 1em; }
ol.toc li { list-style-type: none; margin: 0; padding: 0; }
a.footnote-ref { vertical-align: super; }
em, em em em, em em em em em { font-style: italic;}
em em, em em em em { font-style: normal; }

@font-face {
font-family: GentiumPlus;
font-style: normal;
font-weight: normal;
src:url("../fonts/GentiumPlus-R.woff");
}
@font-face {
font-family: GentiumPlus;
font-style: italic;
font-weight: normal;
src:url("../fonts/GentiumPlus-I.woff");
}
body { font-family: "GentiumPlus"; }

Now the file contents display nicely, even if the title in the Kobo interface’s list of books still shows empty squares in place of most accented characters.

As mentioned before, I beefed up title.txt, but I guess only the lang: grc was actually necesary:

% Ἡ Ἑλληνικὴ γλῶσσα καθ᾿ αὑτὴν φωτιζόμενη
% Seumas MacDonald
% 2019-05
---
lang: grc
greekfont: GentiumPlus
---
ryanfb commented 5 years ago

There may be an issue with Unicode normalized forms here as well - I just did a test run of converting everything to Normalized Form C, and almost every line was affected (at a quick glance, there are many many instances of oxia instead of tonos). On some devices this can affect display of text as well. So maybe all the text should be normalized to NFC before conversion.

ldutra commented 5 years ago

Downloaded the latest ePub, the issue remains.

ryanfb commented 5 years ago

Can you try with the attached epub and report back? I've normalized the Markdown to NFC before converting for it (may need to unzip before copying): lgpsi.zip

ldutra commented 5 years ago

No luck yet. It seems the Kobo really has a trouble interpreting the file as it is. Incidentally, I have tried my procedure above with the latest file and failed; will try again later.

ldutra commented 4 years ago

Checked the latest ePub on the site with a new Kobo Forma, the issue remains.

ldutra commented 4 years ago

Tried latest version again, no luck.

ldutra commented 4 years ago

Yet again tried, now compiling from the current tree and after a Kobo update, no luck. Will fiddle again.

ldutra commented 4 years ago

Now I think I understand a wee bit better what is happening. For some reason my changed files above do not work anymore. I then loaded Gentium-R.ttf (not GentiumPlus-R.woff) and related files at my Kobo, and then I could read the files allright after choosing Gentium from the font menu. GentiumPlus would not even appear in the menu. So I changed my title.txt and epub.css to point to the Gentium TrueType fonts, and all is well again. I do not know how this should affect the files as published — I do not know if it is a Kobo defficiency, and if there is a more generic way of solving the issue. But now I can read LGPSI again in my Kobo, comfortably.