1 /*
2  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3  *
4  * This is part of HarfBuzz, an OpenType Layout engine library.
5  *
6  * Permission is hereby granted, without written agreement and without
7  * license or royalty fees, to use, copy, modify, and distribute this
8  * software and its documentation for any purpose, provided that the
9  * above copyright notice and the following two paragraphs appear in
10  * all copies of this software.
11  *
12  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16  * DAMAGE.
17  *
18  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23  */
24 
25 #ifndef HARFBUZZ_EXTERNAL_H
26 #define HARFBUZZ_EXTERNAL_H
27 
28 #include "harfbuzz-global.h"
29 
30 HB_BEGIN_HEADER
31 
32 /* This header contains some methods that are not part of
33    Harfbuzz itself, but referenced by it.
34    They need to be provided by the application/library
35 */
36 
37 
38 /*
39  see http://www.unicode.org/reports/tr14/tr14-19.html
40  we don't use the XX, AI and CB properties and map them to AL instead.
41  as we don't support any EBDIC based OS'es, NL is ignored and mapped to AL as well.
42 */
43 typedef enum {
44     HB_LineBreak_OP, HB_LineBreak_CL, HB_LineBreak_QU, HB_LineBreak_GL, HB_LineBreak_NS,
45     HB_LineBreak_EX, HB_LineBreak_SY, HB_LineBreak_IS, HB_LineBreak_PR, HB_LineBreak_PO,
46     HB_LineBreak_NU, HB_LineBreak_AL, HB_LineBreak_ID, HB_LineBreak_IN, HB_LineBreak_HY,
47     HB_LineBreak_BA, HB_LineBreak_BB, HB_LineBreak_B2, HB_LineBreak_ZW, HB_LineBreak_CM,
48     HB_LineBreak_WJ, HB_LineBreak_H2, HB_LineBreak_H3, HB_LineBreak_JL, HB_LineBreak_JV,
49     HB_LineBreak_JT, HB_LineBreak_SA, HB_LineBreak_SG,
50     HB_LineBreak_SP, HB_LineBreak_CR, HB_LineBreak_LF, HB_LineBreak_BK
51 } HB_LineBreakClass;
52 
53 typedef enum
54 {
55     HB_NoCategory,
56 
57     HB_Mark_NonSpacing,          /*   Mn */
58     HB_Mark_SpacingCombining,    /*   Mc */
59     HB_Mark_Enclosing,           /*   Me */
60 
61     HB_Number_DecimalDigit,      /*   Nd */
62     HB_Number_Letter,            /*   Nl */
63     HB_Number_Other,             /*   No */
64 
65     HB_Separator_Space,          /*   Zs */
66     HB_Separator_Line,           /*   Zl */
67     HB_Separator_Paragraph,      /*   Zp */
68 
69     HB_Other_Control,            /*   Cc */
70     HB_Other_Format,             /*   Cf */
71     HB_Other_Surrogate,          /*   Cs */
72     HB_Other_PrivateUse,         /*   Co */
73     HB_Other_NotAssigned,        /*   Cn */
74 
75     HB_Letter_Uppercase,         /*   Lu */
76     HB_Letter_Lowercase,         /*   Ll */
77     HB_Letter_Titlecase,         /*   Lt */
78     HB_Letter_Modifier,          /*   Lm */
79     HB_Letter_Other,             /*   Lo */
80 
81     HB_Punctuation_Connector,    /*   Pc */
82     HB_Punctuation_Dash,         /*   Pd */
83     HB_Punctuation_Open,         /*   Ps */
84     HB_Punctuation_Close,        /*   Pe */
85     HB_Punctuation_InitialQuote, /*   Pi */
86     HB_Punctuation_FinalQuote,   /*   Pf */
87     HB_Punctuation_Other,        /*   Po */
88 
89     HB_Symbol_Math,              /*   Sm */
90     HB_Symbol_Currency,          /*   Sc */
91     HB_Symbol_Modifier,          /*   Sk */
92     HB_Symbol_Other              /*   So */
93 } HB_CharCategory;
94 
95 typedef enum
96 {
97     HB_Grapheme_Other,
98     HB_Grapheme_CR,
99     HB_Grapheme_LF,
100     HB_Grapheme_Control,
101     HB_Grapheme_Extend,
102     HB_Grapheme_L,
103     HB_Grapheme_V,
104     HB_Grapheme_T,
105     HB_Grapheme_LV,
106     HB_Grapheme_LVT
107 } HB_GraphemeClass;
108 
109 
110 typedef enum
111 {
112     HB_Word_Other,
113     HB_Word_Format,
114     HB_Word_Katakana,
115     HB_Word_ALetter,
116     HB_Word_MidLetter,
117     HB_Word_MidNum,
118     HB_Word_Numeric,
119     HB_Word_ExtendNumLet
120 } HB_WordClass;
121 
122 
123 typedef enum
124 {
125     HB_Sentence_Other,
126     HB_Sentence_Sep,
127     HB_Sentence_Format,
128     HB_Sentence_Sp,
129     HB_Sentence_Lower,
130     HB_Sentence_Upper,
131     HB_Sentence_OLetter,
132     HB_Sentence_Numeric,
133     HB_Sentence_ATerm,
134     HB_Sentence_STerm,
135     HB_Sentence_Close
136 } HB_SentenceClass;
137 
138 HB_GraphemeClass HB_GetGraphemeClass(HB_UChar32 ch);
139 HB_WordClass HB_GetWordClass(HB_UChar32 ch);
140 HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch);
141 HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch);
142 
143 void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak);
144 void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass);
145 HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch);
146 int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch);
147 HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch);
148 
149 void *HB_Library_Resolve(const char *library, const char *symbol);
150 
151 void *HB_TextCodecForMib(int mib);
152 char *HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint32 length, hb_uint32 *outputLength);
153 void HB_TextCodec_FreeResult(char *);
154 
155 HB_END_HEADER
156 
157 #endif
158