summaryrefslogtreecommitdiff
path: root/docs/tmpl/vertical.sgml
blob: 83e33a1e3c05665f6423a5a6288996e0861855b5 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!-- ##### SECTION Title ##### -->
Vertical Text

<!-- ##### SECTION Short_Description ##### -->
Laying text out in vertical directions

<!-- ##### SECTION Long_Description ##### -->
<para>
Since 1.16, Pango is able to correctly lay vertical text out.  In fact, it can
set layouts of mixed vertical and non-vertical text.  This section describes
the types used for setting vertical text parameters.
</para>
<para>
The way this is implemented is through the concept of
<firstterm>gravity</firstterm>.  Gravity of normal Latin text is south.  A
gravity value of east means that glyphs will be rotated ninety degrees
counterclockwise.  So, to render vertical text one needs to set the gravity
and rotate the layout using the matrix machinery already in place.  This has
the huge advantage that most algorithms working on a #PangoLayout do not need
any change as the assumption that lines run in the X direction and stack in
the Y direction holds even for vertical text layouts.
</para>
<para>
Applications should only need to set base gravity on #PangoContext in use, and
let Pango decide the gravity assigned to each run of text.  This automatically
handles text with mixed scripts.  A very common use is to set the context base
gravity to auto using pango_context_set_base_gravity()
and rotate the layout normally.  Pango will make sure that
Asian languages take the right form, while other scripts are rotated normally.
</para>
<para>
The correct way to set gravity on a layout is to set it on the context
associated with it using pango_context_set_base_gravity().  The context
of a layout can be accessed using pango_layout_get_context().  The currently
set base gravity of the context can be accessed using
pango_context_get_base_gravity() and the <firstterm>resolved</firstterm>
gravity of it using pango_context_get_gravity().  The resolved gravity is
the same as the base gravity for the most part, except that if the base
gravity is set to %PANGO_GRAVITY_AUTO, the resolved gravity will depend
on the current matrix set on context, and is derived using
pango_gravity_get_for_matrix().
</para>
<para>
The next thing an application may want to set on the context is the
<firstterm>gravity hint</firstterm>.  A #PangoGravityHint instructs how
different scripts should react to the set base gravity.
</para>
<para>
Font descriptions have a gravity property too, that can be set using
pango_font_description_set_gravity() and accessed using
pango_font_description_get_gravity().  However, those are rarely useful
from application code and are mainly used by #PangoLayout internally.
</para>
<para>
Last but not least, one can create #PangoAttribute<!---->s for gravity
and gravity hint using pango_attr_gravity_new() and
pango_attr_gravity_hint_new().
</para>

<!-- ##### SECTION See_Also ##### -->
<para>
pango_context_get_base_gravity(),
pango_context_set_base_gravity(),
pango_context_get_gravity(),
pango_context_get_gravity_hint(),
pango_context_set_gravity_hint(),
pango_font_description_set_gravity(),
pango_font_description_get_gravity(),
pango_attr_gravity_new(),
pango_attr_gravity_hint_new()
</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### ENUM PangoGravity ##### -->
<para>

</para>

@PANGO_GRAVITY_SOUTH: 
@PANGO_GRAVITY_EAST: 
@PANGO_GRAVITY_NORTH: 
@PANGO_GRAVITY_WEST: 
@PANGO_GRAVITY_AUTO: 

<!-- ##### ENUM PangoGravityHint ##### -->
<para>

</para>

@PANGO_GRAVITY_HINT_NATURAL: 
@PANGO_GRAVITY_HINT_STRONG: 
@PANGO_GRAVITY_HINT_LINE: 

<!-- ##### MACRO PANGO_GRAVITY_IS_VERTICAL ##### -->
<para>

</para>

@gravity: 


<!-- ##### FUNCTION pango_gravity_get_for_matrix ##### -->
<para>

</para>

@matrix: 
@Returns: 


<!-- ##### FUNCTION pango_gravity_get_for_script ##### -->
<para>

</para>

@script: 
@base_gravity: 
@hint: 
@Returns: 


<!-- ##### FUNCTION pango_gravity_get_for_script_and_width ##### -->
<para>

</para>

@script: 
@wide: 
@base_gravity: 
@hint: 
@Returns: 


<!-- ##### FUNCTION pango_gravity_to_rotation ##### -->
<para>

</para>

@gravity: 
@Returns: