📄 pango-vertical-text.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Vertical Text</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="index.html" title="Pango Reference Manual"><link rel="up" href="pango.html" title="Basic Pango Interfaces"><link rel="prev" href="pango-Scripts.html" title="Scripts"><link rel="next" href="rendering.html" title="Rendering with Pango"><meta name="generator" content="GTK-Doc V1.8 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="chapter" href="pango.html" title="Basic Pango Interfaces"><link rel="chapter" href="rendering.html" title="Rendering with Pango"><link rel="chapter" href="lowlevel.html" title="Low Level Functionality"><link rel="chapter" href="tools.html" title="Pango Tools"><link rel="chapter" href="pango-hierarchy.html" title="Object Hierarchy"><link rel="index" href="index-all.html" title="Index"><link rel="index" href="index-deprecated.html" title="Index of deprecated symbols"><link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2"><link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4"><link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6"><link rel="index" href="index-1.8.html" title="Index of new symbols in 1.8"><link rel="index" href="index-1.10.html" title="Index of new symbols in 1.10"><link rel="index" href="index-1.12.html" title="Index of new symbols in 1.12"><link rel="index" href="index-1.14.html" title="Index of new symbols in 1.14"><link rel="index" href="index-1.16.html" title="Index of new symbols in 1.16"><link rel="index" href="index-1.18.html" title="Index of new symbols in 1.18"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="pango-Scripts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pango.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Pango Reference Manual</th><td><a accesskey="n" href="rendering.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3199684" class="shortcut">Top</a>  |  <a href="#id3199802" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="pango-Vertical-Text"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3199684"></a><span class="refentrytitle">Vertical Text</span></h2><p>Vertical Text — Laying text out in vertical directions</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">enum <a href="pango-Vertical-Text.html#PangoGravity">PangoGravity</a>;#define <a href="pango-Vertical-Text.html#PANGO-TYPE-GRAVITY:CAPS">PANGO_TYPE_GRAVITY</a>enum <a href="pango-Vertical-Text.html#PangoGravityHint">PangoGravityHint</a>;#define <a href="pango-Vertical-Text.html#PANGO-TYPE-GRAVITY-HINT:CAPS">PANGO_TYPE_GRAVITY_HINT</a>#define <a href="pango-Vertical-Text.html#PANGO-GRAVITY-IS-VERTICAL:CAPS">PANGO_GRAVITY_IS_VERTICAL</a> (gravity)<a href="pango-Vertical-Text.html#PangoGravity">PangoGravity</a> <a href="pango-Vertical-Text.html#pango-gravity-get-for-matrix">pango_gravity_get_for_matrix</a> (const <a href="pango-Glyph-Storage.html#PangoMatrix">PangoMatrix</a> *matrix);<a href="pango-Vertical-Text.html#PangoGravity">PangoGravity</a> <a href="pango-Vertical-Text.html#pango-gravity-get-for-script">pango_gravity_get_for_script</a> (<a href="pango-Scripts.html#PangoScript">PangoScript</a> script, <a href="pango-Vertical-Text.html#PangoGravity">PangoGravity</a> base_gravity, <a href="pango-Vertical-Text.html#PangoGravityHint">PangoGravityHint</a> hint);</pre></div><div class="refsect1" lang="en"><a name="id3199802"></a><h2>Description</h2><p>Since 1.16, Pango is able to correctly lay vertical text out. In fact, it canset layouts of mixed vertical and non-vertical text. This section describesthe types used for setting vertical text parameters.</p><p>The way this is implemented is through the concept of<em class="firstterm">gravity</em>. Gravity of normal Latin text is south. Agravity value of east means that glyphs will be rotated ninety degreescounterclockwise. So, to render vertical text one needs to set the gravityand rotate the layout using the matrix machinery already in place. This hasthe huge advantage that most algorithms working on a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> do not needany change as the assumption that lines run in the X direction and stack inthe Y direction holds even for vertical text layouts.</p><p>Applications should only need to set base gravity on <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> in use, andlet Pango decide the gravity assigned to each run of text. This automaticallyhandles text with mixed scripts. A very common use is to set the context basegravity to auto and rotate the layout normally. Pango will make sure thatAsian languages take the right form, while other scripts are rotated normally.</p></div><div class="refsect1" lang="en"><a name="id3199862"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3199872"></a><h3><a name="PangoGravity"></a>enum PangoGravity</h3><a class="indexterm" name="id3199887"></a><pre class="programlisting">typedef enum { PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_EAST, PANGO_GRAVITY_NORTH, PANGO_GRAVITY_WEST, PANGO_GRAVITY_AUTO} PangoGravity;</pre><p>The <a href="pango-Vertical-Text.html#PangoGravity"><span class="type">PangoGravity</span></a> type represents the orientation of glyphs in a segmentof text. This is useful when rendering vertical text layouts. Inthose situations, the layout is rotated using a non-identity PangoMatrix,and then glyph orientation is controlled using <a href="pango-Vertical-Text.html#PangoGravity"><span class="type">PangoGravity</span></a>.Not every value in this enumeration makes sense for every usage of<a href="pango-Vertical-Text.html#PangoGravity"><span class="type">PangoGravity</span></a>; for example, <a href="pango-Vertical-Text.html#PANGO-GRAVITY-AUTO:CAPS"><code class="literal">PANGO_GRAVITY_AUTO</code></a> only can be passed to<a href="pango-Text-Processing.html#pango-context-set-base-gravity"><code class="function">pango_context_set_base_gravity()</code></a> and can only be returned by<a href="pango-Text-Processing.html#pango-context-get-base-gravity"><code class="function">pango_context_get_base_gravity()</code></a>.</p><p>See also: <a href="pango-Vertical-Text.html#PangoGravityHint"><span class="type">PangoGravityHint</span></a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a name="PANGO-GRAVITY-SOUTH:CAPS"></a><code class="literal">PANGO_GRAVITY_SOUTH</code></span></td><td> Glyphs stand upright (default)</td></tr><tr><td><span class="term"><a name="PANGO-GRAVITY-EAST:CAPS"></a><code class="literal">PANGO_GRAVITY_EAST</code></span></td><td> Glyphs are rotated 90 degrees clockwise</td></tr><tr><td><span class="term"><a name="PANGO-GRAVITY-NORTH:CAPS"></a><code class="literal">PANGO_GRAVITY_NORTH</code></span></td><td> Glyphs are upside-down</td></tr><tr><td><span class="term"><a name="PANGO-GRAVITY-WEST:CAPS"></a><code class="literal">PANGO_GRAVITY_WEST</code></span></td><td> Glyphs are rotated 90 degrees counter-clockwise</td></tr><tr><td><span class="term"><a name="PANGO-GRAVITY-AUTO:CAPS"></a><code class="literal">PANGO_GRAVITY_AUTO</code></span></td><td> Gravity is resolved from the context matrix</td></tr></tbody></table></div><p class="since">Since 1.16</p></div><hr><div class="refsect2" lang="en"><a name="id3200108"></a><h3><a name="PANGO-TYPE-GRAVITY:CAPS"></a>PANGO_TYPE_GRAVITY</h3><a class="indexterm" name="id3200121"></a><pre class="programlisting">#define PANGO_TYPE_GRAVITY (pango_gravity_get_type())</pre><p>The <ahref="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> type for <a href="pango-Vertical-Text.html#PangoGravity"><span class="type">PangoGravity</span></a>.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -