typographicalOutputFilterobject | output.t[1887] |
Superclass Tree | Property Summary | Method Summary | Property Details | Method Details |
We perform the following conversions:
'---' -> &zwnbsp;—
'--' -> &zwnbsp;–
sentence-ending punctuation -> same +  
Since this routine is called so frequently, we hard-code the replacement strings, rather than using properties, for slightly faster performance. Since this routine is so simple, games that want to customize the replacement style should simply replace this entire routine with a new routine that applies the customizations.
Note that we define this filter in the English-specific part of the library, because it seems almost certain that each language will want to customize it for local conventions.
typographicalOutputFilter : OutputFilter
typographicalOutputFilter
OutputFilter
object
abbreviations
abbrevPat
eosPattern
sentenceSpacer
abbreviations | output.t[1975] |
Note that abbrevPat must be rebuilt manually if you change this on the fly - abbrevPat is static, so it picks up the initial value of this property at start-up, and doesn't re-evaluate it while the game is running.
abbrevPat | output.t[1963] |
eosPattern | output.t[1950] |
If a lower-case letter follows the space, though, we won't consider it a sentence ending. This applies most commonly after quoted passages ending with what would normally be sentence-ending punctuation: "'Who are you?' he asked." In these cases, the enclosing sentence isn't ending, so we don't want the extra space. We can tell the enclosing sentence isn't ending because a non-capital letter follows.
Note that we specifically look only for ordinary spaces. Any sentence-ending punctuation that's followed by a quoted space or any typographical space overrides this substitution.
sentenceSpacer | output.t[1928] |
filterText (ostr, val) OVERRIDDEN | output.t[1888] |