View Single Post
Old 03-29-2017, 02:50 AM   #1
NikaZhenya
Junior Member
NikaZhenya began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2017
Location: MX
Device: Calibre
Question Detect when font changes in EPUB

I am trying to use or create and event listener when the user changes the font size of the EPUB in an ereader with Javascript but I haven't find the way.

What I have tried without success:

* A `resize` event listener.
* A timing event that measures the font size.
* A listener that measures the scale of the `viewport`.

In `ebook-viewer` (aka Calibre viewer) I can see in the inspector that every time I change the font size the console prints `Viewport cfi: /2/4/2/2/1:1`. I see that when `1:1` changes, it's some sort of scale in int numbers.

That is why I tried to detect the viewport scale with [this](https://tombigel.github.io/detect-zoom/) or [this](http://menacingcloud.com/source/js/F...ewportScale.js).

So I suppose it is possible only because I can see trough the inspector of `ebook-viewer`...

All the tries didn't work on iOS either.
NikaZhenya is offline   Reply With Quote