summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-04-09 15:55:30 +0200
committerAleksander Machniak <alec@alec.pl>2015-04-09 15:55:30 +0200
commitd86ff983393db7d059b205903585f2d3ebc0cb4f (patch)
tree20cae84481459cdbb0460ff43116359192d32bcc /program/lib
parent53cbebf8ade5d9994479370cc78ac4e10c23c887 (diff)
Fix font artifact in Google Chrome on Windows (#1490353)
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/Roundcube/rcube_text2html.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/program/lib/Roundcube/rcube_text2html.php b/program/lib/Roundcube/rcube_text2html.php
index 1981b2f98..2ffe5301d 100644
--- a/program/lib/Roundcube/rcube_text2html.php
+++ b/program/lib/Roundcube/rcube_text2html.php
@@ -45,18 +45,22 @@ class rcube_text2html
*/
protected $config = array(
// non-breaking space
- 'space' => "\xC2\xA0",
+ 'space' => "\xC2\xA0",
+ // word-joiner (zero-width no-break space)
+ // 'wordjoiner' => "\xEF\xBB\xBF", // U+2060
+ // use deprecated U+FEFF character because of webkit issue with displaying U+2060 (#1490353)
+ 'wordjoiner' => "\xEF\xBB\xBF", // U+FEFF
// enables format=flowed parser
'flowed' => false,
// enables wrapping for non-flowed text
- 'wrap' => true,
+ 'wrap' => true,
// line-break tag
- 'break' => "<br>\n",
+ 'break' => "<br>\n",
// prefix and suffix (wrapper element)
- 'begin' => '<div class="pre">',
- 'end' => '</div>',
+ 'begin' => '<div class="pre">',
+ 'end' => '</div>',
// enables links replacement
- 'links' => true,
+ 'links' => true,
// string replacer class
'replacer' => 'rcube_string_replacer',
);
@@ -278,6 +282,7 @@ class rcube_text2html
$text = strtr($text, $table);
$nbsp = $this->config['space'];
+ $nobr = $this->config['wordjoiner'];
// replace some whitespace characters
$text = str_replace(array("\r", "\t"), array('', ' '), $text);
@@ -299,9 +304,15 @@ class rcube_text2html
$text = $copy;
}
+ // make the whole line non-breakable
else {
- // make the whole line non-breakable
- $text = str_replace(array(' ', '-', '/'), array($nbsp, '-&#8288;', '/&#8288;'), $text);
+ $repl = array(
+ ' ' => $nbsp,
+ '-' => $nobr . '-' . $nobr,
+ '/' => $nobr . '/',
+ );
+
+ $text = str_replace(array_keys($repl), array_values($repl), $text);
}
return $text;