Quote:
Originally Posted by JSWolf
Monospace does not work out of the box. You can get monospace to work with KePub by embedding a monospace font. But you can do it even easier if you use ePub.
Spoiler:
The first thing to do it find a Courier font. name the font files...
Courier-Regular.ttf
Courier-Bold.ttf
Courier-Italic.ttf
Courier-BoldItalic.ttf
Put them in the fonts directory. Then in the CSS, use the following code.
Code:
@font-face {
font-family:monospace;
font-weight: normal;
font-style: normal;
src: url(res:///Data/fonts/Courier-Regular.ttf);
}
@font-face {
font-family:monospace;
font-weight: bold;
font-style: normal;
src: url(res:///Data/fonts/Courier-Bold.ttf);
}
@font-face {
font-family:monospace;
font-weight: normal;
font-style: italic;
src: url(res:///Data/fonts/Courier-Italic.ttf);
}
@font-face {
font-family:monospace;
font-weight: bold;
font-style: italic;
src: url(res:///Data/fonts/Courier-BoldItalic.ttf);
}
Now when you have font-family: monospace; you will have a monospace font displayed.
|
In my testing, if you have the font named Courier, you do not need to add the font-face declarations in the CSS for an ePub. Just adding <code> around the text that you want to be monospaced is all that is needed.