seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.43k stars 229 forks source link

font size #414

Open Jocala opened 5 years ago

Jocala commented 5 years ago

I use calibre's web interface almost always via the Kindle Paperwhite browser. I really prefer COPS as it solves many issues presented by the native caliber content server, however I find COPS size is very difficult for me to read.

I've made changes to style-base.css that help somewhat:

body {
    font-family: "Century Gothic", CenturyGothic, Geneva, AppleGothic, sans-serif;
    line-height:50px;
    color: #1c1c1c; /* Lighter on the eyes than #000 Black */
    margin: 0px; background: #cccccc; background-size: cover;
}

.container{
 background: #414141; border:1px solid #000;
    max-width:1200px;width:100%;margin:0 auto;position:relative; }

/* 768px and greater */
@media only screen and (min-width: 768px) {
h1 {font-size: 2em; line-height: 1em;}
body {  margin: 5px;
            font-size: 1.5em;/*12px/16px */
            font-weight:400; /* Better supported than 'lighter' attribute */
    }

My goal was to fill the Kindle browser's screen with a readable (to me) page. The changes above are being used with the default template. I'm not a css coder, it may be that these aren't the optimal way to achieve the desired result.

horus68 commented 5 years ago

What is the template you are using in cops when viewing with Kindler?

Side note: Maybe its best to reopen the issue as it could be an improvement to be considered for all users. Even if I'm not a CSS guy! You could also reedit your messages above and enclose the code parts with the code formatting tag.

Jocala commented 5 years ago

Done. Thanks for the comment.

Jocala commented 5 years ago

I copied style-base.css with my changes to a new file, style-kindle.css. It appeared to drop in w/o problems and seems to function w/o errors. I'm sure it could be refined.

style-kindle.css.txt

seblucas commented 5 years ago

My experience with Kindle is that the basic font size is quite different from my Kobo. but if the modification are small it is possible to include them into COPS. We can detect Kindle / Kobo with their User Agent.

Jocala commented 5 years ago

style-kindle.css.txt

 if (preg_match('/Kindle/', $_SERVER['HTTP_USER_AGENT'])) {
       $data['customHeader'] = '<style media="screen" type="text/css">
        html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>';
    }

I see you already check for Kindle in index.php. I had tried making changes to the font settings there, but it had no effect. I further refined style-kindle.css, which is attached.

seblucas commented 5 years ago

That's what I had in mind, in the current version of the hack, I reduce the font size (font-size: 75%) but you had to make it bigger, that mean that depending on models the hack has to be different.

Can you try to change it to 125% (all 3 values) and see if it helps

As I see it the main change you made is to change:

So changing the general font-size can help.

I don't think the change to container width is really that important.

Jocala commented 5 years ago

Adjusting the container width made COPS utilize the entire width of the Kindle screen, otherwise there are large borders of whitespace on either side of the display.

I've included some screenshots:

1.png: Kindle's native book list. This is more or less what I am trying to mimic.

COPS, using Kindle's experimental browser:

2.png: COPS recent additions with fonts @ 75% 3.png: COPS recent additions with fonts @ 125% 4.png: COPS recent additions with style-kindle.css

You'll notice that any changes impact the search field and graphic in the header.

1 2 3 4