Code Monkey home page Code Monkey logo

Comments (2)

johnfactotum avatar johnfactotum commented on August 15, 2024

This happens only when a book has styles on elements other than the <body>, which is where the font overrides are set. In this case the book for some reason wraps all its contents in a <div> and sets font-family to serif, which is why it's being displayed with the default serif font.

I think this can be fixed by setting the default serif and sans-serif fonts in WebKit. This might break things, however, if, in some cases, the serif/sans-serif distinction is needed. A way to solve this would be to offer the user the option to set serif and sans-serif separately (and probably monospace, too).

That would only fix the font family, however. I'm not sure if we should also force styling using the universal selector. That might fix issues with books that hardcodes styles for no good reason, but there are cases where this would break the book's intended styling.

I think a good compromise would be:

  1. Set both default serif and sans-serif font in WebKit to the user selected font

  2. Force line-height with the * selector
    There's rarely any good reason for books to hardcode that, as far as I can see. But other properties should be left untouched
    Edit: should probably force font-size as well. If we only set these on p, it shouldn't break too many things.

  3. Offer a "use default stlying" option to disable all custom styles

from foliate.

johnfactotum avatar johnfactotum commented on August 15, 2024

This and similar cases should be fixed now. I'm a bit uneasy about using !important as this already breaks one of the books that I tested that for some reason uses p with big font-size for titles.

On balance I think this is a good compromise. 395b0b2 should fix most problems with custom styles not working.

As for a "use publisher default" setting, I'm not quite sure how that can be achieved at the moment. If anyone is interested in that or has any other styling problems, feel free to open a new issue.

from foliate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.