buggins / coolreader

Official site of CoolReader project. Sourceforge repository is obsolete.
GNU General Public License v2.0
381 stars 100 forks source link

CSS property not applied: `font-variant-numeric: oldstyle-nums` #294

Open efermi opened 3 years ago

efermi commented 3 years ago

The property is being used in the core CSS of standardebooks.org epubs, see for example https://standardebooks.org/ebooks/p-g-wodehouse/jeeves-stories, and it is not applied to the rendered text even if the font supports oldstyle-nums. I'm not familiar with the project and therefore the following assumption may be wrong, but a search reveals that the feature should be supported given that font-variant: small-caps found nearby is being properly rendered. Here pictured in comparison cr3 (left) and ebook-viewer of calibre which renders oldstyle-nums as intended: Screenshot_20210525_000640 1915 and 1925 -- oldstyle numerals, P. G. Wodehouse and Standard Ebooks project -- small capitals.

poire-z commented 3 years ago

It is supported (there might be a few caveats with inheritance, but they shouldn't trigger in the case of this book) https://github.com/koreader/koreader/issues/5821#issuecomment-600225376

The issue with this book is that our CSS parser is confused by some stuff at the start of epub/css/core.css, which makes it skip the first declaration (bug https://github.com/koreader/koreader/issues/7199):

@charset "utf-8";
@namespace epub "http://www.idpf.org/2007/ops";  /* this is what we don't handle well */

dummy {}  /* add a first dummy declaration and the next one works */
body{
        font-variant-numeric: oldstyle-nums;
        hyphens: auto;
            color: blue; /* just to be sure it applies */
        -epub-hyphens: auto;
}
efermi commented 3 years ago

I see. Should this issue be closed then in favor of the linked koreader bug?

poire-z commented 3 years ago

@virxkane : I'm working on this CSS parsing issue (https://github.com/buggins/coolreader/issues/294#issuecomment-847877805) - so you don't need to (seeing you're browsing all the issues here, you might get the idea to go at it :)

virxkane commented 3 years ago

I'm working on this CSS parsing issue (#294 (comment)) - so you don't need to

Ok. But, I was not going to :)