summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-0.9.7-PATCHES/patch-01-Khaled
blob: c595141ede67f6e053b56d7c26a1400d09458d5d (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
diff -ur harfbuzz-0.9.7.orig/src/hb-ot-layout-common-private.hh harfbuzz-0.9.7/src/hb-ot-layout-common-private.hh
--- harfbuzz-0.9.7.orig/src/hb-ot-layout-common-private.hh	2012-11-17 03:44:32.000000000 +0100
+++ harfbuzz-0.9.7/src/hb-ot-layout-common-private.hh	2012-11-30 14:23:03.000000000 +0100
@@ -248,6 +248,33 @@
 
 typedef RecordListOf<Script> ScriptList;
 
+struct FeatureParamsSize
+{
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    return TRACE_RETURN (c->check_struct (this));
+  }
+
+  USHORT params[5];
+  public:
+  DEFINE_SIZE_STATIC (10);
+};
+
+struct FeatureParams
+{
+  /* Note: currently the only feature with params is 'size', so we hardcode
+   * the length of the table to that of the FeatureParamsSize. */
+
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    return TRACE_RETURN (c->check_struct (this));
+  }
+
+  union {
+  FeatureParamsSize size;
+  } u;
+  DEFINE_SIZE_STATIC (10);
+};
 
 struct Feature
 {
@@ -260,12 +287,17 @@
 					  unsigned int *lookup_tags /* OUT */) const
   { return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); }
 
+  inline const FeatureParams &get_feature_params (void) const
+  { return this+featureParams; }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE ();
-    return TRACE_RETURN (c->check_struct (this) && lookupIndex.sanitize (c));
+    return TRACE_RETURN (c->check_struct (this) && lookupIndex.sanitize (c) &&
+			 featureParams.sanitize (c, this));
   }
 
-  Offset	featureParams;	/* Offset to Feature Parameters table (if one
+  OffsetTo<FeatureParams>
+		 featureParams;	/* Offset to Feature Parameters table (if one
 				 * has been defined for the feature), relative
 				 * to the beginning of the Feature Table; = Null
 				 * if not required */
diff -ur harfbuzz-0.9.7.orig/src/hb-ot-layout.cc harfbuzz-0.9.7/src/hb-ot-layout.cc
--- harfbuzz-0.9.7.orig/src/hb-ot-layout.cc	2012-11-17 04:06:56.000000000 +0100
+++ harfbuzz-0.9.7/src/hb-ot-layout.cc	2012-11-30 14:23:03.000000000 +0100
@@ -539,3 +539,30 @@
 {
   OT::GPOS::position_finish (font, buffer, zero_width_attached_marks);
 }
+
+hb_bool_t
+hb_ot_layout_position_get_size (hb_face_t *face,
+				uint16_t  *data /* OUT, 5 items */)
+{
+  const OT::GPOS &gpos = _get_gpos (face);
+
+  unsigned int num_features = gpos.get_feature_count ();
+  for (unsigned int i = 0; i < num_features; i++) {
+
+    if (HB_TAG ('s','i','z','e') == gpos.get_feature_tag (i))
+    {
+      const OT::Feature &f = gpos.get_feature (i);
+      const OT::FeatureParams &params = f.get_feature_params ();
+
+      for (unsigned int i = 0; i < 5; i++)
+	data[i] = params.u.size.params[i];
+
+      return true;
+    }
+  }
+
+  for (unsigned int i = 0; i < 5; i++)
+    data[i] = 0;
+
+  return false;
+}
diff -ur harfbuzz-0.9.7.orig/src/hb-ot-layout.h harfbuzz-0.9.7/src/hb-ot-layout.h
--- harfbuzz-0.9.7.orig/src/hb-ot-layout.h	2012-11-17 03:50:38.000000000 +0100
+++ harfbuzz-0.9.7/src/hb-ot-layout.h	2012-11-30 14:23:03.000000000 +0100
@@ -279,6 +279,11 @@
 			      hb_glyph_position_t  *positions /* IN / OUT */);
 #endif
 
+/* Optical 'size' feature info.  Returns true if found. */
+hb_bool_t
+hb_ot_layout_position_get_size (hb_face_t *face,
+				uint16_t  *data /* OUT, 5 items */);
+
 
 HB_END_DECLS