![]() |
#1 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
HTML/CSS for (German) s p a c e d o u t emphasis
I'm working on digitalizing, and converting into a variety of formats, an old public domain text which contains both German text, and the translation thereof into English. The German side, rather than italics, uses wide s p a c i n g for emphasis.
I have a version in LaTeX format that works well, using the soul package for this purpose and it works fine for creating PDF versions. But of course I want others. I've done most of the work converting this to XHTML and the version I currently have I'm using the CSS letter-spacing property as follows: Code:
.spacedout { letter-spacing: 0.3em; } Code:
Wird ein Zeichen nicht <span class="spacedout">gebraucht</span>, so ist es bedeutungslos. 1. It seems to be handled differently, and non-optimally, by most browsers, and calibre's viewer. Most, for example, seem to generate: Quote:
If this were uniform for all browsers, I'd consider using a negative margin or padding amount at the end of the span to close that gap, but some browsers seem to generate: Quote:
But more importantly, this property is not supported in the ePub spec, and while some ePub viewers (such as Calibre's) support it anyway, ADE doesn't, which makes it pretty useless inside an ePub. So what are my options?
|
||
![]() |
![]() |
![]() |
#2 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,544
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
For ePUB, I would forget about it, at least until it is supported in the spec. Meanwhile, use other methods for emphasis, like italics, bold, underline... Of course, once it is supported, you can easily change the CSS.
Regarding "workarounds" I'd avoid them, code the style for browsers/readers that work properly (not adding a space after the last letter). At most, you could use ADE's conditional styles for it. |
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5171130
Join Date: Jan 2006
Device: none
|
I would simply convert the text to ePub-compliant italics, unless there is some particular reason you can't simply use italics (or bolding) for emphasis. Is it exclusively a cultural thing, or does it somehow impact the output or ability to read the document? Does it distort the meaning? If not: When in doubt, go for compliance, I always say. (And contact the IDPF, if you think this is something they should address.)
Alternatively, you could try inserting a d-a-s-h after each character (except the last, which would solve your comma issue). I don't know how screen readers, dictionaries, etc, would be able to handle that, though. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
Thanks for the suggestions. This isn't my work; it's a philosophical "classic", so to speak (Wittgenstein's Tractatus). My target audience are academics who are very fussy about maintaining the original as best as possible, so the choice of style isn't really mine to make. Indeed, the reason for the mixed German/English is to allow for easy hyperlinking between the original German and the English so that the translation can be scrutinized and checked. No doubt someone already has, or will soon, write a paper about the exact pattern of emphasis in the book.
But if ePub won't do it properly, my hands are tied. I guess I'd have to switch it italics, and then just add a big bold note at the beginning of the ePub making note of the change so no one complains. |
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5171130
Join Date: Jan 2006
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#6 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,544
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I believe German uses spaced-out letters because traditionally it was written with blackletter type, and it's tricky to use italic or bold face with that. The Wikipedia article for "emphasis" confirms my belief. I have, however seen spaced-out text with roman type too, in a Swedish book, for instance.
Now that I think of it, it's probably a good idea to add spaces before and after the spaced-out text, at least if there are no punctuation signs there, as in this German example. The Distributed Proofreaders wiki gives this advice: Code:
em.gesperrt { font-style: normal; font-weight: normal; letter-spacing: .2em; padding-left: .2em; } Still, your problem is the ePUB spec not supporting letter-spacing. |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
Well, even if it won't work in the ePub, the padding-left suggestion is a good one for the pure (x)html version I'm planning on distributing as well. Balanced is best. I can probably check easily enough if it begins a sentence. As for browser differences, I think just IE is different (as is so often the case).
|
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
If you have access to a font-manipulation program, create a new font with extra spacing around the characters and then embed that. You should be able to solve the punctuation problem by shifting the offset of commas and full-stops etc so that they will align correctly with the preceding letter.
Letter-spacing is rare enough in English that I just wrap characters in their own spans for this sort of stuff. |
![]() |
![]() |
![]() |
#9 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
Hmm. That extra embedded font thing is an interesting idea. I have fontforge installed, but the only things that I've ever used it for are converting font formats, and extracting a certain glyph to SVG. I have no idea how difficult it would be to change the spacing in a font, but it might be worth a try. Thanks for the suggestion!
|
![]() |
![]() |
![]() |
#10 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
A quick look at the fontforge docs shows it has commands to set the left and right sidebearings. You'd just need to go through the characters and select the 'Set LBearing' and 'Set RBearing' commands from the Metrics menu. For punctuation coming after a character (full-stop, comma, etc) you'd then decrease the LBearing value by a similar amount.
|
![]() |
![]() |
![]() |
#11 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,544
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
The CSS2 specification does not mention what should happen with the space before/after a block marked with letter-spacing, it even says "character spacing algorithms are user agent-dependent", so it's a sort of gray area. What it says, however is "when the resultant space between two characters is not the same as the default space, user agents should not use ligatures", this is against the usual practice in German, as in the example I linked to in post #6. Of course, ligatures are rarely used by XHTML renderers anyway
![]() Did you try with Prince, frabjous? |
![]() |
![]() |
![]() |
#12 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
Quote:
No. Do you mean just to see how it handles the letter-spacing attribute? I mentioned in the opening post that I began with a LaTeX version of the file, and so I already have a PDF version I'm happy with. Newer versions of Firefox do automatic ligature substitution with opentype fonts. I'll check how it handles it, but I'm fairly sure it does it properly, or I'd have noticed by now. |
|
![]() |
![]() |
![]() |
#13 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,544
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
It just occurred to me trying with a <span> around every letter (or ligature), and styling this span with left and right margins... that should work pretty much everywhere, I don't think the <span>s add breakpoints or disturb text searching. This, of course, is only worth doing if there are just a few instances of spaced-out text. |
|
![]() |
![]() |
![]() |
#14 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
Quote:
The original publisher, even of the German text, was in England, so maybe that's why. Or maybe it was just past that period. But apparently I was wrong about how smart Firefox is about this, although the results were strange. Testing this document: Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> body { font-family: 'Sorts Mill Goudy'; font-size: 200%; letter-spacing: 0.2em; } </style> <title>LigTest</title> </head> <body> My affinity for affluent fish living in fjords offended the flora. </body> </html> Have a look see. versus (This is from the same file, just zooming in and out.) Quote:
Last edited by frabjous; 04-06-2010 at 06:57 PM. |
||
![]() |
![]() |
![]() |
#15 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,544
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
However, in the case you need it for blackletter fragments, which themselves include normal and emphasized text, I think the embedded font would be the way, and I'd define a spaced-out variant as the "italic" of the blackletter. If the German text uses a different font (even if it's not blackletter), that would be a way too. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Small html/css bug | twaits | Calibre | 5 | 01-12-2010 10:26 AM |
HTML and CSS for Dummies | weedfreak | Sigil | 17 | 01-07-2010 09:34 PM |
Problems generating ePub from HTML/CSS | AlexBell | Calibre | 3 | 07-17-2009 05:10 AM |
Supported HTML/CSS tags and properties | Jellby | Bookeen | 9 | 05-04-2008 04:55 PM |
Emphasis Line and Emphasis Dot | mcortez | Sony Reader | 6 | 01-19-2008 07:19 PM |