hb-ot-metrics.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright © 2018 Ebrahim Byagowi
  3. *
  4. * This is part of HarfBuzz, a text shaping library.
  5. *
  6. * Permission is hereby granted, without written agreement and without
  7. * license or royalty fees, to use, copy, modify, and distribute this
  8. * software and its documentation for any purpose, provided that the
  9. * above copyright notice and the following two paragraphs appear in
  10. * all copies of this software.
  11. *
  12. * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
  13. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  14. * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
  15. * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  16. * DAMAGE.
  17. *
  18. * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
  19. * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  20. * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  21. * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
  22. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  23. */
  24. #ifndef HB_OT_H_IN
  25. #error "Include <hb-ot.h> instead."
  26. #endif
  27. #ifndef HB_OT_METRICS_H
  28. #define HB_OT_METRICS_H
  29. #include "hb.h"
  30. #include "hb-ot-name.h"
  31. HB_BEGIN_DECLS
  32. /**
  33. * hb_ot_metrics_tag_t:
  34. * @HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: horizontal ascender.
  35. * @HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: horizontal descender.
  36. * @HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: horizontal line gap.
  37. * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: horizontal clipping ascent.
  38. * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: horizontal clipping descent.
  39. * @HB_OT_METRICS_TAG_VERTICAL_ASCENDER: vertical ascender.
  40. * @HB_OT_METRICS_TAG_VERTICAL_DESCENDER: vertical descender.
  41. * @HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: vertical line gap.
  42. * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: horizontal caret rise.
  43. * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: horizontal caret run.
  44. * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: horizontal caret offset.
  45. * @HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: vertical caret rise.
  46. * @HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: vertical caret run.
  47. * @HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET: vertical caret offset.
  48. * @HB_OT_METRICS_TAG_X_HEIGHT: x height.
  49. * @HB_OT_METRICS_TAG_CAP_HEIGHT: cap height.
  50. * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE: subscript em x size.
  51. * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE: subscript em y size.
  52. * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET: subscript em x offset.
  53. * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET: subscript em y offset.
  54. * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE: superscript em x size.
  55. * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE: superscript em y size.
  56. * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET: superscript em x offset.
  57. * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET: superscript em y offset.
  58. * @HB_OT_METRICS_TAG_STRIKEOUT_SIZE: strikeout size.
  59. * @HB_OT_METRICS_TAG_STRIKEOUT_OFFSET: strikeout offset.
  60. * @HB_OT_METRICS_TAG_UNDERLINE_SIZE: underline size.
  61. * @HB_OT_METRICS_TAG_UNDERLINE_OFFSET: underline offset.
  62. *
  63. * From https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags
  64. *
  65. * Since: 2.6.0
  66. **/
  67. typedef enum {
  68. HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER = HB_TAG ('h','a','s','c'),
  69. HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER = HB_TAG ('h','d','s','c'),
  70. HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP = HB_TAG ('h','l','g','p'),
  71. HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT = HB_TAG ('h','c','l','a'),
  72. HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT = HB_TAG ('h','c','l','d'),
  73. HB_OT_METRICS_TAG_VERTICAL_ASCENDER = HB_TAG ('v','a','s','c'),
  74. HB_OT_METRICS_TAG_VERTICAL_DESCENDER = HB_TAG ('v','d','s','c'),
  75. HB_OT_METRICS_TAG_VERTICAL_LINE_GAP = HB_TAG ('v','l','g','p'),
  76. HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE = HB_TAG ('h','c','r','s'),
  77. HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN = HB_TAG ('h','c','r','n'),
  78. HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET = HB_TAG ('h','c','o','f'),
  79. HB_OT_METRICS_TAG_VERTICAL_CARET_RISE = HB_TAG ('v','c','r','s'),
  80. HB_OT_METRICS_TAG_VERTICAL_CARET_RUN = HB_TAG ('v','c','r','n'),
  81. HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET = HB_TAG ('v','c','o','f'),
  82. HB_OT_METRICS_TAG_X_HEIGHT = HB_TAG ('x','h','g','t'),
  83. HB_OT_METRICS_TAG_CAP_HEIGHT = HB_TAG ('c','p','h','t'),
  84. HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE = HB_TAG ('s','b','x','s'),
  85. HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE = HB_TAG ('s','b','y','s'),
  86. HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET = HB_TAG ('s','b','x','o'),
  87. HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET = HB_TAG ('s','b','y','o'),
  88. HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE = HB_TAG ('s','p','x','s'),
  89. HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE = HB_TAG ('s','p','y','s'),
  90. HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET = HB_TAG ('s','p','x','o'),
  91. HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET = HB_TAG ('s','p','y','o'),
  92. HB_OT_METRICS_TAG_STRIKEOUT_SIZE = HB_TAG ('s','t','r','s'),
  93. HB_OT_METRICS_TAG_STRIKEOUT_OFFSET = HB_TAG ('s','t','r','o'),
  94. HB_OT_METRICS_TAG_UNDERLINE_SIZE = HB_TAG ('u','n','d','s'),
  95. HB_OT_METRICS_TAG_UNDERLINE_OFFSET = HB_TAG ('u','n','d','o'),
  96. _HB_OT_METRICS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
  97. } hb_ot_metrics_tag_t;
  98. HB_EXTERN hb_bool_t
  99. hb_ot_metrics_get_position (hb_font_t *font,
  100. hb_ot_metrics_tag_t metrics_tag,
  101. hb_position_t *position /* OUT. May be NULL. */);
  102. HB_EXTERN float
  103. hb_ot_metrics_get_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
  104. HB_EXTERN hb_position_t
  105. hb_ot_metrics_get_x_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
  106. HB_EXTERN hb_position_t
  107. hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
  108. HB_END_DECLS
  109. #endif /* HB_OT_METRICS_H */