Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-25-2020, 05:52 AM   #1
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 291
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
font size problem calibre viewer, editor, content-server with non-resizing SVG text

[code]
<p>Normally, text resizes when you increase/decrease font. Normally, as you increase/decrease the viewing window text will NOT resize but will reflow. Text will reflow and not resize if you change the number of columns on screen.</p>

<p>By adding an SVG wrapper to some text you prevent that text from reflowing. It will conform to its viewBox. It now shrinks and grows just like an image. If you view with, say, five columns, the image and SVG text are tiny. If you view it in, say, two columns, the image and SVG text is large.</p>

<ol style="border: 1px black solid; border-radius:10px; background-color:gray; padding: .25em; ">

<svg xmlns="http://www.w3.org/2000/svg" preserve="" aspectratio="xMinYMin" viewBox="0 0 100 65">
<foreignObject width="100" height="100" >
<div xmlns="http://www.w3.org/1999/xhtml" style="font-size:.1em">By adding an SVG wrapper to some text you prevent that text from reflowing. It will conform to its viewBox. It now shrinks and grows just like an image. If you view with, say, five columns, the image and SVG text are tiny. If you view it in, say, two columns, the image and SVG text is large.</div>
</foreignObject>
</svg>

</ol>

<p style="background-color:khaki">OL wrapper around SVG-nonresizing-text. The OL wrapper has a gray background-color, 1px border, border-radius of 10px, and .25em padding.</p>

<p style="background-color: pink">This same behavior can be achieved by converting the text to an image. You would do this by screen-shot and saving the text so captured as a .png file. The disadvantage of doing this keeps the text letters from being crisp. Nor is that kind of text searchable because it is no longer real text, just a pattern of dots.</p>

<p>There is a disparity between calibre's editor viewer, calibre's regular viewer, and calibre's content server viewer regarding the SVG's font-size. By trial and error, I set font-size to 1/10th em. It shows full-size in calibre's editor viewer, correctly in the regular viewer, and way-too-small in the content server viewer. I cannot account for it.</p>
[code]

best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-03-25 04-44-41.png
Views:	249
Size:	372.9 KB
ID:	177895   Click image for larger version

Name:	Screenshot from 2020-03-25 04-44-32.png
Views:	229
Size:	312.7 KB
ID:	177896   Click image for larger version

Name:	Screenshot from 2020-03-25 04-43-45.png
Views:	212
Size:	234.5 KB
ID:	177897  
rjwse@aol.com is online now   Reply With Quote
Old 03-25-2020, 08:58 AM   #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: 44,108
Karma: 22669824
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Why are you putting text inside SVG??
kovidgoyal is offline   Reply With Quote
Advert
Old 03-25-2020, 09:20 AM   #3
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 291
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
Probably I was too verbose in my explanation. The screenshots show the purpose, that font-size is "contained by size" within a container, in this case OL. I want to constrain text in the same manner that images are constrained. The text decreases and increases in the same manner as images. Normally, a caption below an image reflows as needed. Normally, an image caption responds differently than the image. I am enclosing an example with (1) normal captions, (2) SVG caption, and image, all surrounded by an OL colored frame. The 1/10th EM font size is something I cannot figure out. It works for regular calibre viewer, but fails with content server viewer. I do not know javascript, but suspect there is an alternate way of constraining text to container. VW works for the entire screen, but fails at columns. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-03-25 08-17-16.png
Views:	218
Size:	770.3 KB
ID:	177899   Click image for larger version

Name:	Screenshot from 2020-03-25 08-17-06.png
Views:	199
Size:	658.9 KB
ID:	177900   Click image for larger version

Name:	Screenshot from 2020-03-25 08-16-55.png
Views:	197
Size:	491.8 KB
ID:	177901  
rjwse@aol.com is online now   Reply With Quote
Old 03-25-2020, 09:23 AM   #4
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: 44,108
Karma: 22669824
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
my question was more why do you want to do this at all?? It means your text will become unreadably large on large screens or unreadably small on small ones. The whole point of ebooks is that text reflows and so works to remain legible at a variety of screen sizes.
kovidgoyal is offline   Reply With Quote
Old 03-25-2020, 09:46 AM   #5
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 291
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
I can think of many reasons. It is for style purposes and who can second-guess the intent of design? It jumps out. Since this is not generally available we do not miss it and cannot conceive what good it is. I take Faraday's position (see below). I was looking at how to partially cover a corner of an image with a caption, but when I shrunk the image the caption covered more and more of the image. I looked online to search and over the years many people have sought to no avail a method for constraining text to container. Mainly, I am doing it for fun and to learn. Remember 'The Mouse and the Lion'? I'm the mouse. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-03-25 08-42-19.png
Views:	189
Size:	484.7 KB
ID:	177903   Click image for larger version

Name:	Screenshot from 2020-03-25 08-38-43.png
Views:	192
Size:	102.6 KB
ID:	177904   Click image for larger version

Name:	Screenshot from 2020-03-25 08-38-31.png
Views:	192
Size:	579.9 KB
ID:	177905  
rjwse@aol.com is online now   Reply With Quote
Advert
Old 03-25-2020, 10:11 AM   #6
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: 44,108
Karma: 22669824
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You are going to run into a lot of trouble with text in svg, best to avoid it.
kovidgoyal is offline   Reply With Quote
Old 03-25-2020, 10:45 AM   #7
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 291
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
I reluctantly agree. I tried it in other epub readers and it does not work. It works flawlessly in the calibre reader (but not the calibre content server reader). Can I beg your indulgence once more? Is there a simple way to do this with a short internal javascript? This is actually a dandy feature. Text never gets too small as it is limited to the image's smallest usable size, even at six columns. And It never gets too big as it is limited to the image's largest usable size. Best regards, Pop
PS: The most excellent feature of Ctrl-[, Ctrl-], Ctrl-+, Ctrl-- are very, very nice! Fonts and columns and captions and images!
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-03-25 09-39-16.png
Views:	192
Size:	398.3 KB
ID:	177906  
rjwse@aol.com is online now   Reply With Quote
Old 03-25-2020, 11:40 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,949
Karma: 131375774
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
No javascript in eBooks. That's right out.
JSWolf is online now   Reply With Quote
Old 03-25-2020, 12:29 PM   #9
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: 44,108
Karma: 22669824
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Something like

Code:
<div onresize="this.style.fontSize = this.offsetHeight / 3 + 'px'">
kovidgoyal is offline   Reply With Quote
Old 03-25-2020, 01:23 PM   #10
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
who can second-guess the intent of design?
The user.

Have fun hacking. I do. Just remember that readers may not get the joke...
Brett Merkey is offline   Reply With Quote
Old 03-25-2020, 01:38 PM   #11
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 291
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
trying to get that to work. Put inside <style></style> commands?
rjwse@aol.com is online now   Reply With Quote
Old 03-26-2020, 12:06 AM   #12
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: 44,108
Karma: 22669824
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No thats a div tag you use it to surround the text you want the font resized in.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
decrease font size of viewer interface of calibre 4.2.0 Thirteen OBD Calibre 0 10-30-2019 05:39 AM
calibre content server problem sovre Calibre 31 05-30-2013 04:25 AM
resizing of svg logo with text increasing and decreasing in epub ashokbnpal Introduce Yourself 0 07-21-2011 04:26 AM
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 07:52 AM.


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