1f6335acb03dfb2a9b3ddd5074f6145f22092ec7
[platform/upstream/harfbuzz.git] / patch / remove-icu-header-dependencies-from-harfbuzz-header.patch
1 From d90ac5141407d6c3278bb67784ea8cec1743ff89 Mon Sep 17 00:00:00 2001
2 From: Bowon Ryu <bowon.ryu@samsung.com>
3 Date: Tue, 25 Feb 2020 17:22:46 +0900
4 Subject: [PATCH] remove icu header dependencies from harfbuzz header
5
6 Harfbuzz header include icu header that is not Tizen public API.
7 In order to remove icu header from rootstrap, icu header dependencies
8 should be removed.
9
10 @tizen_fix
11
12 Change-Id: Iecf2c69345cdb795c63be238895796e1d4adc610
13 Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
14 ---
15  src/hb-icu.cc | 17 ++++++++++-------
16  src/hb-icu.h  |  5 ++---
17  2 files changed, 12 insertions(+), 10 deletions(-)
18
19 diff --git a/src/hb-icu.cc b/src/hb-icu.cc
20 index 985ff02..4767722 100644
21 --- a/src/hb-icu.cc
22 +++ b/src/hb-icu.cc
23 @@ -40,6 +40,7 @@
24  #include <unicode/ustring.h>
25  #include <unicode/utf16.h>
26  #include <unicode/uversion.h>
27 +#include <unicode/uscript.h>
28  
29  /* ICU extra semicolon, fixed since 65, https://github.com/unicode-org/icu/commit/480bec3 */
30  #if U_ICU_VERSION_MAJOR_NUM < 65 && (defined(__GNUC__) || defined(__clang__))
31 @@ -58,26 +59,28 @@
32   **/
33  
34  hb_script_t
35 -hb_icu_script_to_script (UScriptCode script)
36 +hb_icu_script_to_script (unsigned int numScript)
37  {
38 +  UScriptCode script = (UScriptCode) numScript;
39 +
40    if (unlikely (script == USCRIPT_INVALID_CODE))
41      return HB_SCRIPT_INVALID;
42  
43    return hb_script_from_string (uscript_getShortName (script), -1);
44  }
45  
46 -UScriptCode
47 +unsigned int
48  hb_icu_script_from_script (hb_script_t script)
49  {
50    if (unlikely (script == HB_SCRIPT_INVALID))
51 -    return USCRIPT_INVALID_CODE;
52 +    return (unsigned int) USCRIPT_INVALID_CODE;
53  
54    unsigned int numScriptCode = 1 + u_getIntPropertyMaxValue (UCHAR_SCRIPT);
55    for (unsigned int i = 0; i < numScriptCode; i++)
56 -    if (unlikely (hb_icu_script_to_script ((UScriptCode) i) == script))
57 -      return (UScriptCode) i;
58 +    if (unlikely (hb_icu_script_to_script (i) == script))
59 +      return i;
60  
61 -  return USCRIPT_UNKNOWN;
62 +  return (unsigned int) USCRIPT_UNKNOWN;
63  }
64  
65  
66 @@ -160,7 +163,7 @@ hb_icu_unicode_script (hb_unicode_funcs_t *ufuncs HB_UNUSED,
67    if (unlikely (U_FAILURE (status)))
68      return HB_SCRIPT_UNKNOWN;
69  
70 -  return hb_icu_script_to_script (scriptCode);
71 +  return hb_icu_script_to_script ((unsigned int) scriptCode);
72  }
73  
74  static hb_bool_t
75 diff --git a/src/hb-icu.h b/src/hb-icu.h
76 index 2db6a7b..dc6d7aa 100644
77 --- a/src/hb-icu.h
78 +++ b/src/hb-icu.h
79 @@ -31,15 +31,14 @@
80  
81  #include "hb.h"
82  
83 -#include <unicode/uscript.h>
84  
85  HB_BEGIN_DECLS
86  
87  
88  HB_EXTERN hb_script_t
89 -hb_icu_script_to_script (UScriptCode script);
90 +hb_icu_script_to_script (unsigned int numScript);
91  
92 -HB_EXTERN UScriptCode
93 +HB_EXTERN unsigned int
94  hb_icu_script_from_script (hb_script_t script);
95  
96  
97 -- 
98 2.7.4
99