1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtCore module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include "qunicodetables_p.h"
44 #include "qtextcodec.h"
46 #include "qharfbuzz_p.h"
52 HB_GraphemeClass HB_GetGraphemeClass(HB_UChar32 ch)
54 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
55 return (HB_GraphemeClass) prop->graphemeBreak;
58 HB_WordClass HB_GetWordClass(HB_UChar32 ch)
60 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
61 return (HB_WordClass) prop->wordBreak;
64 HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch)
66 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
67 return (HB_SentenceClass) prop->sentenceBreak;
70 HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch)
72 return (HB_LineBreakClass)QUnicodeTables::lineBreakClass(ch);
76 void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak)
78 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
79 *grapheme = (HB_GraphemeClass) prop->graphemeBreak;
80 *lineBreak = (HB_LineBreakClass) prop->line_break_class;
83 void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass)
85 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
86 *category = (HB_CharCategory)prop->category;
87 *combiningClass = prop->combiningClass;
90 HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch)
92 return (HB_CharCategory)QChar::category(ch);
95 int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch)
97 return QChar::combiningClass(ch);
100 HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
102 return QChar::mirroredChar(ch);
105 void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
110 return QLibrary::resolve(QLatin1String(library), version, symbol);
118 HB_Bool qShapeItem(HB_ShaperItem *item)
120 return HB_ShapeItem(item);
123 HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc)
125 return HB_AllocFace(font, tableFunc);
128 HB_Face qHBLoadFace(HB_Face face)
130 return HB_LoadFace(face);
133 void qHBFreeFace(HB_Face face)
138 void qGetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
139 const HB_ScriptItem *items, hb_uint32 numItems,
140 HB_CharAttributes *attributes)
142 HB_GetCharAttributes(string, stringLength, items, numItems, attributes);