fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / harfbuzz / harfbuzz-0.9.16-winxp.patch.1
blob3787136039bb600c16c0ea06d25115d7add58721
1 --- harfbuzz-0.9.16/src/hb-uniscribe.cc 2013-04-19 03:36:12.000000000 +0200
2 +++ harfbuzz-0.9.16/src/hb-uniscribe.cc 2013-05-08 17:13:37.874217344 +0200
3 @@ -44,6 +44,10 @@
4  #endif
5  
6  
7 +typedef HRESULT WINAPI (*SIOT)(const WCHAR*,int,int,const SCRIPT_CONTROL*,const SCRIPT_STATE*,SCRIPT_ITEM*,OPENTYPE_TAG*,int*);
8 +typedef HRESULT WINAPI (*SSOT)(HDC,SCRIPT_CACHE*,SCRIPT_ANALYSIS*,OPENTYPE_TAG,OPENTYPE_TAG,int*,TEXTRANGE_PROPERTIES**,int,const WCHAR*,int,int,WORD*,SCRIPT_CHARPROP*,WORD*,SCRIPT_GLYPHPROP*,int*);
9 +typedef HRESULT WINAPI (*SPOT)(HDC,SCRIPT_CACHE*,SCRIPT_ANALYSIS*,OPENTYPE_TAG,OPENTYPE_TAG,int*,TEXTRANGE_PROPERTIES**,int,const WCHAR*,const WORD*,const SCRIPT_CHARPROP*,int,const WORD*,const SCRIPT_GLYPHPROP*,int,int*,GOFFSET*,ABC*);
11  /*
12  DWORD GetFontData(
13    __in   HDC hdc,
14 @@ -240,6 +244,11 @@
15    hb_face_t *face = font->face;
16    hb_uniscribe_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
17    hb_uniscribe_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
18 +  SIOT siot = NULL;
19 +  SSOT ssot = NULL;
20 +  SPOT spot = NULL;
21 +  HMODULE hinstLib = GetModuleHandle("usp10.dll");
22 +    
24  #define FAIL(...) \
25    HB_STMT_START { \
26 @@ -249,6 +258,15 @@
28    HRESULT hr;
30 +  if (hinstLib)
31 +  {
32 +    siot = (SIOT)GetProcAddress(hinstLib, "ScriptItemizeOpenType");
33 +  
34 +    ssot = (SSOT)GetProcAddress(hinstLib, "ScriptShapeOpenType");
35 +  
36 +    spot = (SPOT)GetProcAddress(hinstLib, "ScriptPlaceOpenType");
37 +  }
38 +  
39  retry:
41    unsigned int scratch_size;
42 @@ -291,6 +309,7 @@
44    ALLOCATE_ARRAY (WORD, glyphs, glyphs_size);
45    ALLOCATE_ARRAY (SCRIPT_GLYPHPROP, glyph_props, glyphs_size);
46 +  ALLOCATE_ARRAY (SCRIPT_VISATTR, vis_attr, glyphs_size);
47    ALLOCATE_ARRAY (int, advances, glyphs_size);
48    ALLOCATE_ARRAY (GOFFSET, offsets, glyphs_size);
49    ALLOCATE_ARRAY (uint32_t, vis_clusters, glyphs_size);
50 @@ -312,7 +331,8 @@
51    bidi_state.uBidiLevel = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
52    bidi_state.fOverrideDirection = 1;
54 -  hr = ScriptItemizeOpenType (wchars,
55 +  if (siot && ssot && spot) {
56 +    hr = siot (wchars,
57                               chars_len,
58                               MAX_ITEMS,
59                               &bidi_control,
60 @@ -320,6 +340,16 @@
61                               items,
62                               script_tags,
63                               &item_count);
64 +  }
65 +  else {
66 +    hr = ScriptItemize(wchars,
67 +                               chars_len,
68 +                               MAX_ITEMS,
69 +                               &bidi_control,
70 +                               &bidi_state,
71 +                               items,
72 +                               &item_count);
73 +  }
74    if (unlikely (FAILED (hr)))
75      FAIL ("ScriptItemizeOpenType() failed: 0x%08xL", hr);
77 @@ -344,7 +374,8 @@
78      unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
80    retry_shape:
81 -    hr = ScriptShapeOpenType (font_data->hdc,
82 +    if (siot && ssot && spot) {
83 +      hr = ssot (font_data->hdc,
84                               &font_data->script_cache,
85                               &items[i].a,
86                               script_tags[i],
87 @@ -361,6 +392,20 @@
88                               glyphs + glyphs_offset,
89                               glyph_props + glyphs_offset,
90                               (int *) &glyphs_len);
91 +    }
92 +       else {
93 +      hr = ScriptShape (font_data->hdc,
94 +                               &font_data->script_cache,
95 +                               wchars + chars_offset,
96 +                               item_chars_len,
97 +                               glyphs_size - glyphs_offset,
98 +                               &items[i].a,
99 +                               /* out */
100 +                               glyphs + glyphs_offset,
101 +                               log_clusters + chars_offset,
102 +                               vis_attr + glyphs_offset,
103 +                               (int *) &glyphs_len);
104 +       }
106      if (unlikely (items[i].a.fNoGlyphIndex))
107        FAIL ("ScriptShapeOpenType() set fNoGlyphIndex");
108 @@ -386,7 +431,8 @@
109      for (unsigned int j = chars_offset; j < chars_offset + item_chars_len; j++)
110        log_clusters[j] += glyphs_offset;
112 -    hr = ScriptPlaceOpenType (font_data->hdc,
113 +    if (siot && ssot && spot) {
114 +      hr = spot (font_data->hdc,
115                               &font_data->script_cache,
116                               &items[i].a,
117                               script_tags[i],
118 @@ -405,6 +451,19 @@
119                               advances + glyphs_offset,
120                               offsets + glyphs_offset,
121                               NULL);
122 +    }
123 +       else {
124 +      hr = ScriptPlace (font_data->hdc,
125 +                               &font_data->script_cache,
126 +                               glyphs + glyphs_offset,
127 +                               glyphs_len,
128 +                               vis_attr + glyphs_offset,
129 +                               &items[i].a,
130 +                               /* out */
131 +                               advances + glyphs_offset,
132 +                               offsets + glyphs_offset,
133 +                               NULL);
134 +    }
135      if (unlikely (FAILED (hr)))
136        FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr);