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 12-10-2013, 10:07 AM   #1
Symmetria
Junior Member
Symmetria began at the beginning.
 
Symmetria's Avatar
 
Posts: 8
Karma: 10
Join Date: Dec 2013
Device: none
Sans-serif generic family in mobigen generated .mobi files

Hi everyone.

I am working on a book that needs to have some of its sections displayed in sans-serif font.

I have set the following rule for these kind of sections; nice and generic.
{font-family: sans-serif;}
The epub version of the book works as intended.

When I preview the file in the Kindle Previewer, however, everything is in serif font (except for some other parts of the book, that needed to be in monospace({font-family: monospace;}) , which are, curiously, displaying correctly)

What is the deal with kindlegen generated .mobi files and the sans-serif font family?
Do they simply not work or is there some trick to make the kindlegen not disregard the CSS rule when it compiles the book from .epub?

.mobi files in question are generated using the up-to-date Kindle Previewer's built in kindlegen functionality.

Thanks
Symmetria is offline   Reply With Quote
Old 12-10-2013, 10:52 AM   #2
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,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Symmetria View Post
Hi everyone.

I am working on a book that needs to have some of its sections displayed in sans-serif font.

I have set the following rule for these kind of sections; nice and generic.
{font-family: sans-serif;}
The epub version of the book works as intended.

When I preview the file in the Kindle Previewer, however, everything is in serif font (except for some other parts of the book, that needed to be in monospace({font-family: monospace;}) , which are, curiously, displaying correctly)

What is the deal with kindlegen generated .mobi files and the sans-serif font family?
Do they simply not work or is there some trick to make the kindlegen not disregard the CSS rule when it compiles the book from .epub?

.mobi files in question are generated using the up-to-date Kindle Previewer's built in kindlegen functionality.

Thanks
The ".mobi" file generated by Kindle Previewer contains two types of files: a .kf8 (in order to be read for the modern models of Kindles) and a "properly" .mobi (the old kind of mobi) in order to be read for Kindle DX and the older Kindle devices. When in Kindle Previewer you enabled the Kindle Fire and Kindle Paperwhite preview, you are watching the ".kf8 part" of the .mobi file AND YOU SHOULD SEE the sans-serif font; on the other hand, when you enable the Kindle DX preview, you are watching the ".mobi part" of the .mobi file AND HERE YOU CAN'T HAVE the sans-serif font. Probably you are previewing your eBook with the Kindle DX preview; try enabling Kindle Fire or Paperwhite and tell us if you can see the sans-serif font.
RbnJrg is offline   Reply With Quote
Advert
Old 12-10-2013, 10:57 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
There's only so many generic font-families that are supported with kindle devices (out of the box). Monospace or tt will work on all devices (mobi or KF8), but I don't know about any others for sure. You may have to embed a font to get anything else to work (and even then it will only work on devices/apps that support the KF8 format).
DiapDealer is online now   Reply With Quote
Old 12-10-2013, 11:23 AM   #4
Symmetria
Junior Member
Symmetria began at the beginning.
 
Symmetria's Avatar
 
Posts: 8
Karma: 10
Join Date: Dec 2013
Device: none
Quote:
Originally Posted by RbnJrg View Post
The ".mobi" file generated by Kindle Previewer contains two types of files: a .kf8 (in order to be read for the modern models of Kindles) and a "properly" .mobi (the old kind of mobi) in order to be read for Kindle DX and the older Kindle devices. When in Kindle Previewer you enabled the Kindle Fire and Kindle Paperwhite preview, you are watching the ".kf8 part" of the .mobi file AND YOU SHOULD SEE the sans-serif font; on the other hand, when you enable the Kindle DX preview, you are watching the ".mobi part" of the .mobi file AND HERE YOU CAN'T HAVE the sans-serif font. Probably you are previewing your eBook with the Kindle DX preview; try enabling Kindle Fire or Paperwhite and tell us if you can see the sans-serif font.
I am aware of the fact that ".mobi" files generated from kndlegen actually contain other files (as a side note, I thought it included one more file, the original, no?) for backwards compatibility reasons.

I am not aware however which of the devices available in the Previewer are supposed to be new (as in "use .kf8") and which are old

To answer you, I tried all of them and since sans-serif works in none of them I just assumed it works to neither new or old.
Just to be sure we are on the same page (no pun intended) here is the list of the available devices I see:

-Kindle e-ink
|-Kindle Paperwhite
|-Kindle DX
-Kindle Fire
|-Kindle Fire HD
|-Kindle Fire HDX
|-Kindle Fire HDX 8.9"
-Kindle for iOS
|-iPhone
|-iPad

As a side note, monospace is not working on Kindle Paperwhite.
Symmetria is offline   Reply With Quote
Old 12-10-2013, 11:27 AM   #5
Symmetria
Junior Member
Symmetria began at the beginning.
 
