PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/gfx/harfbuzz/src/hb-ot-layout-private.hh

https://bitbucket.org/MeeGoAdmin/mozilla-central/
C++ Header | 114 lines | 53 code | 27 blank | 34 comment | 0 complexity | f1cce88292678d4ca62e6bf30b745e16 MD5 | raw file
Possible License(s): AGPL-1.0, MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, 0BSD, LGPL-3.0, MPL-2.0-no-copyleft-exception, GPL-2.0, JSON
  1. /*
  2. * Copyright (C) 2007,2008,2009 Red Hat, Inc.
  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. * Red Hat Author(s): Behdad Esfahbod
  25. */
  26. #ifndef HB_OT_LAYOUT_PRIVATE_HH
  27. #define HB_OT_LAYOUT_PRIVATE_HH
  28. #include "hb-private.h"
  29. #include "hb-ot-layout.h"
  30. #include "hb-ot-head-private.hh"
  31. #include "hb-font-private.h"
  32. #include "hb-buffer-private.hh"
  33. HB_BEGIN_DECLS
  34. /* buffer var allocations */
  35. #define props_cache() var1.u16[1] /* glyph_props cache */
  36. /* XXX cleanup */
  37. typedef enum {
  38. HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001,
  39. HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
  40. HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
  41. HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
  42. HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010
  43. } hb_ot_layout_glyph_class_t;
  44. /*
  45. * hb_ot_layout_t
  46. */
  47. struct hb_ot_layout_t
  48. {
  49. hb_blob_t *gdef_blob;
  50. hb_blob_t *gsub_blob;
  51. hb_blob_t *gpos_blob;
  52. const struct GDEF *gdef;
  53. const struct GSUB *gsub;
  54. const struct GPOS *gpos;
  55. };
  56. struct hb_ot_layout_context_t
  57. {
  58. hb_face_t *face;
  59. hb_font_t *font;
  60. /* Convert from font-space to user-space */
  61. inline hb_position_t scale_x (int16_t v) { return scale (v, this->font->x_scale); }
  62. inline hb_position_t scale_y (int16_t v) { return scale (v, this->font->y_scale); }
  63. private:
  64. inline hb_position_t scale (int16_t v, unsigned int scale) { return v * (int64_t) scale / this->face->head_table->get_upem (); }
  65. };
  66. HB_INTERNAL hb_ot_layout_t *
  67. _hb_ot_layout_new (hb_face_t *face);
  68. HB_INTERNAL void
  69. _hb_ot_layout_free (hb_ot_layout_t *layout);
  70. /*
  71. * GDEF
  72. */
  73. HB_INTERNAL unsigned int
  74. _hb_ot_layout_get_glyph_property (hb_face_t *face,
  75. hb_glyph_info_t *info);
  76. HB_INTERNAL hb_bool_t
  77. _hb_ot_layout_check_glyph_property (hb_face_t *face,
  78. hb_glyph_info_t *ginfo,
  79. unsigned int lookup_props,
  80. unsigned int *property_out);
  81. HB_INTERNAL hb_bool_t
  82. _hb_ot_layout_skip_mark (hb_face_t *face,
  83. hb_glyph_info_t *ginfo,
  84. unsigned int lookup_props,
  85. unsigned int *property_out);
  86. HB_END_DECLS
  87. #endif /* HB_OT_LAYOUT_PRIVATE_HH */