Monocle setFontScale work for epub or is it only for html?

42 views
Skip to first unread message

rodolfo tuble

unread,
Jun 21, 2014, 9:08:43 AM6/21/14
to monoc...@googlegroups.com
I have tried and I was only able to achieve the result for html, but i might be doing something wrong here that's why it won't work for epub.

Also is it possible for monocle to go from fullscreen to small vice versa?

Thank you

here's my function for the setFontScale:

function onReaderLoad(rdr) {
var sSel = document.getElementById('sizeSelect');
          sSel.addEventListener('change', function (evt) {
            reader.formatting.setFontScale(parseFloat(sSel.value), true);
          });
 
var scrCtrl = new Monocle.Controls.Scrubber(rdr);
rdr.addControl(scrCtrl, 'standard', { container: 'scrubber' });
}

Ori Idan

unread,
Jun 23, 2014, 1:02:45 AM6/23/14
to monocle-js
Monocole by itself does not work on EPUB, it works on HTML only.
In order to read EPUB by monocole, you must unpack the file first to get the HTML files.
If monocole does not set the font on your EPUB files, you should check the HTML files you extracted from your EPUB.

-- 
Ori Idan CEO Helicon Books





--
You received this message because you are subscribed to the Google Groups "Monocle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rodolfo tuble

unread,
Jun 23, 2014, 7:35:52 AM6/23/14
to monoc...@googlegroups.com
I see. thank you. I was using this for my epub it was advertised at the monocle git. http://rschroll.github.io/efm/

Is it also possible to set the screensize to full screen and back to normal in monocle?

Robert Schroll

unread,
Jun 23, 2014, 4:12:20 PM6/23/14
to monoc...@googlegroups.com
On Mon, Jun 23, 2014 at 7:35 AM, rodolfo tuble <rtc...@gmail.com>
wrote:
> I see. thank you. I was using this for my epub it was advertised at
> the monocle git. http://rschroll.github.io/efm/

All EFM does is extract the HTML files from the Epub and feed them to
Monocle in the correct order. Monocle doesn't know and doesn't care
where a given HTML file is coming from. So if something isn't working
after going through one of your code paths, that means your code is
broken.

Looking at your code:
> function onReaderLoad(rdr) {
> var sSel = document.getElementById('sizeSelect');
> sSel.addEventListener('change', function (evt) {
> reader.formatting.setFontScale(parseFloat(sSel.value),
> true);
> });
>
> var scrCtrl = new Monocle.Controls.Scrubber(rdr);
> rdr.addControl(scrCtrl, 'standard', { container: 'scrubber' });
> }

This shouldn't work at all, since the variable 'reader' isn't defined.
(The Monocle.Reader object is being passed in as 'rdr'.) The only way
it could work would be if 'reader' were defined globally. I suspect
you're defining it globally in the HTML branch of your code and not in
the Epub branch.

And two weeks ago, I told you,
> In the second code path above (html files), you assign the reader to
> window.reader, so all you have to do is call
> 'window.reader.moveTo()'. In the first code path (epub files),
> you'll also need to assign the reader to window.reader for this to
> work.
(Note that in the browser's JS environment, attributes of 'window' also
show up as global variables, so 'window.reader' is the same as
'reader'.)

Robert



rodolfo tuble

unread,
Jun 30, 2014, 8:56:34 AM6/30/14
to monoc...@googlegroups.com
Hi Robert,

I was able to make it work,

I was just missing this:

window.reader = Monocle.Reader("reader", bookData, {}, onReaderLoad);

instead of this:

Monocle.Reader("reader", bookData, {}, onReaderLoad);

Thanks for the heads up

-rodolfo
Reply all
Reply to author
Forward
0 new messages