You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

115 lines
3.8 KiB

  1. /* Pango
  2. * pango-gravity.h: Gravity routines
  3. *
  4. * Copyright (C) 2006, 2007 Red Hat Software
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef __PANGO_GRAVITY_H__
  22. #define __PANGO_GRAVITY_H__
  23. #include <glib.h>
  24. G_BEGIN_DECLS
  25. /**
  26. * PangoGravity:
  27. * @PANGO_GRAVITY_SOUTH: Glyphs stand upright (default)
  28. * @PANGO_GRAVITY_EAST: Glyphs are rotated 90 degrees clockwise
  29. * @PANGO_GRAVITY_NORTH: Glyphs are upside-down
  30. * @PANGO_GRAVITY_WEST: Glyphs are rotated 90 degrees counter-clockwise
  31. * @PANGO_GRAVITY_AUTO: Gravity is resolved from the context matrix
  32. *
  33. * The #PangoGravity type represents the orientation of glyphs in a segment
  34. * of text. This is useful when rendering vertical text layouts. In
  35. * those situations, the layout is rotated using a non-identity PangoMatrix,
  36. * and then glyph orientation is controlled using #PangoGravity.
  37. * Not every value in this enumeration makes sense for every usage of
  38. * #PangoGravity; for example, %PANGO_GRAVITY_AUTO only can be passed to
  39. * pango_context_set_base_gravity() and can only be returned by
  40. * pango_context_get_base_gravity().
  41. *
  42. * See also: #PangoGravityHint
  43. *
  44. * Since: 1.16
  45. **/
  46. typedef enum {
  47. PANGO_GRAVITY_SOUTH,
  48. PANGO_GRAVITY_EAST,
  49. PANGO_GRAVITY_NORTH,
  50. PANGO_GRAVITY_WEST,
  51. PANGO_GRAVITY_AUTO
  52. } PangoGravity;
  53. /**
  54. * PangoGravityHint:
  55. * @PANGO_GRAVITY_HINT_NATURAL: scripts will take their natural gravity based
  56. * on the base gravity and the script. This is the default.
  57. * @PANGO_GRAVITY_HINT_STRONG: always use the base gravity set, regardless of
  58. * the script.
  59. * @PANGO_GRAVITY_HINT_LINE: for scripts not in their natural direction (eg.
  60. * Latin in East gravity), choose per-script gravity such that every script
  61. * respects the line progression. This means, Latin and Arabic will take
  62. * opposite gravities and both flow top-to-bottom for example.
  63. *
  64. * The #PangoGravityHint defines how horizontal scripts should behave in a
  65. * vertical context. That is, English excerpt in a vertical paragraph for
  66. * example.
  67. *
  68. * See #PangoGravity.
  69. *
  70. * Since: 1.16
  71. **/
  72. typedef enum {
  73. PANGO_GRAVITY_HINT_NATURAL,
  74. PANGO_GRAVITY_HINT_STRONG,
  75. PANGO_GRAVITY_HINT_LINE
  76. } PangoGravityHint;
  77. /**
  78. * PANGO_GRAVITY_IS_VERTICAL:
  79. * @gravity: the #PangoGravity to check
  80. *
  81. * Whether a #PangoGravity represents vertical writing directions.
  82. *
  83. * Returns: %TRUE if @gravity is %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST,
  84. * %FALSE otherwise.
  85. *
  86. * Since: 1.16
  87. **/
  88. #define PANGO_GRAVITY_IS_VERTICAL(gravity) \
  89. ((gravity) == PANGO_GRAVITY_EAST || (gravity) == PANGO_GRAVITY_WEST)
  90. #include <pango/pango-matrix.h>
  91. #include <pango/pango-script.h>
  92. double pango_gravity_to_rotation (PangoGravity gravity) G_GNUC_CONST;
  93. PangoGravity pango_gravity_get_for_matrix (const PangoMatrix *matrix) G_GNUC_PURE;
  94. PangoGravity pango_gravity_get_for_script (PangoScript script,
  95. PangoGravity base_gravity,
  96. PangoGravityHint hint) G_GNUC_CONST;
  97. PangoGravity pango_gravity_get_for_script_and_width
  98. (PangoScript script,
  99. gboolean wide,
  100. PangoGravity base_gravity,
  101. PangoGravityHint hint) G_GNUC_CONST;
  102. G_END_DECLS
  103. #endif /* __PANGO_GRAVITY_H__ */