1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module pango.c.gravity; 7 8 import pango.c.script; 9 import pango.c.matrix; 10 11 import glib; 12 13 14 /** 15 * PangoGravity: 16 * @PANGO_GRAVITY_SOUTH: Glyphs stand upright (default) 17 * @PANGO_GRAVITY_EAST: Glyphs are rotated 90 degrees clockwise 18 * @PANGO_GRAVITY_NORTH: Glyphs are upside-down 19 * @PANGO_GRAVITY_WEST: Glyphs are rotated 90 degrees counter-clockwise 20 * @PANGO_GRAVITY_AUTO: Gravity is resolved from the context matrix 21 * 22 * The #PangoGravity type represents the orientation of glyphs in a segment 23 * of text. This is useful when rendering vertical text layouts. In 24 * those situations, the layout is rotated using a non-identity PangoMatrix, 25 * and then glyph orientation is controlled using #PangoGravity. 26 * Not every value in this enumeration makes sense for every usage of 27 * #PangoGravity; for example, %PANGO_GRAVITY_AUTO only can be passed to 28 * pango_context_set_base_gravity() and can only be returned by 29 * pango_context_get_base_gravity(). 30 * 31 * See also: #PangoGravityHint 32 * 33 * Since: 1.16 34 **/ 35 enum PangoGravity { 36 PANGO_GRAVITY_SOUTH, 37 PANGO_GRAVITY_EAST, 38 PANGO_GRAVITY_NORTH, 39 PANGO_GRAVITY_WEST, 40 PANGO_GRAVITY_AUTO 41 } 42 43 /** 44 * PangoGravityHint: 45 * @PANGO_GRAVITY_HINT_NATURAL: scripts will take their natural gravity based 46 * on the base gravity and the script. This is the default. 47 * @PANGO_GRAVITY_HINT_STRONG: always use the base gravity set, regardless of 48 * the script. 49 * @PANGO_GRAVITY_HINT_LINE: for scripts not in their natural direction (eg. 50 * Latin in East gravity), choose per-script gravity such that every script 51 * respects the line progression. This means, Latin and Arabic will take 52 * opposite gravities and both flow top-to-bottom for example. 53 * 54 * The #PangoGravityHint defines how horizontal scripts should behave in a 55 * vertical context. That is, English excerpt in a vertical paragraph for 56 * example. 57 * 58 * See #PangoGravity. 59 * 60 * Since: 1.16 61 **/ 62 enum PangoGravityHint { 63 PANGO_GRAVITY_HINT_NATURAL, 64 PANGO_GRAVITY_HINT_STRONG, 65 PANGO_GRAVITY_HINT_LINE 66 } 67 68 /** 69 * PANGO_GRAVITY_IS_VERTICAL: 70 * @gravity: the #PangoGravity to check 71 * 72 * Whether a #PangoGravity represents vertical writing directions. 73 * 74 * Returns: %TRUE if @gravity is %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST, 75 * %FALSE otherwise. 76 * 77 * Since: 1.16 78 **/ 79 auto PANGO_GRAVITY_IS_VERTICAL(G)(G gravity) { 80 return gravity == PANGO_GRAVITY_EAST || gravity == PANGO_GRAVITY_WEST; 81 } 82 83 /** 84 * PANGO_GRAVITY_IS_IMPROPER: 85 * @gravity: the #PangoGravity to check 86 * 87 * Whether a #PangoGravity represents a gravity that results in reversal of text direction. 88 * 89 * Returns: %TRUE if @gravity is %PANGO_GRAVITY_WEST or %PANGO_GRAVITY_NORTH, 90 * %FALSE otherwise. 91 * 92 * Since: 1.32 93 **/ 94 auto PANGO_GRAVITY_IS_IMPROPER(G)(G gravity) { 95 return (gravity) == PANGO_GRAVITY_WEST || (gravity) == PANGO_GRAVITY_NORTH; 96 } 97 98 99 pure double pango_gravity_to_rotation (PangoGravity gravity); 100 101 pure PangoGravity pango_gravity_get_for_matrix (const(PangoMatrix) *matrix); 102 103 pure PangoGravity pango_gravity_get_for_script (PangoScript script, 104 PangoGravity base_gravity, 105 PangoGravityHint hint); 106 107 pure PangoGravity pango_gravity_get_for_script_and_width 108 (PangoScript script, 109 gboolean wide, 110 PangoGravity base_gravity, 111 PangoGravityHint hint); 112