[Okular-devel] Review Request 111554: SVG support for Epubs

Jaydeep Solanki jaydp17 at gmail.com
Fri Jul 19 20:46:10 UTC 2013



> On July 18, 2013, 2:31 p.m., Albert Astals Cid wrote:
> > generators/epub/converter.cpp, line 220
> > <http://git.reviewboard.kde.org/r/111554/diff/1/?file=171295#file171295line220>
> >
> >     Where does this 718/560 come from?
> 
> Jaydeep Solanki wrote:
>     Width of a page is 600, and as we are having a padding of 20px around a page, it gives 560(600 - 20[left] - 20[right]).
>     Similarly in the case of height, we have a page of size 800 leaving the padding we get 760.
>     A page break is inserted after a page delimiter(PD) is encountered. A PD also takes up some space, so if we just count the paddings & the size of the content then including the PD will exceed a page's size & the second page will contain PD + page break, which makes it a blank page.
>     So, to fit all that in a single page, I made it 718 (800 - 20[top] - 20[bottom] - height of PD).
>     
>     I found the height of PD, with some trial & error.
> 
> Albert Astals Cid wrote:
>     it'd be cool if we could have some static conts int around for those values.
>     
>     Also, can you check where that PD value comes from? Maybe it depends on the style you are using and thus we should query it using QStyle?

Regarding PD value, we can get height of a line, using

    mTextDocument->documentLayout()->blockBoundingRect(mTextDocument->find(magicString).block()).height();

but it gives the height of only the text, which doesn't include height of upper & lower padding.
What I found using trial & error was 42, what the above code returns is 15.

What we need is the area highlighted in the below image,
http://db.tt/DyPBbTvK


- Jaydeep


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111554/#review36121
-----------------------------------------------------------


On July 19, 2013, 8:29 p.m., Jaydeep Solanki wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111554/
> -----------------------------------------------------------
> 
> (Updated July 19, 2013, 8:29 p.m.)
> 
> 
> Review request for Okular.
> 
> 
> Description
> -------
> 
> Epubs use the below syntax to load svg images
> 
> <svg>
> <image width="592" height="900" xlink:href="images/cover.svg" />
> </svg>
> 
> I just replace that with <img> tags & add QImage as a resource.
> 
> 
> Diffs
> -----
> 
>   generators/epub/CMakeLists.txt 9442f61 
>   generators/epub/converter.cpp 74df151 
>   generators/epub/epubdocument.h 714ede6 
> 
> Diff: http://git.reviewboard.kde.org/r/111554/diff/
> 
> 
> Testing
> -------
> 
> The below link contains two epub files having svg images as cover.
> https://www.dropbox.com/sh/xcqfwn8khbqac0d/vDRuFRw9vq
> 
> 
> Thanks,
> 
> Jaydeep Solanki
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20130719/2e9e4cee/attachment.html>


More information about the Okular-devel mailing list