Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 11-25-2013, 02:54 PM   #1
SBT
Fanatic
SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.
 
SBT's Avatar
 
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
Text with fixed proportional size

...I know, inconsistent title. What I wonder is if it is possible to make a given word always fill a certain proportion of the display?
Something analogous to
Code:
img {width:80%}
for text, so that CHAPTER ONE always takes up 80% display width, not more, not less, not over more than one line?
It doesn't seem possible without using SVG, but maybe somebody has a CSS trick up their sleeve?
SBT is offline   Reply With Quote
Old 11-25-2013, 05:19 PM   #2
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Why not just use SVG?
DaleDe is offline   Reply With Quote
Old 11-25-2013, 05:29 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,634
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by SBT View Post
...I know, inconsistent title. What I wonder is if it is possible to make a given word always fill a certain proportion of the display?
Something analogous to
Code:
img {width:80%}
for text, so that CHAPTER ONE always takes up 80% display width, not more, not less, not over more than one line?
It doesn't seem possible without using SVG, but maybe somebody has a CSS trick up their sleeve?
EDIT: Also see post #7 of this thread:
https://www.mobileread.com/forums/sho...06&postcount=7

Hmmm, the problem is the text, not the box where is going to be the text. You can make a box in order to fill always, let's say, 80% width and 25% height. Maybe using a font-size measured in "vw" (or in "vh") (let's say: font-size: 5vw or font-size: 8vh) could do the trick. But I don't know if works in all ereaders (more probably not )

Also I can think in a solution that uses svg partially. For example:

In your stylesheet.css file write:

Code:
html {
    height: 100%; /* very important */
    margin: 0;
}

body {
    height: 100%;  /* very important */
    margin: 0;
}

.container {
    display: table;
    height: 25%;
    width: 80%;
    text-indent: 0;
    text-align: center;
    vertical-align: middle;
    margin: 0 auto; /* or margin: 0 10%; */
    border: 2px solid black;
}

.content {
    display: table-cell;
    vertical-align: middle;
    background: url("../Images/Image1.svg") center center no-repeat;
    background-size: contain;
    height: 100%;
}
In your .html file write:

Code:
<div class="container">
    <p class="content">&nbsp;</p>
</div>
Finally, you need a svg file with the text you want to use. My svg text file was:

Code:
<svg 
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.1"
   width="80"
   height="20"
   id="svg3010">
  <text x="40" y="12.5" text-anchor="middle" fill="red" style="font-size: 10px; font-weight: bold">This is a title</text>
</svg>
Here you can see a screenshoot of my Sigil:

Click image for larger version

Name:	Sigil1.jpg
Views:	242
Size:	98.2 KB
ID:	115764

and here another screenshoot (with another size):

Click image for larger version

Name:	Sigil2.jpg
Views:	234
Size:	93.1 KB
ID:	115765

Below you can see the respective ePub. Of course, this kind of things doesn't work in ADE

Regards
Rubén
Attached Files
File Type: epub Text with proportional size.epub (2.7 KB, 165 views)

Last edited by RbnJrg; 11-26-2013 at 09:05 AM.
RbnJrg is offline   Reply With Quote
Old 11-25-2013, 06:21 PM   #4
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Try this:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="80%" height="50%" viewBox="0 0 1000 300"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example text01 - 'Hello, out there' in blue</desc>

<text x="50" y="50"
font-family="Verdana" font-size="50px" fill="blue" >
Hello, out there
</text>
</svg>

The pixels are scaled to fit the width and height settings.
DaleDe is offline   Reply With Quote
Old 11-26-2013, 06:52 AM   #5
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
But in an PRS-300, it doesn't respond to text size settings. But in ADE it does. Interesting technique.
mrmikel is offline   Reply With Quote
Old 11-26-2013, 07:22 AM   #6
SBT
Fanatic
SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.
 
SBT's Avatar
 
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
Thanks for all your replies.
As I suspected, SVG seems to be the only way. My slight reservation has been due to mrmikel's observation for the PRS-300, which probably also is true for the PRS-505, which also has a rather patchy SVG implementation.
If I am to follow the SVG path, then I'm sorely tempted to convert the text to paths in Inkscape or similar, and stop worrying about font handling in different readers' SVG implementations.
BTW, does anybody know of a command-line method in linux for converting a string in a given font to an svg file?
SBT is offline   Reply With Quote
Old 11-26-2013, 09:04 AM   #7
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,634
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
This solution (with partial use of SVG) also works in ADE:

In the stylesheet:

Code:
html {
    height: 100%; /* very important */
    margin: 0;
}

body {
    height: 100%;  /* very important */
    margin: 0;
}

.container {
    height: 25%;
    width: 80%;
    text-indent: 0;
    text-align: center;
    margin: 0 10%;  
    background: url("../Images/Image1.svg") center center no-repeat;
    background-size: contain;
    border: 2px solid blue;
}
In the .html file:

Code:
<div class="container">
    &nbsp;
</div>
As Image1.svg file:

Code:
<svg 
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.1"
   width="600"
   height="200"
   id="svg3010">
  <text x="300" y="130" text-anchor="middle" fill="red" style="font-size: 100px; font-weight: bold">This is a title</text>
</svg>
This is as it looks in ADE:

Click image for larger version

Name:	ADE1.jpg
Views:	244
Size:	51.2 KB
ID:	115793

Regards
Rubén
Attached Files
File Type: epub Text with proportional size.epub (2.6 KB, 184 views)
RbnJrg is offline   Reply With Quote
Old 11-26-2013, 09:28 AM   #8
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
This is how it looks in the reader library.

It runs outside of the bounds of the box.

Sigh.
Attached Thumbnails
Click image for larger version

Name:	titlebox.jpg
Views:	203
Size:	23.8 KB
ID:	115795  
mrmikel is offline   Reply With Quote
Old 11-26-2013, 12:57 PM   #9
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Also, the height: 100% in the body and html can cause serious issues in at least the PRS-T* series. It can block you from moving to another page by both the hardware button and the swipe.
Toxaris is offline   Reply With Quote
Old 11-26-2013, 01:34 PM   #10
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by mrmikel View Post
But in an PRS-300, it doesn't respond to text size settings. But in ADE it does. Interesting technique.
thanks, you can play with the font-size and dimensions of the view box to set the maximum you want. 150px is interesting here. I opened this file in notepad and in my browser and played with the numbers. Just grab the edge of the browser and make it smaller or larger and see the text shrink or expand while you are moving the edge. Lots of fun. Play with the numbers percentages and font size and have fun. Note view box size may need to be bigger to make the whole text fit based on the length of the text but once set it scales well.

Dale
DaleDe is offline   Reply With Quote
Old 11-26-2013, 04:34 PM   #11
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
I shrunk the text size to 80 px and it works great in the Reader Library. Makes me want to experiment with more things.
mrmikel is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adjustable line spacing not proportional to font size GeoffR Kobo Reader 35 05-01-2014 07:59 AM
Text with Fixed Layout Gerlyn Sigil 11 04-09-2013 07:03 AM
Making certain pages a fixed size? lhgrappler Sigil 6 01-25-2011 11:11 AM
Making certain pages a fixed size? lhgrappler ePub 1 01-24-2011 08:34 PM
fixed table size JiYu Amazon Kindle 4 09-26-2010 12:02 PM


All times are GMT -4. The time now is 09:14 AM.


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