1c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2009  Red Hat, Inc.
32409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2011  Google, Inc.
4c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod *
5c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
6c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod *
7c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * Permission is hereby granted, without written agreement and without
8c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
9c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * software and its documentation for any purpose, provided that the
10c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * above copyright notice and the following two paragraphs appear in
11c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * all copies of this software.
12c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod *
13c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * DAMAGE.
18c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod *
19c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod *
25c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
262409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Google Author(s): Behdad Esfahbod
27c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod */
28c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
29c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#ifndef HB_FONT_PRIVATE_HH
30c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#define HB_FONT_PRIVATE_HH
31c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
32c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh"
33c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
34fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod#include "hb-object-private.hh"
352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-face-private.hh"
36027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod#include "hb-shaper-private.hh"
37c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
38c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
39acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
40c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod/*
415c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * hb_font_funcs_t
42c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod */
43c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
44744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
45744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph) \
46744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
47744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
487e2c85de305be59e1a6afa7d2061e4b7dd00acf7Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
49744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \
507e2c85de305be59e1a6afa7d2061e4b7dd00acf7Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
517e2c85de305be59e1a6afa7d2061e4b7dd00acf7Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \
52744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_extents) \
534b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \
54bce095524b3e69a47f8e88a2fb02d6ab537f9b0aBehdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_name) \
55bce095524b3e69a47f8e88a2fb02d6ab537f9b0aBehdad Esfahbod  HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \
564b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  /* ^--- Add new callbacks here */
57744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod
581bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodstruct hb_font_funcs_t {
594b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  hb_object_header_t header;
606220e5fc0dad728e67a92e838d3ac275d032f2c7Behdad Esfahbod  ASSERT_POD ();
614b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod
624b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  hb_bool_t immutable;
634b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod
644b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  /* Don't access these directly.  Call hb_font_get_*() instead. */
65744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod
66b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod  struct {
67744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
68744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
69744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#undef HB_FONT_FUNC_IMPLEMENT
70b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod  } get;
71b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod
72b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod  struct {
73744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#define HB_FONT_FUNC_IMPLEMENT(name) void *name;
74744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
75744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#undef HB_FONT_FUNC_IMPLEMENT
76b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod  } user_data;
77b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod
78bf36a1074ab23abeab0a7a6c47db26770dc1ab0aBehdad Esfahbod  struct {
79744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#define HB_FONT_FUNC_IMPLEMENT(name) hb_destroy_func_t name;
80744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
81744970af4d884cc87ffa645804578fec8df674a9Behdad Esfahbod#undef HB_FONT_FUNC_IMPLEMENT
82b9d975b931d6310f25fab5ac280f523cdc27bf94Behdad Esfahbod  } destroy;
83c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod};
84c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
85c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
86c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
87c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod/*
88c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod * hb_font_t
89c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod */
90c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
911bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodstruct hb_font_t {
92fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  hb_object_header_t header;
936220e5fc0dad728e67a92e838d3ac275d032f2c7Behdad Esfahbod  ASSERT_POD ();
94c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
9574f1d896f2479500d65649cf3ec86dd201f0663aBehdad Esfahbod  hb_bool_t immutable;
9674f1d896f2479500d65649cf3ec86dd201f0663aBehdad Esfahbod
97defc45be6d75aba4a67fa7814b91b73bad953fe6Behdad Esfahbod  hb_font_t *parent;
9872657e4ce757dcb055a8db7291b68f96f0d34bfbBehdad Esfahbod  hb_face_t *face;
9972657e4ce757dcb055a8db7291b68f96f0d34bfbBehdad Esfahbod
10011bb8fe7b3925bc9b019ad0c0218a231e581f152Behdad Esfahbod  int x_scale;
10111bb8fe7b3925bc9b019ad0c0218a231e581f152Behdad Esfahbod  int y_scale;
102c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
103c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod  unsigned int x_ppem;
104c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod  unsigned int y_ppem;
1055c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
1068fb3d1aa4e613cdf965a83bd650c668884c58ad8Behdad Esfahbod  hb_font_funcs_t   *klass;
1078fb3d1aa4e613cdf965a83bd650c668884c58ad8Behdad Esfahbod  void              *user_data;
1085668189c12c264e8d2caf0d12dac918363ef6f80Behdad Esfahbod  hb_destroy_func_t  destroy;
109abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod
110027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod  struct hb_shaper_data_t shaper_data;
111027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod
112abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod
113abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  /* Convert from font-space to user-space */
114b6f902a1a9c8b72b5d6a241a14a7bacfaea3a56aBehdad Esfahbod  inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, this->x_scale); }
115b6f902a1a9c8b72b5d6a241a14a7bacfaea3a56aBehdad Esfahbod  inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, this->y_scale); }
116abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod
11763d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  /* Convert from parent-font user-space to our user-space */
11863d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline hb_position_t parent_scale_x_distance (hb_position_t v) {
11963d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    if (unlikely (parent && parent->x_scale != x_scale))
12083408cf804a6908873c41b70bb7c43448e66ddd2Behdad Esfahbod      return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scale);
12163d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    return v;
12263d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
12363d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline hb_position_t parent_scale_y_distance (hb_position_t v) {
12463d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    if (unlikely (parent && parent->y_scale != y_scale))
12583408cf804a6908873c41b70bb7c43448e66ddd2Behdad Esfahbod      return (hb_position_t) (v * (int64_t) this->y_scale / this->parent->y_scale);
12663d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    return v;
12763d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
12863d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline hb_position_t parent_scale_x_position (hb_position_t v) {
12960fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod    return parent_scale_x_distance (v);
13063d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
13163d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline hb_position_t parent_scale_y_position (hb_position_t v) {
13260fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod    return parent_scale_y_distance (v);
13363d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
13463d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod
13563d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline void parent_scale_distance (hb_position_t *x, hb_position_t *y) {
13663d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    *x = parent_scale_x_distance (*x);
13763d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    *y = parent_scale_y_distance (*y);
13863d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
13963d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  inline void parent_scale_position (hb_position_t *x, hb_position_t *y) {
14063d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    *x = parent_scale_x_position (*x);
14163d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod    *y = parent_scale_y_position (*y);
14263d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod  }
14363d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod
14463d646fb2933c2765ce526d321a498d0f7fae2f5Behdad Esfahbod
1458fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  /* Public getters */
1468fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1478de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod  inline hb_bool_t has_glyph (hb_codepoint_t unicode)
1488de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod  {
1498de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod    hb_codepoint_t glyph;
1508de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod    return get_glyph (unicode, 0, &glyph);
1518de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod  }
1528de20b1e8a1c4d2081f64e695045e6e4da7ce144Behdad Esfahbod
1538fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
1548fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod			      hb_codepoint_t *glyph)
1558fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1568fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *glyph = 0;
1578fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph (this, user_data,
1588fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod			     unicode, variation_selector, glyph,
1598fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod			     klass->user_data.glyph);
1608fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
1618fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1628fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
1638fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1648fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_h_advance (this, user_data,
1658fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       glyph,
1668fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       klass->user_data.glyph_h_advance);
1678fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
1688fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1698fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
1708fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1718fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_v_advance (this, user_data,
1728fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       glyph,
1738fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       klass->user_data.glyph_v_advance);
1748fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
1758fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1768fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
1778fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       hb_position_t *x, hb_position_t *y)
1788fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1798fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x = *y = 0;
1808fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_h_origin (this, user_data,
1818fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				      glyph, x, y,
1828fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				      klass->user_data.glyph_h_origin);
1838fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
1848fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1858fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
1868fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       hb_position_t *x, hb_position_t *y)
1878fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1888fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x = *y = 0;
1898fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_v_origin (this, user_data,
1908fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				      glyph, x, y,
1918fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				      klass->user_data.glyph_v_origin);
1928fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
1938fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
1948fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph)
1958fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
1968fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_h_kerning (this, user_data,
1978fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       left_glyph, right_glyph,
1988fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       klass->user_data.glyph_h_kerning);
1998fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2008fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
201288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod  inline hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph)
2028fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2038fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_v_kerning (this, user_data,
204288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod				       top_glyph, bottom_glyph,
2058fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       klass->user_data.glyph_v_kerning);
2068fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2078fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2088fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
2098fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				      hb_glyph_extents_t *extents)
2108fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2118fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    memset (extents, 0, sizeof (*extents));
2128fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_extents (this, user_data,
2138fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				     glyph,
2148fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				     extents,
2158fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				     klass->user_data.glyph_extents);
2168fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2178fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2188fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
2198fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					    hb_position_t *x, hb_position_t *y)
2208fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2218fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x = *y = 0;
2228fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_contour_point (this, user_data,
2238fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					   glyph, point_index,
2248fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					   x, y,
2258fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					   klass->user_data.glyph_contour_point);
2268fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2278fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2288fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_name (hb_codepoint_t glyph,
2298fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				   char *name, unsigned int size)
2308fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2316f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (size) *name = '\0';
2328fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_name (this, user_data,
2338fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				  glyph,
2348fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				  name, size,
2358fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				  klass->user_data.glyph_name);
2368fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2378fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2388fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
2398fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					hb_codepoint_t *glyph)
2408fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2416f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    *glyph = 0;
2426f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (len == -1) len = strlen (name);
2438fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return klass->get.glyph_from_name (this, user_data,
2448fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       name, len,
2458fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       glyph,
2468fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod				       klass->user_data.glyph_from_name);
2478fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2488fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2498fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2508fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  /* A bit higher-level, and with fallback */
2518fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2528fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void get_glyph_advance_for_direction (hb_codepoint_t glyph,
2538fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					       hb_direction_t direction,
2548fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					       hb_position_t *x, hb_position_t *y)
2558fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2568fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
2578fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *x = get_glyph_h_advance (glyph);
2588fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *y = 0;
2598fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    } else {
2608fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *x = 0;
2618fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *y = get_glyph_v_advance (glyph);
2628fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    }
2638fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2648fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2658fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  /* Internal only */
2668fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void guess_v_origin_minus_h_origin (hb_codepoint_t glyph,
2678fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					     hb_position_t *x, hb_position_t *y)
2688fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2698fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x = get_glyph_h_advance (glyph) / 2;
2708fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2718fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    /* TODO use font_metics.ascent */
2728fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *y = y_scale;
2738fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
2748fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
2758fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void get_glyph_origin_for_direction (hb_codepoint_t glyph,
2768fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					      hb_direction_t direction,
2778fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					      hb_position_t *x, hb_position_t *y)
2788fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
2797235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod    if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
2807235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod    {
2817235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod      if (!get_glyph_h_origin (glyph, x, y) &&
2827235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod	   get_glyph_v_origin (glyph, x, y))
2837235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod      {
2848fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	hb_position_t dx, dy;
2858fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	guess_v_origin_minus_h_origin (glyph, &dx, &dy);
2868fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	*x -= dx; *y -= dy;
2878fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      }
2887235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod    }
2897235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod    else
2907235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod    {
2917235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod      if (!get_glyph_v_origin (glyph, x, y) &&
2927235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod	   get_glyph_h_origin (glyph, x, y))
2937235f33f9e5e031622a00a84f4b2e98f16803579Behdad Esfahbod      {
2948fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	hb_position_t dx, dy;
2958fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	guess_v_origin_minus_h_origin (glyph, &dx, &dy);
2968fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod	*x += dx; *y += dy;
2978fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      }
2988fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    }
2998fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3008fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3018fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void add_glyph_origin_for_direction (hb_codepoint_t glyph,
3028fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					      hb_direction_t direction,
3038fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					      hb_position_t *x, hb_position_t *y)
3048fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
3058fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    hb_position_t origin_x, origin_y;
3068fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3078fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    get_glyph_origin_for_direction (glyph, direction, &origin_x, &origin_y);
3088fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3098fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x += origin_x;
3108fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *y += origin_y;
3118fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3128fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3138fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
3148fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						   hb_direction_t direction,
3158fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						   hb_position_t *x, hb_position_t *y)
3168fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
3178fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    hb_position_t origin_x, origin_y;
3188fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3198fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    get_glyph_origin_for_direction (glyph, direction, &origin_x, &origin_y);
3208fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3218fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *x -= origin_x;
3228fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    *y -= origin_y;
3238fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3248fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3258fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline void get_glyph_kerning_for_direction (hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
3268fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					       hb_direction_t direction,
3278fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod					       hb_position_t *x, hb_position_t *y)
3288fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
3298fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
3308fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *x = get_glyph_h_kerning (first_glyph, second_glyph);
3318fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *y = 0;
3328fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    } else {
3338fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *x = 0;
3348fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      *y = get_glyph_v_kerning (first_glyph, second_glyph);
3358fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    }
3368fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3378fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3388fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_extents_for_origin (hb_codepoint_t glyph,
3398fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						 hb_direction_t direction,
3408fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						 hb_glyph_extents_t *extents)
3418fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
3428fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    hb_bool_t ret = get_glyph_extents (glyph, extents);
3438fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3448fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    if (ret)
3458fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      subtract_glyph_origin_for_direction (glyph, direction, &extents->x_bearing, &extents->y_bearing);
3468fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3478fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return ret;
3488fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3498fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3508fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  inline hb_bool_t get_glyph_contour_point_for_origin (hb_codepoint_t glyph, unsigned int point_index,
3518fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						       hb_direction_t direction,
3528fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod						       hb_position_t *x, hb_position_t *y)
3538fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  {
3548fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    hb_bool_t ret = get_glyph_contour_point (glyph, point_index, x, y);
3558fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3568fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    if (ret)
3578fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod      subtract_glyph_origin_for_direction (glyph, direction, x, y);
3588fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3598fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    return ret;
3608fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod  }
3618fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
3626f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  /* Generates gidDDD if glyph has no name. */
3636f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  inline void
3646f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  glyph_to_string (hb_codepoint_t glyph,
3656f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod		   char *s, unsigned int size)
3666f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  {
3676f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (get_glyph_name (glyph, s, size)) return;
3686f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
36938b8b40526a85f33521542e24d1e0c82588efc85Behdad Esfahbod    if (size && snprintf (s, size, "gid%u", glyph) < 0)
37038b8b40526a85f33521542e24d1e0c82588efc85Behdad Esfahbod      *s = '\0';
3716f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  }
3726f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
3736f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  /* Parses gidDDD and uniUUUU strings automatically. */
3746f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  inline hb_bool_t
3756f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  glyph_from_string (const char *s, int len, /* -1 means nul-terminated */
3766f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod		     hb_codepoint_t *glyph)
3776f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  {
3786f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (get_glyph_from_name (s, len, glyph)) return true;
3796f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
3806f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (len == -1) len = strlen (s);
3816f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
3826f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    /* Straight glyph index. */
3836f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (hb_codepoint_parse (s, len, 10, glyph))
3846f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      return true;
3856f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
3866f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    if (len > 3)
3876f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    {
3886f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      /* gidDDD syntax for glyph indices. */
3896f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      if (0 == strncmp (s, "gid", 3) &&
3906f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod	  hb_codepoint_parse (s + 3, len - 3, 10, glyph))
3916f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod	return true;
3926f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
3936f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      /* uniUUUU and other Unicode character indices. */
3946f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      hb_codepoint_t unichar;
3956f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod      if (0 == strncmp (s, "uni", 3) &&
3966f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod	  hb_codepoint_parse (s + 3, len - 3, 16, &unichar) &&
3976f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod	  get_glyph (unichar, 0, glyph))
3986f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod	return true;
3996f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    }
4006f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod
4016f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod    return false;
4026f3a300138f659020c21c3e08b7981c78df5f332Behdad Esfahbod  }
4038fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod
404abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  private:
40583408cf804a6908873c41b70bb7c43448e66ddd2Behdad Esfahbod  inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); }
406c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod};
407c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
4085b95c148cc485f79fd7018bc4520b4cb5f728a18Behdad Esfahbod#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
409027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font);
410027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod#include "hb-shaper-list.hh"
411027857d0412477fb4427dcb8a8c45287c272e143Behdad Esfahbod#undef HB_SHAPER_IMPLEMENT
4125b95c148cc485f79fd7018bc4520b4cb5f728a18Behdad Esfahbod#undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
413c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
414c62b503770325819f249885dfc9d4683a69c9efdBehdad Esfahbod
415c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#endif /* HB_FONT_PRIVATE_HH */
416