04-15-2010, 10:14 PM | #1 |
Hack
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
|
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? |
04-16-2010, 05:29 AM | #2 |
creator of calibre
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> |
Advert | |
|
04-16-2010, 03:19 PM | #3 |
Hack
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"> Code:
<pre style="font-family: monospace"> Really appreciate you response, as ever. |
04-17-2010, 02:07 AM | #4 |
creator of calibre
Posts: 44,621
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Try style="whitespacere"
|
04-17-2010, 02:11 AM | #5 |
US Navy, Retired
Posts: 9,878
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
|
Advert | |
|
04-17-2010, 01:41 PM | #6 |
Hack
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
|
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 |
Thread Tools | Search this Thread |
|
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 |