summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-coretext.cc')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 40c06371bd..09f3171b30 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -691,11 +691,12 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFDictionaryRef attributes = CTRunGetAttributes (run);
CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName));
CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
+
+ CFRange range = CTRunGetStringRange (run);
if (!CFEqual (run_cg_font, face_data->cg_font))
{
CFRelease (run_cg_font);
- CFRange range = CTRunGetStringRange (run);
buffer->ensure (buffer->len + range.length);
if (buffer->in_error)
FAIL ("Buffer resize failed");
@@ -732,11 +733,16 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
}
CFRelease (run_cg_font);
+ /* 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 endWithPDF = endGlyph == 0x202c;
+
unsigned int num_glyphs = CTRunGetGlyphCount (run);
if (num_glyphs == 0)
continue;
- buffer->ensure (buffer->len + num_glyphs);
+ buffer->ensure (buffer->len + num_glyphs + (endWithPDF ? 1 : 0));
scratch = buffer->get_scratch_buffer (&scratch_size);
@@ -783,6 +789,20 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
buffer->len++;
}
+
+ if (endWithPDF) {
+ hb_glyph_info_t *info = &buffer->info[buffer->len];
+
+ info->codepoint = 0xffff;
+ info->cluster = range.location + range.length - 1;
+
+ /* Currently, we do all x-positioning by setting the advance, we never use x-offset. */
+ info->mask = 0;
+ info->var1.u32 = 0;
+ info->var2.u32 = 0;
+
+ buffer->len++;
+ }
}
buffer->clear_positions ();