snaekobbi / pipeline-mod-braille

ARCHIVED. Please don't make any new issues or pull requests in this repo.
0 stars 0 forks source link

Support letter spacing #24

Closed bertfrees closed 8 years ago

bertfrees commented 9 years ago

Depends on:

Related issues:

bertfrees commented 9 years ago

Either make it a translator (TextTransform) feature or a formatter (dotify-formatter) feature.

In case we make it a formatter feature, the TextTransform API might have to be enhanced in order to be able to get the mapping between input and output.

bertfrees commented 8 years ago

Implementing letter-spacing in combination with pre-translation and hyphenation is somewhat challenging. (See also discussion at https://botbot.me/freenode/snaekobbi/2015-10-21.)

When word breaking is disabled, letter spacing can be applied in pre-translation simply by adding no-break spaces between letters: f o o b a r ( = nbsp).

When word breaking is enabled but the "hyphenate-character" is supposed to behave like a regular letter -- in other words if letter-spacing:x it is separated from the preceding letter by x spaces -- there is no problem either. We simply add a no-break space followed by a soft hyphen between the letters where the word can be broken: f o o -b a r (`= nbsp and-` = shy)

The result of breaking this word in the middle is:

f o o -
b a r

and the result of not breaking the word is:

f o o b a r

However, when word breaking is enabled and the hyphenate-character is supposed to be attached to the preceding letter, like this:

f o o-
b a r

there is currently no straightforward way to pre-translate text and control the line breaking by inserting white space and other special characters only.

Solution 1: Extend CSS to give more control over line and word breaking, either by defining the behavior of more special (white space) characters, or by creating more properties (or modifying/extending existing properties).

Solution 2: Perform translation while formatting, either completely while formatting or partly in pre-translation and partly in a second pass while formatting.

Since pre-translation is required mainly for the purpose of e-braille, which has not been fully specified yet, and for a yet to be specified editing format, I suggest we do the whole translation while formatting for now, and wait until the requirements for pre-translation have been properly specified.

bertfrees commented 8 years ago

Fixed by v1.9.8