1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
From 96b71dc7c8ab8aa020f47dc659b32c2002001015 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Thu, 28 Nov 2019 14:51:39 +0100
Subject: [PATCH] Qt-specific workaround for AAT shaper
CoreText API doesn't give us a fontdata to reconstruct the original font,
so we have to store the CTFont and CGFont of interest in context object
passed to HB from native font engine.
Change-Id: I9a71ae71b7d22f32498a9dd386500fa867a5f6cd
---
src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 8885cfe..f4e3ef0 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -36,6 +36,18 @@
#include "hb-aat-layout.hh"
#include <math.h>
+typedef bool (*qt_get_font_table_func_t) (void *user_data, unsigned int tag, unsigned char *buffer, unsigned int *length);
+
+struct FontEngineFaceData {
+ void *user_data;
+ qt_get_font_table_func_t get_font_table;
+};
+
+struct CoreTextFontEngineData {
+ CTFontRef ctFont;
+ CGFontRef cgFont;
+};
+
/**
* SECTION:hb-coretext
@@ -107,6 +119,7 @@ get_last_resort_font_desc ()
return font_desc;
}
+#if 0
static void
release_data (void *info, const void *data, size_t size)
{
@@ -115,6 +128,7 @@ release_data (void *info, const void *data, size_t size)
hb_blob_destroy ((hb_blob_t *) info);
}
+#endif
static CGFontRef
create_cg_font (hb_face_t *face)
@@ -126,6 +140,7 @@ create_cg_font (hb_face_t *face)
}
else
{
+#if 0
hb_blob_t *blob = hb_face_reference_blob (face);
unsigned int blob_length;
const char *blob_data = hb_blob_get_data (blob, &blob_length);
@@ -140,6 +155,11 @@ create_cg_font (hb_face_t *face)
DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
CGDataProviderRelease (provider);
}
+#else
+ FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
+ CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
+ cg_font = CGFontRetain (coreTextFontEngineData->cgFont);
+#endif
}
return cg_font;
}
--
2.8.1
|