blob: 45d1d9360bae3309ba7af73e3d0d4c1e3035657e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* Pango
* pango-bidi-type.c: Bidirectional Character Types
*
* Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "pango-bidi-type.h"
#include "mini-fribidi/fribidi.h"
/**
* pango_bidi_type_for_unichar
* @ch: a Unicode character
*
* Determines the normative bidirectional character type of a
* character, as specified in the Unicode Character Database.
*
* A simplified version of this function is available as
* pango_unichar_get_direction().
*
* Return value: the bidirectional character type, as used in the
* Unicode bidirectional algorithm.
*
* Since: 1.22
*/
PangoBidiType
pango_bidi_type_for_unichar (gunichar ch)
{
FriBidiCharType fribidi_ch_type = fribidi_get_type (ch);
switch (fribidi_ch_type)
{
case FRIBIDI_TYPE_LTR: return PANGO_BIDI_TYPE_L;
case FRIBIDI_TYPE_LRE: return PANGO_BIDI_TYPE_LRE;
case FRIBIDI_TYPE_LRO: return PANGO_BIDI_TYPE_LRO;
case FRIBIDI_TYPE_RTL: return PANGO_BIDI_TYPE_R;
case FRIBIDI_TYPE_AL: return PANGO_BIDI_TYPE_AL;
case FRIBIDI_TYPE_RLE: return PANGO_BIDI_TYPE_RLE;
case FRIBIDI_TYPE_RLO: return PANGO_BIDI_TYPE_RLO;
case FRIBIDI_TYPE_PDF: return PANGO_BIDI_TYPE_PDF;
case FRIBIDI_TYPE_EN: return PANGO_BIDI_TYPE_EN;
case FRIBIDI_TYPE_ES: return PANGO_BIDI_TYPE_ES;
case FRIBIDI_TYPE_ET: return PANGO_BIDI_TYPE_ET;
case FRIBIDI_TYPE_AN: return PANGO_BIDI_TYPE_AN;
case FRIBIDI_TYPE_CS: return PANGO_BIDI_TYPE_CS;
case FRIBIDI_TYPE_NSM: return PANGO_BIDI_TYPE_NSM;
case FRIBIDI_TYPE_BN: return PANGO_BIDI_TYPE_BN;
case FRIBIDI_TYPE_BS: return PANGO_BIDI_TYPE_B;
case FRIBIDI_TYPE_SS: return PANGO_BIDI_TYPE_S;
case FRIBIDI_TYPE_WS: return PANGO_BIDI_TYPE_WS;
case FRIBIDI_TYPE_ON: return PANGO_BIDI_TYPE_ON;
default:
g_assert_not_reached ();
return PANGO_BIDI_TYPE_ON;
}
}
|