View Single Post
Old 12-08-2021, 08:18 AM   #1
gingerbeardman
Zealot
gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.gingerbeardman ought to be getting tired of karma fortunes by now.
 
gingerbeardman's Avatar
 
Posts: 129
Karma: 1001024
Join Date: Apr 2010
Location: Cornwall, UK
Device: Various Sony Readers, Kobo Touch Edition, iPhone
Lightbulb Script for better relative sizing of custom fonts

Below are details of my script to generate custom CSS to make sure custom fonts all appear at around the same size when used to view books. Without this script some fonts appear much bigger than others.

I use this with PRS-650, but it probably applies to most Sony Readers and perhaps some other eReaders. Get in touch if you have an idea how it can apply to other eReaders.

It was written back in 2017 but I thought I'd revitalise it with its own thread.

source code
https://gist.github.com/gingerbeardm...afee9829828ed1

installation
Check requirements and dependencies at top of source code.

usage
Run from the command line without any arguments.

location
See attached screenshot to see the layout of the fonts folder.
Script should be alongside the folders of font families in /READER/fonts

output
One custom CSS file for each font family is written to /READER/database/system/PRSPlus/epub/

how does it work?
Using a python command line tool called font-line: I get the Ascender+Descender sum from the font metrics, and divide 1 by that number. This normalises the values to make the larger fonts smaller and smaller fonts larger. Then I just write that data into the CSS in the required format.

plugin?
Previously it had been asked if this could be a Calibre plugin but I don't think it's suited to that. Firstly: it does not operate on epub files, and secondly: it would need to be rewritten in Python (I have no interest in doing that).

see also
NimbusMod Redux font
https://www.mobileread.com/forums/sh...d.php?t=292416
Attached Thumbnails
Click image for larger version

Name:	Screen shot 2021-12-08 at 13.06.35.png
Views:	292
Size:	701.0 KB
ID:	190695  

Last edited by gingerbeardman; 12-08-2021 at 08:23 AM.
gingerbeardman is offline   Reply With Quote