summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-02-09 17:44:14 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-02-14 01:18:28 +0000
commitce0d3f4e72af11775e3591f831283469d6a0c4ce (patch)
tree7186be54384b6d387db0a84f29e9ad42a9ba2b74 /src
parentb1a106f79303f9af73966f92bafd1192af277b1f (diff)
[HarfBuzz/CoreText] Re-apply fix for QTBUG-38113
Task-number: QTBUG-38113 Change-Id: Icdedfdb240a2888e0a084a156db5598c033495de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 4548b7402b..ab9e1d4a93 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -827,6 +827,8 @@ retry:
run_advance = -run_advance;
DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
+ CFRange range = CTRunGetStringRange (run);
+
/* CoreText does automatic font fallback (AKA "cascading") for characters
* not supported by the requested font, and provides no way to turn it off,
* so we must detect if the returned run uses a font other than the requested
@@ -893,7 +895,6 @@ retry:
}
if (!matched)
{
- CFRange range = CTRunGetStringRange (run);
DEBUG_MSG (CORETEXT, run, "Run used fallback font: %ld..%ld",
range.location, range.location + range.length);
if (!buffer->ensure_inplace (buffer->len + range.length))
@@ -945,7 +946,13 @@ retry:
if (num_glyphs == 0)
continue;
- if (!buffer->ensure_inplace (buffer->len + num_glyphs))
+ /* ### temporary fix for QTBUG-38113 */
+ /* CoreText throws away the PDF token, while the OpenType backend will add a zero-advance
+ * glyph for this. We need to make sure the two produce the same output. */
+ UniChar endGlyph = CFStringGetCharacterAtIndex (string_ref, range.location + range.length - 1);
+ bool endsWithPDF = endGlyph == 0x202c;
+
+ if (!buffer->ensure_inplace (buffer->len + num_glyphs + (endsWithPDF ? 1 : 0)))
goto resize_and_retry;
hb_glyph_info_t *run_info = buffer->info + buffer->len;
@@ -1036,6 +1043,20 @@ retry:
info++;
}
}
+ if (endsWithPDF) {
+ /* Ensure a zero-advance glyph the PDF token */
+ if (unlikely (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))) {
+ memmove (run_info + 1, run_info, num_glyphs * sizeof (hb_glyph_info_t));
+ info = run_info;
+ }
+ info->codepoint = 0xffff;
+ info->cluster = log_clusters[range.location + range.length - 1];
+ info->mask = 0;
+ info->var1.u32 = 0;
+ info->var2.u32 = 0;
+
+ buffer->len++;
+ }
SCRATCH_RESTORE();
advances_so_far += run_advance;
}