Export QTextImageHandler and add accessor for image
[profile/ivi/qtbase.git] / src / gui / text / qharfbuzz_copy_p.h
1 /*
2  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3  * Copyright (C) 2007  Red Hat, Inc.
4  *
5  * This code is a modified version of some part of HarfBuzz,
6  * an OpenType Layout engine library.
7  *
8  * Permission is hereby granted, without written agreement and without
9  * license or royalty fees, to use, copy, modify, and distribute this
10  * software and its documentation for any purpose, provided that the
11  * above copyright notice and the following two paragraphs appear in
12  * all copies of this software.
13  *
14  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18  * DAMAGE.
19  *
20  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25  *
26  * Red Hat Author(s): Behdad Esfahbod
27  */
28
29 #ifndef QHARFBUZZ_COPY_P_H
30 #define QHARFBUZZ_COPY_P_H
31
32 /*
33   The purpose of this header file is to allow inclusion of the private
34   headers for font and text classes without having to pull in the full
35   harfbuzz library under QTDIR/src/3rdparty/harfbuzz/src
36 */
37 #if defined(QT_BUILD_GUI_LIB) || defined(QT_COMPILES_IN_HARFBUZZ)
38 #include <private/qharfbuzz_p.h>
39 #else
40
41 extern "C" {
42
43 #ifdef  __xlC__
44 typedef unsigned hb_bitfield;
45 #else
46 typedef QT_PREPEND_NAMESPACE(quint8) hb_bitfield;
47 #endif
48
49 typedef enum {
50   /* no error */
51   HB_Err_Ok                           = 0x0000,
52   HB_Err_Not_Covered                  = 0xFFFF,
53
54   /* _hb_err() is called whenever returning the following errors,
55    * and in a couple places for HB_Err_Not_Covered too. */
56
57   /* programmer error */
58   HB_Err_Invalid_Argument             = 0x1A66,
59
60   /* font error */
61   HB_Err_Invalid_SubTable_Format      = 0x157F,
62   HB_Err_Invalid_SubTable             = 0x1570,
63   HB_Err_Read_Error                   = 0x6EAD,
64
65   /* system error */
66   HB_Err_Out_Of_Memory                = 0xDEAD
67 } HB_Error;
68
69 typedef enum {
70     HB_NoBreak,
71     HB_SoftHyphen,
72     HB_Break,
73     HB_ForcedBreak
74 } HB_LineBreakType;
75
76 typedef QT_PREPEND_NAMESPACE(quint32) HB_Glyph;
77 typedef void * HB_Font;
78 typedef void * HB_Face;
79 typedef void * HB_FontRec;
80 typedef QT_PREPEND_NAMESPACE(quint32) hb_uint32;
81 typedef QT_PREPEND_NAMESPACE(qint32) HB_Fixed;
82
83 typedef struct {
84     HB_Fixed x;
85     HB_Fixed y;
86 } HB_FixedPoint;
87
88 // The GlyphAttrbutes class is used inline so it needs to be complete.
89 typedef struct {
90     hb_bitfield justification   :4;  /* Justification class */
91     hb_bitfield clusterStart    :1;  /* First glyph of representation of cluster */
92     hb_bitfield mark            :1;  /* needs to be positioned around base char */
93     hb_bitfield zeroWidth       :1;  /* ZWJ, ZWNJ etc, with no width */
94     hb_bitfield dontPrint       :1;
95     hb_bitfield combiningClass  :8;
96 } HB_GlyphAttributes;
97
98 // This struct is strictly not needed, but we replicate it completely in
99 // case the compiler tries to get clever with padding.
100 typedef struct {
101     /*HB_LineBreakType*/ hb_bitfield lineBreakType  :2;
102     /*HB_Bool*/ hb_bitfield whiteSpace              :1;     /* A unicode whitespace character, except NBSP, ZWNBSP */
103     /*HB_Bool*/ hb_bitfield charStop                :1;     /* Valid cursor position (for left/right arrow) */
104     /*HB_Bool*/ hb_bitfield wordBoundary            :1;
105     /*HB_Bool*/ hb_bitfield sentenceBoundary        :1;
106     hb_bitfield unused                  :2;
107 } HB_CharAttributes;
108
109 }
110
111 #endif // ifdef QT_BUILD_GUI_LIB
112
113 #endif // QHARFBUZZ_COPY_P_H