Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
Old 12-23-2020, 11:17 AM   #1
maraskan_user
Member
maraskan_user began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Dec 2020
Location: Germany
Device: Boox Nova 3, Galaxy Tab S6, Samsung M21
Font size rendering in Calibre Viewer vs. Editor

I notice that fonts that are defined by px or pt instead of em are rendered slightly different by the viewer and the editor.

In the attached picture, both viewer and editor were configured to use 18px as default font on a system set to 96 dpi (so 13.5pt = 18px). While the Calibre editor shows the line using a font size of 1em with the same size as the ones that were using 18px or 13.5pt, the Calibre Viewer in comparison upscales the lines that are using pt or px values by around 15%.

I was wondering what the cause might be, and which one is actually considered correct.

(I included the used epub file for reference.)
Attached Thumbnails
Click image for larger version

Name:	2020-12-23_16.59.01.651.png
Views:	193
Size:	178.6 KB
ID:	184225  
Attached Files
File Type: epub GF Tests 1 - Font Scaling.epub (2.9 KB, 168 views)
maraskan_user is offline   Reply With Quote
Old 12-23-2020, 12:00 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
in the viewer ll font sizes are converted to relative sizes to allow for text zooming. So your px size becomes an em size, which in turn is scaled by the viewers font size preference. You cannot rely on pixel perfect font sizes in ebooks. The whole point of them is that they are supposed to be reflowable, at different text sizes.
kovidgoyal is online now   Reply With Quote
Old 12-23-2020, 03:02 PM   #3
maraskan_user
Member
maraskan_user began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Dec 2020
Location: Germany
Device: Boox Nova 3, Galaxy Tab S6, Samsung M21
Hello Mr. Goyal,

thank you for your answer! I'm still somewhat confused due being new to this topic. I'm trying to grasp both Calibre's as well as KOreader's scaling and font size settings and nomenclature. I'll try to write down what I've found so far, maybe it helps some other confused soul.

There seem to be 3 factors to the equation of font sizing:
1. the DPI setting of the system. Neccessary to calculate the relationship between PX and PT values, basically PX = PT*(DPI/72).
2. a user configurable default font size for text without size specifications.
3. a user configurable arbitrary scaling factor to zoom all elements bigger and smaller

For 1, I guess the DPI value can mostly be ignored for Calibre, since it's determined by the hardware and handled automatically. KOreader has a slightly harder job, since it runs on a lot of different platforms and not always detects the system's DPI properly, so it offers a user configurable override setting for DPI that it calls "Screen DPI". ("Auto DPI" doesn't work for my Android systems...) So it needs this user override.

For 2, The setting for the default font size for text without size specifications in the Calibre Editor in Preferences->Preview Settings is called "Default Font Size", in KOreader it's called "Font Size" in the bottom menu. They both affect elements that use EM values for sizing. If a document contains text both with specified and with unspecified size, this setting determines the size ratios between them.

For 3, Calibre Editor doesn't really need a zoom factor, since it's an editor. It will just show what's there. KOreader offers a "Zoom (DPI)" setting, but weirdly it only affects EM elements, not text elements sized by PX and PT values. I need to look into this further.

In Calibre Viewer, it works differently. It offers a setting called "Font Size", which changes the default font size for text without size declarations, but it zooms rescales the size of text with PT or PX size declarations. Since there is only one setting for two jobs (default font size + zoom), something does get lost, in this case the ability to specify the size ratio between EM and PT/PX declarations.

...which caused my confusion in the first post, since I assumed that setting the "Font Size" to 18 in the Viewer would size 1em text at an effective 18px (at 96 DPI), which it does, but at the same time it resizes actual 18px text to something bigger. I'm assuming that, since 16 px is said to be the default font size used by most browsers when no font size is specified in an html document, scale everything by factor (BaseFontSize/16), which makes a lot of sense, now that I think about it.
maraskan_user is offline   Reply With Quote
Reply

Tags
dpi, rendering, scaling


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
font size problem calibre viewer, editor, content-server with non-resizing SVG text rjwse@aol.com Editor 11 03-26-2020 12:06 AM
decrease font size of viewer interface of calibre 4.2.0 Thirteen OBD Calibre 0 10-30-2019 05:39 AM
Aura H2O font size <14 2 panel rendering for pages. masterz87 Kobo Reader 6 08-24-2018 01:06 AM
Rendering/Layout problem on Viewer and Editor knstn Calibre 2 06-27-2018 12:21 PM
Calibre E-Book Viewer and ADE render ePub TD font-size differently Agama Devices 5 06-17-2011 02:44 AM


All times are GMT -4. The time now is 11:24 AM.


MobileRead.com is a privately owned, operated and funded community.