Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 06-13-2015, 06:29 PM   #1
San Zamoyski
Enthusiast
San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.
 
Posts: 48
Karma: 41612
Join Date: Jan 2015
Location: Poland, Warsaw
Device: Kindle 3G
Using PRE tag

Hi!

I'm building some books (Gamebooks).
One of the book uses ASCII Art ("Sąsiedzi Lonesbury"). I would like to do it the way author made it, so want to include those ASCII arts.
Nevertheless, by using <pre> (to be accurate <pre class="pre-styl">) tags, i get something far from what i want - letters are too big, so lines splits into two - it makes images unreadable.
I wanted to make those letters smaller by including

Code:
.pre-styl {
				page-break-inside: avoid;
				vertical-align: middle;
				font-size: 30%;
				line-height: 30%;
			}
in my CSS file, but when converting epub to mobi, kindlegen tells me:
Code:
Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported.
What can i do then?

Best regards!
San Zamoyski is offline   Reply With Quote
Old 06-14-2015, 02:25 AM   #2
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Is that the entire CSS file? I don't see an @ rule there.

BTW, Kindle restricts the line-height CSS property to a minimum of 120% of the font size. And you probably don't want the line height to be 30% of your font size anyway.

Last edited by dgatwood; 06-14-2015 at 02:28 AM.
dgatwood is offline   Reply With Quote
Old 06-14-2015, 03:10 AM   #3
San Zamoyski
Enthusiast
San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.
 
Posts: 48
Karma: 41612
Join Date: Jan 2015
Location: Poland, Warsaw
Device: Kindle 3G
Entire CSS*:
Code:
			@font-face {
				font-family: "EB Garamond RG";
				src: url('. $adres_czcionek. $nazwa_czcionki. '-Regular.ttf);
			}
			@font-face {
				font-family: "EB Garamond RG";
				src: url('. $adres_czcionek. $nazwa_czcionki. '-Bold.ttf);
				font-weight: bold;
			}
			@font-face {
				font-family: "EB Garamond RG";
				src: url('. $adres_czcionek. $nazwa_czcionki. '-Italic.ttf);
				font-style: italic;
			}
			@font-face {
				font-family: "EB Garamond RG";
				src: url('. $adres_czcionek. $nazwa_czcionki. '-Bold-Italic.ttf);
				font-style: italic;
				font-weight: bold;
			}
			
			body { 
				font-family: "EB Garamond RG";
			}

			.pre-styl {
				page-break-inside: avoid;
				vertical-align: middle;
				font-size: 30%;
				line-height: 30%;
			}
*replace $adres_czcionek. $nazwa_czcionki with font adress and name.

Yes, i do belive that i do not want line-height at 30%, it works for epub at 70%, but i just wanted to make sure it is not working.
San Zamoyski is offline   Reply With Quote
Old 06-14-2015, 05:40 AM   #4
San Zamoyski
Enthusiast
San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.
 
Posts: 48
Karma: 41612
Join Date: Jan 2015
Location: Poland, Warsaw
Device: Kindle 3G
So no i'm using:
Code:
			.pre-linia {
				font-size: 12px; 
				vertical-align: middle;
				page-break-before: avoid;	
				font-family: monospace;
				margin: -10px;
				white-space: pre;
			}
and everything what was between <pre> tags is now splitted into <p class=pre-linia>
But still can not force spacing between lines to be thicker.
San Zamoyski is offline   Reply With Quote
Old 06-14-2015, 06:23 AM   #5
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by dgatwood View Post
BTW, Kindle restricts the line-height CSS property to a minimum of 120% of the font size. And you probably don't want the line height to be 30% of your font size anyway.
I don't get that effect on my Kindle editions, as viewed in my K3 Keyboard and my Fire HD tablet. I introduce all chapters with a few words in all caps, with this style:

span.smallcap {
font-size: 90%;
font-weight: bold;
}

The 90% instruction is ignored in the DX emulation, but I can live with that. (I think the boldface instruction is also ignored.)
Notjohn is offline   Reply With Quote
Old 06-14-2015, 06:29 AM   #6
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
The Kindle Publishing Guidelines have this to say about monospace:

3.1.6 Text Guideline #6: Monospaced Font Is Supported
Kindle uses a default font for content if none is specified; it also supports a monospaced font.
Kindle uses the monospaced font to render content in the following tags: <pre>, <code>, <samp>,
<kbd>, <tt>, <font face="courier">, <font face="monospace">.
With the exception of <pre>, the tags listed above do not change the text alignment. If the content in
these tags should be left-aligned, wrap the tags listed above in a <div> styled with CSS using textalign:left.
Publishers can include their own font for their content. Amazon has a quality assurance process to ensure
that these fonts display well on e Ink-based devices and do not impair the reading experience. Do not
include the Charis font; it is replaced with a higher quality font in the Kindle Readers.
Notjohn is offline   Reply With Quote
Old 06-14-2015, 08:08 AM   #7
San Zamoyski
Enthusiast
San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.San Zamoyski is an enigma wrapped up in a mystery.
 
Posts: 48
Karma: 41612
Join Date: Jan 2015
Location: Poland, Warsaw
Device: Kindle 3G
Thanks everyone for help!

I made it somehow like this:

PHP Code:
        foreach($prelinie as $linia){
            
$linia rtrim($linia);
            
$linia str_pad($linia$l_dlugosc);
            
            
$preformatowane .= '
                <p class="pre-linia">'
htmlspecialchars($linia). '</p>';
        } 
and

Code:
			.pre-linia {
				page-break-before: avoid;
				vertical-align: middle;
				font-size: 6px; 
				white-space: pre;
				font-family: monospace; 
				margin-top: -2px;
				margin-bottom: -2px;
			}
And it works like a charm!
San Zamoyski is offline   Reply With Quote
Old 06-15-2015, 11:17 PM   #8
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by Notjohn View Post
I don't get that effect on my Kindle editions, as viewed in my K3 Keyboard and my Fire HD tablet. I introduce all chapters with a few words in all caps, with this style:

span.smallcap {
font-size: 90%;
font-weight: bold;
}
You're not using the line-height at all in that snippet. The line-height property determines the total height of a line of text relative to the font size—in other words, the height of the font plus the height of the space between lines.

Because you didn't specify the line-height property, the reader uses the default value of 1.2 (120%).

If your reader uses a base font size of 12 pt, then the CSS above specifies a roughly 10.8 point font size, which is a little over 14 pixels. When you multiply that by 1.2, you find that the baseline of each line is about 17 pixels below the baseline of the line before it, resulting in roughly a three pixel spacing between the bottom of a typical descender and the top of a typical ascender in the next line (assuming the font metrics are correct).
dgatwood is offline   Reply With Quote
Old 06-16-2015, 06:13 AM   #9
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Ah, I didn't understand your comment! (That happens with distressing frequency in these forums.) Sorry!
Notjohn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
suggestion: tag groups should use Calibre tag hierarchy comox Calibre Companion 53 05-25-2015 07:22 PM
Sorting tag values in tag browser mcam Library Management 15 08-25-2013 05:50 AM
Conversionproblems from HTML to ePub with the <pre>-Tag matthias2011 Conversion 16 07-29-2011 08:47 AM
Adding an Owner tag to tag list? Fangles Library Management 1 02-25-2011 02:32 AM
<pre> tag issue while conveting to epub Colaveare Calibre 8 10-09-2010 12:02 AM


All times are GMT -4. The time now is 09:12 PM.


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