Symmetria's Avatar
 
Posts: 8
Karma: 10
Join Date: Dec 2013
Device: none
Quote:
Originally Posted by DiapDealer View Post
...You may have to embed a font to get anything else to work (and even then it will only work on devices/apps that support the KF8 format).
..ok, so a "trick" for merely having sans-serif. I will try this if no other alternative comes up, thanks.
Symmetria is offline   Reply With Quote
Advert
Old 12-10-2013, 02:11 PM   #6
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,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Maybe you are doing something wrong. I used this code without any issue:

Code:
h1 {
   font-family: "Arial", sans-serif;
   text-align: center;
   margin-bottom: 1em;
}

h2 {
   width: 70%;
   font-family: serif;
   font-style: italic;
   text-align: center;
   margin: 0 auto 1em auto;
   padding: 1em;
   border: 7px double black;
   -webkit-border-radius: 25px;
}

p {
   text-indent: 0; 
   text-align: justify;
   font-family: serif;
}

.boldss {
   font-family: "Arial", sans-serif;
   font-weight: bold;
}
and:

Code:
<h1>This title in sans-serif</h1>

  <h2>Subtitle in serif</h2>

  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, <span class="boldss">this text in bold sans-serif</span> massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula. Praesent orci dui, pulvinar id convallis a, faucibus non mauris. Donec tellus augue, tempus sed facilisis sed, fringilla quis leo. Mauris vulputate, leo ac facilisis vulputate, enim orci interdum augue, in blandit quam turpis quis dui.</p>
This is how it looks in Kindle Previewer (Kindle Paperwhite):

Click image for larger version

Name:	KP.jpg
Views:	320
Size:	96.0 KB
ID:	116504

This is how it looks in my K4NT:

Click image for larger version

Name:	screen_shot-31310.gif
Views:	324
Size:	30.4 KB
ID:	116503

Below you can check the respective epub.

Regards
Rubén
Attached Files
File Type: epub Sans-serif Text.epub (2.6 KB, 230 views)

Last edited by RbnJrg; 12-10-2013 at 02:20 PM.
RbnJrg is offline   Reply With Quote
Old 12-10-2013, 02:50 PM   #7
Symmetria
Junior Member
Symmetria began at the beginning.
 
Symmetria's Avatar
 
Posts: 8
Karma: 10
Join Date: Dec 2013
Device: none
Quote:
Originally Posted by RbnJrg View Post
Maybe you are doing something wrong. I used this code without any issue:

Code:
h1 {
   font-family: "Arial", sans-serif;
   text-align: center;
   margin-bottom: 1em;
}

h2 {
   width: 70%;
   font-family: serif;
   font-style: italic;
   text-align: center;
   margin: 0 auto 1em auto;
   padding: 1em;
   border: 7px double black;
   -webkit-border-radius: 25px;
}

p {
   text-indent: 0; 
   text-align: justify;
   font-family: serif;
}

.boldss {
   font-family: "Arial", sans-serif;
   font-weight: bold;
}
Thanks Ruben, that helped, I managed to pinpoint what the "mistake" was!

Apparently, you must specify at least one font for sans-serif to work. If you just use the generic
{font-family: sans-serif;}
, as I did in my case, it gets disregarded.

After seeing your code, I specified Arial as the to-go-first font, and now sans-serif is working.

At least that's how it works on the Previewer.

Out of curiosity, I see you have an actual device, so would you mind testing whether just declaring {font-family: sans-serif;} would work on that?

Thanks again
Symmetria is offline   Reply With Quote
Old 12-10-2013, 03:47 PM   #8
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,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Symmetria View Post
Out of curiosity, I see you have an actual device, so would you mind testing whether just declaring {font-family: sans-serif;} would work on that?
I did the testing you asked and with "font-family: sans-serif" in Kindle Previewer only worked with Kindle Paperwhite preview; also worked in my K4NT. So, with "font-family: sans-serif" it seems that only doesn't work in Kindle Fire (and of course, in Kindle DX and older Kindle devices that don't support .kf8)

Quote:
Thanks again
You are welcome
RbnJrg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serif, and sans-serif fonts SamL ePub 5 07-21-2011 06:00 PM
Which typeface should use for ebook, Serif or Sans-serif droople Workshop 8 06-13-2010 07:20 AM
Serif or Sans Serif for readability? kilofox Amazon Kindle 19 02-20-2009 02:22 PM
Serif and Sans-Serif fonts in Libprs500 benong Calibre 1 02-06-2008 04:43 AM
Do you prefer the Reader's serif or its sans serif font? (poll) Alexander Turcic Sony Reader 9 11-25-2006 12:15 PM


All times are GMT -4. The time now is 11:00 PM.


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