Vertical Text

Vertical Text — Laying text out in vertical directions


enum        PangoGravity;
enum        PangoGravityHint;
#define     PANGO_GRAVITY_IS_VERTICAL       (gravity)
PangoGravity pango_gravity_get_for_matrix   (const PangoMatrix *matrix);
PangoGravity pango_gravity_get_for_script   (PangoScript script,
                                             PangoGravity base_gravity,
                                             PangoGravityHint hint);


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.


enum PangoGravity

typedef enum {
} PangoGravity;

The PangoGravity type represents the orientation of glyphs in a segment of text. This is useful when rendering vertical text layouts. In those situations, the layout is rotated using a non-identity PangoMatrix, and then glyph orientation is controlled using PangoGravity. Not every value in this enumeration makes sense for every usage of PangoGravity; for example, PANGO_GRAVITY_AUTO only can be passed to pango_context_set_base_gravity() and can only be returned by pango_context_get_base_gravity().

See also: PangoGravityHint

PANGO_GRAVITY_SOUTH Glyphs stand upright (default)
PANGO_GRAVITY_EAST Glyphs are rotated 90 degrees clockwise
PANGO_GRAVITY_NORTH Glyphs are upside-down
PANGO_GRAVITY_WEST Glyphs are rotated 90 degrees counter-clockwise
PANGO_GRAVITY_AUTO Gravity is resolved from the context matrix

Since 1.16


#define PANGO_TYPE_GRAVITY (pango_gravity_get_type())

The GObject type for PangoGravity.

enum PangoGravityHint

typedef enum {
} PangoGravityHint;

The PangoGravityHint defines how horizontal scripts should behave in a vertical context. That is, English excerpt in a vertical paragraph for example.

See PangoGravity.

PANGO_GRAVITY_HINT_NATURAL scripts will take their natural gravity based on the base gravity and the script. This is the default.
PANGO_GRAVITY_HINT_STRONG always use the base gravity set, regardless of the script.
PANGO_GRAVITY_HINT_LINE for scripts not in their natural direction (eg. Latin in East gravity), choose per-script gravity such that every script respects the line progression. This means, Latin and Arabic will take opposite gravities and both flow top-to-bottom for example.

Since 1.16


#define PANGO_TYPE_GRAVITY_HINT (pango_gravity_hint_get_type())

The GObject type for PangoGravity.


#define     PANGO_GRAVITY_IS_VERTICAL(gravity)

Whether a PangoGravity represents vertical writing directions.

gravity : the PangoGravity to check

Since 1.16

pango_gravity_get_for_matrix ()

PangoGravity pango_gravity_get_for_matrix   (const PangoMatrix *matrix);

Finds the gravity that best matches the rotation component in a PangoMatrix.

matrix : a PangoMatrix
Returns : the gravity of matrix, which will never be PANGO_GRAVITY_AUTO, or PANGO_GRAVITY_SOUTH if matrix is NULL

Since 1.16

pango_gravity_get_for_script ()

PangoGravity pango_gravity_get_for_script   (PangoScript script,
                                             PangoGravity base_gravity,
                                             PangoGravityHint hint);

Based on the script, base gravity, and hint, returns actual gravity to use in laying out a single PangoItem.

If base_gravity is PANGO_GRAVITY_AUTO, it is first replaced with the preferred gravity of script. To get the preferred gravity of a script, pass PANGO_GRAVITY_AUTO and PANGO_GRAVITY_HINT_STRONG in.

script : PangoScript to query
base_gravity : base gravity of the paragraph
hint : orientation hint
Returns : resolved gravity suitable to use for a run of text

Since 1.16