source: trunk/src/3rdparty/harfbuzz/tests/linebreaking/harfbuzz-qt.cpp

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 2.7 KB
Line 
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#include <harfbuzz-external.h>
26#include <Qt/private/qunicodetables_p.h>
27#include <QLibrary>
28#include <QTextCodec>
29
30extern "C" {
31
32HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch)
33{
34#if QT_VERSION >= 0x040300
35 return (HB_LineBreakClass)QUnicodeTables::lineBreakClass(ch);
36#else
37#error "This test currently requires Qt >= 4.3"
38#endif
39}
40
41void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass)
42{
43 *category = (HB_CharCategory)QChar::category(ch);
44 *combiningClass = QChar::combiningClass(ch);
45}
46
47HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch)
48{
49 return (HB_CharCategory)QChar::category(ch);
50}
51
52int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch)
53{
54 return QChar::combiningClass(ch);
55}
56
57HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
58{
59 return QChar::mirroredChar(ch);
60}
61
62HB_WordClass HB_GetWordClass(HB_UChar32 ch)
63{
64 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
65 return (HB_WordClass) prop->wordBreak;
66}
67
68
69HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch)
70{
71 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
72 return (HB_SentenceClass) prop->sentenceBreak;
73}
74
75void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak)
76{
77 const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
78 *grapheme = (HB_GraphemeClass) prop->graphemeBreak;
79 *lineBreak = (HB_LineBreakClass) prop->line_break_class;
80}
81
82void *HB_Library_Resolve(const char *library, int version, const char *symbol)
83{
84 return QLibrary::resolve(library, version, symbol);
85}
86
87}
Note: See TracBrowser for help on using the repository browser.