summaryrefslogtreecommitdiffstats
path: root/src/harfbuzz-1-winxp-ugly.patch
blob: b97f086fc29436cedeb2afe964025044e15164a4 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
This file is part of MXE.
See index.html for further information.

This patch has been taken from:
https://bugs.freedesktop.org/show_bug.cgi?id=55494

--- harfbuzz-0.9.6/src/hb-uniscribe.cc	2012-08-18 17:59:46 +0000
+++ harfbuzz-0.9.6/src/hb-uniscribe.cc	2012-10-01 12:19:53 +0000
@@ -312,161 +312,16 @@ retry:
   bidi_state.uBidiLevel = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
   bidi_state.fOverrideDirection = 1;
 
-  hr = ScriptItemizeOpenType (wchars,
-			      chars_len,
-			      MAX_ITEMS,
-			      &bidi_control,
-			      &bidi_state,
-			      items,
-			      script_tags,
-			      &item_count);
-  if (unlikely (FAILED (hr)))
     FAIL ("ScriptItemizeOpenType() failed: 0x%08xL", hr);
 
 #undef MAX_ITEMS
 
-  int *range_char_counts = NULL;
-  TEXTRANGE_PROPERTIES **range_properties = NULL;
-  int range_count = 0;
-  if (num_features) {
-    /* TODO setup ranges */
-  }
-
-  OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language));
-
-  unsigned int glyphs_offset = 0;
-  unsigned int glyphs_len;
-  bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
-  for (unsigned int j = 0; j < item_count; j++)
-  {
-    unsigned int i = backward ? item_count - 1 - j : j;
-    unsigned int chars_offset = items[i].iCharPos;
-    unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
-
-  retry_shape:
-    hr = ScriptShapeOpenType (font_data->hdc,
-			      &font_data->script_cache,
-			      &items[i].a,
-			      script_tags[i],
-			      language_tag,
-			      range_char_counts,
-			      range_properties,
-			      range_count,
-			      wchars + chars_offset,
-			      item_chars_len,
-			      glyphs_size - glyphs_offset,
-			      /* out */
-			      log_clusters + chars_offset,
-			      char_props + chars_offset,
-			      glyphs + glyphs_offset,
-			      glyph_props + glyphs_offset,
-			      (int *) &glyphs_len);
-
-    if (unlikely (items[i].a.fNoGlyphIndex))
-      FAIL ("ScriptShapeOpenType() set fNoGlyphIndex");
-    if (unlikely (hr == E_OUTOFMEMORY))
-    {
-      buffer->ensure (buffer->allocated * 2);
-      if (buffer->in_error)
-	FAIL ("Buffer resize failed");
-      goto retry;
-    }
-    if (unlikely (hr == USP_E_SCRIPT_NOT_IN_FONT))
-    {
-      if (items[i].a.eScript == SCRIPT_UNDEFINED)
-	FAIL ("ScriptShapeOpenType() failed: Font doesn't support script");
-      items[i].a.eScript = SCRIPT_UNDEFINED;
-      goto retry_shape;
-    }
-    if (unlikely (FAILED (hr)))
-    {
-      FAIL ("ScriptShapeOpenType() failed: 0x%08xL", hr);
-    }
-
-    for (unsigned int j = chars_offset; j < chars_offset + item_chars_len; j++)
-      log_clusters[j] += glyphs_offset;
-
-    hr = ScriptPlaceOpenType (font_data->hdc,
-			      &font_data->script_cache,
-			      &items[i].a,
-			      script_tags[i],
-			      language_tag,
-			      range_char_counts,
-			      range_properties,
-			      range_count,
-			      wchars + chars_offset,
-			      log_clusters + chars_offset,
-			      char_props + chars_offset,
-			      item_chars_len,
-			      glyphs + glyphs_offset,
-			      glyph_props + glyphs_offset,
-			      glyphs_len,
-			      /* out */
-			      advances + glyphs_offset,
-			      offsets + glyphs_offset,
-			      NULL);
-    if (unlikely (FAILED (hr)))
-      FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr);
-
-    glyphs_offset += glyphs_len;
-  }
-  glyphs_len = glyphs_offset;
-
-  /* Ok, we've got everything we need, now compose output buffer,
-   * very, *very*, carefully! */
-
-  /* Calculate visual-clusters.  That's what we ship. */
-  for (unsigned int i = 0; i < glyphs_len; i++)
-    vis_clusters[i] = -1;
-  for (unsigned int i = 0; i < buffer->len; i++) {
-    uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
-    *p = MIN (*p, buffer->info[i].cluster);
-  }
-  if (!backward) {
-    for (unsigned int i = 1; i < glyphs_len; i++)
-      if (vis_clusters[i] == -1)
-	vis_clusters[i] = vis_clusters[i - 1];
-  } else {
-    for (int i = glyphs_len - 2; i >= 0; i--)
-      if (vis_clusters[i] == -1)
-	vis_clusters[i] = vis_clusters[i + 1];
-  }
 
 #undef utf16_index
 
-  buffer->ensure (glyphs_len);
-  if (buffer->in_error)
-    FAIL ("Buffer in error");
 
 #undef FAIL
 
-  /* Set glyph infos */
-  buffer->len = 0;
-  for (unsigned int i = 0; i < glyphs_len; i++)
-  {
-    hb_glyph_info_t *info = &buffer->info[buffer->len++];
-
-    info->codepoint = glyphs[i];
-    info->cluster = vis_clusters[i];
-
-    /* The rest is crap.  Let's store position info there for now. */
-    info->mask = advances[i];
-    info->var1.u32 = offsets[i].du;
-    info->var2.u32 = offsets[i].dv;
-  }
-
-  /* Set glyph positions */
-  buffer->clear_positions ();
-  for (unsigned int i = 0; i < glyphs_len; i++)
-  {
-    hb_glyph_info_t *info = &buffer->info[i];
-    hb_glyph_position_t *pos = &buffer->pos[i];
-
-    /* TODO vertical */
-    pos->x_advance = info->mask;
-    pos->x_offset = info->var1.u32;
-    pos->y_offset = info->var2.u32;
-  }
 
   /* Wow, done! */
   return true;