3.9 <PangoGravity>

Enumeration: <PangoGravity>

<PangoGravity> 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, auto only can be passed to context:set-base-gravity and can only be returned by context:get-base-gravity.

See also: <PangoGravityHint>

Members

south

Glyphs stand upright (default)

east

Glyphs are rotated 90 degrees counter-clockwise.

north

Glyphs are upside-down.

west

Glyphs are rotated 90 degrees clockwise.

auto

Gravity is resolved from the context matrix

Procedures

Procedure: gravity:get-for-matrix [matrix] ⇒ %return

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

matrix

Passed, or left out: a <PangoMatrix>, or #f.

a <PangoMatrix>

%return

Returned: a <PangoGravity>.

the gravity of matrix, which will never be auto, or south if matrix is #f

Procedure: gravity:get-for-script script base-gravity hint ⇒ %return

Returns the gravity to use in laying out a <PangoItem>.

The gravity is determined based on the script, base gravity, and hint.

If base-gravity is auto, it is first replaced with the preferred gravity of script. To get the preferred gravity of a script, pass auto and strong in.

script

Passed: a <PangoScript>, or one of its symbols.

<PangoScript> to query

base-gravity

Passed: a <PangoGravity>, or one of its symbols.

base gravity of the paragraph

hint

Passed: a <PangoGravityHint>, or one of its symbols.

orientation hint

%return

Returned: a <PangoGravity>.

resolved gravity suitable to use for a run of text with script

Procedure: gravity:get-for-script-and-width script wide base-gravity hint ⇒ %return

Returns the gravity to use in laying out a single character or <PangoItem>.

The gravity is determined based on the script, East Asian width, base gravity, and hint,

This function is similar to gravity:get-for-script except that this function makes a distinction between narrow/half-width and wide/full-width characters also. Wide/full-width characters always stand upright, that is, they always take the base gravity, whereas narrow/full-width characters are always rotated in vertical context.

If base-gravity is auto, it is first replaced with the preferred gravity of script.

script

Passed: a <PangoScript>, or one of its symbols.

<PangoScript> to query

wide

Passed: a boolean.

#t for wide characters as returned by unichar-iswide?

base-gravity

Passed: a <PangoGravity>, or one of its symbols.

base gravity of the paragraph

hint

Passed: a <PangoGravityHint>, or one of its symbols.

orientation hint

%return

Returned: a <PangoGravity>.

resolved gravity suitable to use for a run of text with script and wide.

Procedure: gravity:to-rotation gravity ⇒ %return

Converts a <PangoGravity> value to its natural rotation in radians.

Note that matrix:rotate takes angle in degrees, not radians. So, to call [method@Pango.Matrix,rotate] with the output of this function you should multiply it by (180. / G_PI).

gravity

Passed: a <PangoGravity>, or one of its symbols.

gravity to query, should not be auto

%return

Returned: a real number.

the rotation value corresponding to gravity.