Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-15-2010, 10:14 PM   #1
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
Unhappy How to apply fixed-width fonts

I'm a neophyte with CSS and fonts so please forgive...

Trying to get guitar tabs to show up properly in both the viewer and my Sony Reader. The text in html <pre> shows up perfectly in a browser and caliber adds a style for <pre> that is monospace, but in the viewer or the reader the guitar tabs are not aligned, which I take to mean that an inappropriate font directive has been applied...

I've tried using the hammer icon in the viewer to change the monospace font, but nothing I've tried results in a fixed-width font

Here is how things end up looking:

G C
e|--------3--------------------3-----------3--------|
B|--------------0-----0--1-----------1--------------|
G|-----0-----0-----2--------------0-----------0-----|
D|--------------------------------------0--------0--|
A|--------------------------3-----------------------|
E|--3-----------------------------------------------|

Any suggestions?
EnergyLens is offline   Reply With Quote
Old 04-16-2010, 05:29 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,621
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Try explicitly setting the font

Code:
<pre style="font-family: monospace">
</pre>
kovidgoyal is online now   Reply With Quote
Advert
Old 04-16-2010, 03:19 PM   #3
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
I tried that in the source html file and saw no difference, even in the stylesheet that ebook-convert generated. The class for the <pre> was unchanged.

I then unzipped the .epub file and hand edited the article_0/index.html file and replaced:
Code:
<pre class="calibre7">
with
Code:
<pre style="font-family: monospace">
and then re-zipped. It definitely changed the font, but didn't solve the alignment problem, so that alone won't fix it.

Really appreciate you response, as ever.
EnergyLens is offline   Reply With Quote
Old 04-17-2010, 02:07 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,621
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Try style="whitespacere"
kovidgoyal is online now   Reply With Quote
Old 04-17-2010, 02:11 AM   #5
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,878
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by kovidgoyal View Post
Try style="whitespacere"
Code:
style="whitespace:pre"
DoctorOhh is offline   Reply With Quote
Advert
Old 04-17-2010, 01:41 PM   #6
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
Thumbs down

This worked for the Calibre Viewere, but not for the Sony Reader:
Code:
    def preprocess_html(self, soup):
        if soup.pre:
            soup.pre["style"] = 'font-family: courier'
        return soup
I think I just need to learn which proportional/fixed-width fonts are actually supported by the reader, or how to include a font in the .epub that will work on the reader
EnergyLens is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-300 Fixed-width fonts for text files. seanhennessy Sony Reader 0 09-24-2010 12:41 PM
How to apply the enhancements/patches ? nubbol Calibre 2 09-05-2010 12:42 AM
single HTML to ePub with fixed width font skyfish Calibre 8 12-10-2009 02:30 PM
Fixed-width txt to fluid one vitalyb Workshop 5 12-05-2009 09:06 AM
Apply match_regexps and filter_regexpr on feeds logan Calibre 1 02-11-2009 07:08 PM


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


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