Epub reader issues: custom font not used; font size different from .txt

smichaels

Member
Firstly, I'd like to say: thanks a lot for finally bringing epub support to Android. I've been reading Chinese books frequently on my phone/tablet recently via Pleco Reader, having converted them to plain .txt files, and proper ebook support was the one thing I was still lacking.

I noticed two small issues with the ebook reader just now:
- I have a custom font installed, and it seems that it doesn't display in the epub reader mode. Opening a .txt file works fine, but if it's an epub, the font reverts to the Android default. My guess is that the epub rendering library needs to have its default font set separately.
- The font size of epubs is definitely controlled by the "reader font size" setting, but it's offset by some amount: normal book text is much bigger in an epub than in a .txt file. My intuition is that whatever font size is used for .txt files should also be what is used for otherwise un-annotated text in epub format; this might just need to be a scaling factor inserted somewhere in the code.
 

smichaels

Member
Whoops, here's two more issues (sorry, doesn't look like I can edit my original post).
- It looks like the epub reader has a one-finger-drag-to-highlight feature which interferes with the "swipe to change pages" behavior of the typical Pleco reader. Whether or not a given one-finger swipe works to flip to the next page is kind of unpredictable, but it definitely looks like it sometimes gets caught by the epub renderer itself instead of whatever it's sitting on top of.
- I tried to enable the "volume buttons scroll" feature to get around this, but it turns out that doesn't work when reading an epub either. Possibly the "button pressed" callbacks need to be separately hooked up to the epub renderer's scroll feature.
 

mikelove

皇帝
Staff member
Thanks for the feedback.

- I have a custom font installed, and it seems that it doesn't display in the epub reader mode. Opening a .txt file works fine, but if it's an epub, the font reverts to the Android default. My guess is that the epub rendering library needs to have its default font set separately.
Actually the problem here is that laying out formatted paginated text like an EPUB requires some precise font math and we've found that with a lot of third-party fonts the math comes out wrong (due to some combination of Android's wonky font renderer and the fonts themselves having incorrect data). I suppose we could offer the option anyway and then simply tell people that it's not officially supported if their favorite font garbles their EPUBs, but I'm not sure if that's an improvement :)

- The font size of epubs is definitely controlled by the "reader font size" setting, but it's offset by some amount: normal book text is much bigger in an epub than in a .txt file. My intuition is that whatever font size is used for .txt files should also be what is used for otherwise un-annotated text in epub format; this might just need to be a scaling factor inserted somewhere in the code.
Does this happen with all EPUBs? My best guess about that one is that something in the HTML is causing the font size to scale in a way that we're not detecting / overriding.

- It looks like the epub reader has a one-finger-drag-to-highlight feature which interferes with the "swipe to change pages" behavior of the typical Pleco reader. Whether or not a given one-finger swipe works to flip to the next page is kind of unpredictable, but it definitely looks like it sometimes gets caught by the epub renderer itself instead of whatever it's sitting on top of.
That highlighting feature should be disabled entirely, so it sounds like we need to go back and figure out why Android isn't listening to us when we tell us not to enable swipe text highlighting.

- I tried to enable the "volume buttons scroll" feature to get around this, but it turns out that doesn't work when reading an epub either. Possibly the "button pressed" callbacks need to be separately hooked up to the epub renderer's scroll feature.
That one we just never bothered implementing since hardly anybody seems to use it with text files. (but might make sense to support it, yes)
 

aless

Member
I was about to open a new thread when I saw this post :) Have the same issue with custom fonts for epub files. While the standard Pleco font might be good for dictionary entries and short definitions, for long texts like novels it's rather unpleasant. It's also helpful to be able to scale the font for a better reading experience. I would be fine with the "not officially supported" option, I think it wouldn't look much worse than an epub conferted to txt with pagination, and it would retain the useful table of contents of epubs.
 

mikelove

皇帝
Staff member
We can at least do a quick survey to figure out whether a large enough % of fonts would in fact work with this to let us make that an option - it's not worth adding the checkbox if people are going to test out half a dozen fonts, find that none of them work and then give up.
 
Just reviving this thread to say that I would appreciate the option to force epubs in Pleco reader to use the custom font (that I'm accustomed to seeing in Pleco-specific ebooks), along with a suitable warning that it might not work and that one is doing this at one's own risk. At the moment I can convert ebook formats to TXT (with Markdown formatting) in Calibre (so chapters, headings, etc., are still clear), but it's nice to have chapter markings in the file, the possibility of pictures, etc. Pleco's reader on Android doesn't pick up on embedded fonts, right?

PDFs are a possibility too, of course, but I've had issues with Calibre cutting PDFs right in the middle of a line, so half the character is on one page and half on the next. Obviously that's only a problem if I'm converting to PDF myself.
 

mikelove

皇帝
Staff member
We're working towards a harmonized EPUB solution on iOS and Android now - combining the textview-instead-of-webview approach from Android with the custom-instead-of-system-supplied textview approach from iOS.

We've already got it working quite well on iOS for our 4.0 update, the main complication is going to be porting that custom textview to Android (where there isn't a nice built-in native text rendering solution like iOS' CoreText), but once that's done we should have good robust support for custom fonts and lots of other things.
 
Top