Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2011,2014 Google, 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 | * Google Author(s): Behdad Esfahbod, Roozbeh Pournader |
| 25 | */ |
| 26 | |
| 27 | #include "hb-private.hh" |
| 28 | |
| 29 | #include "hb-ot.h" |
| 30 | |
| 31 | #include "hb-font-private.hh" |
| 32 | |
Behdad Esfahbod | 41ca1fb | 2014-05-09 15:35:56 -0400 | [diff] [blame] | 33 | #include "hb-ot-cmap-table.hh" |
Behdad Esfahbod | b50fcfa | 2015-08-23 14:42:20 +0100 | [diff] [blame] | 34 | #include "hb-ot-glyf-table.hh" |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 35 | #include "hb-ot-hmtx-table.hh" |
Behdad Esfahbod | 2a16f64 | 2017-11-01 17:31:29 -0600 | [diff] [blame] | 36 | #include "hb-ot-kern-table.hh" |
Khaled Hosny | 9d4d2fb | 2017-10-16 10:05:42 +0200 | [diff] [blame] | 37 | #include "hb-ot-post-table.hh" |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 38 | |
Ebrahim Byagowi | 0ef6ab2 | 2018-03-04 02:47:26 +0330 | [diff] [blame] | 39 | #include "hb-ot-color-cbdt-table.hh" |
| 40 | |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 41 | |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 42 | struct hb_ot_font_t |
| 43 | { |
Behdad Esfahbod | 977ddff | 2017-11-14 20:06:19 -0800 | [diff] [blame] | 44 | OT::cmap::accelerator_t cmap; |
Behdad Esfahbod | eab4feb | 2017-11-14 20:16:45 -0800 | [diff] [blame] | 45 | OT::hmtx::accelerator_t h_metrics; |
| 46 | OT::vmtx::accelerator_t v_metrics; |
Behdad Esfahbod | 7e2839c | 2017-11-14 19:52:09 -0800 | [diff] [blame] | 47 | OT::hb_lazy_loader_t<OT::glyf::accelerator_t> glyf; |
Behdad Esfahbod | c4e18e5 | 2017-11-14 19:47:31 -0800 | [diff] [blame] | 48 | OT::hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt; |
Behdad Esfahbod | 9b04b03 | 2017-11-14 19:31:50 -0800 | [diff] [blame] | 49 | OT::hb_lazy_loader_t<OT::post::accelerator_t> post; |
Behdad Esfahbod | 702d86b | 2017-11-14 19:25:38 -0800 | [diff] [blame] | 50 | OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern; |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | |
| 54 | static hb_ot_font_t * |
Behdad Esfahbod | 3224a59 | 2015-10-07 17:33:02 -0400 | [diff] [blame] | 55 | _hb_ot_font_create (hb_face_t *face) |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 56 | { |
| 57 | hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t)); |
| 58 | |
| 59 | if (unlikely (!ot_font)) |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 60 | return nullptr; |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 61 | |
Behdad Esfahbod | 1568529 | 2014-09-25 17:45:49 +0300 | [diff] [blame] | 62 | ot_font->cmap.init (face); |
Behdad Esfahbod | eab4feb | 2017-11-14 20:16:45 -0800 | [diff] [blame] | 63 | ot_font->h_metrics.init (face); |
| 64 | ot_font->v_metrics.init (face, ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */ |
Behdad Esfahbod | b50fcfa | 2015-08-23 14:42:20 +0100 | [diff] [blame] | 65 | ot_font->glyf.init (face); |
Behdad Esfahbod | efca7bf | 2016-12-02 15:11:37 -0800 | [diff] [blame] | 66 | ot_font->cbdt.init (face); |
Khaled Hosny | 9d4d2fb | 2017-10-16 10:05:42 +0200 | [diff] [blame] | 67 | ot_font->post.init (face); |
Behdad Esfahbod | 77acc11 | 2017-11-01 19:33:09 -0600 | [diff] [blame] | 68 | ot_font->kern.init (face); |
Behdad Esfahbod | 3608a68 | 2014-05-12 13:46:29 -0400 | [diff] [blame] | 69 | |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 70 | return ot_font; |
| 71 | } |
| 72 | |
| 73 | static void |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 74 | _hb_ot_font_destroy (void *data) |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 75 | { |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 76 | hb_ot_font_t *ot_font = (hb_ot_font_t *) data; |
| 77 | |
Behdad Esfahbod | 1568529 | 2014-09-25 17:45:49 +0300 | [diff] [blame] | 78 | ot_font->cmap.fini (); |
Behdad Esfahbod | be1cca2 | 2014-09-25 16:53:24 +0300 | [diff] [blame] | 79 | ot_font->h_metrics.fini (); |
| 80 | ot_font->v_metrics.fini (); |
Behdad Esfahbod | ed13e2c | 2015-10-13 10:32:56 -0300 | [diff] [blame] | 81 | ot_font->glyf.fini (); |
Behdad Esfahbod | efca7bf | 2016-12-02 15:11:37 -0800 | [diff] [blame] | 82 | ot_font->cbdt.fini (); |
Khaled Hosny | 9d4d2fb | 2017-10-16 10:05:42 +0200 | [diff] [blame] | 83 | ot_font->post.fini (); |
Behdad Esfahbod | 77acc11 | 2017-11-01 19:33:09 -0600 | [diff] [blame] | 84 | ot_font->kern.fini (); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 85 | |
| 86 | free (ot_font); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | static hb_bool_t |
Behdad Esfahbod | 8b5bc14 | 2016-02-24 19:05:23 +0900 | [diff] [blame] | 91 | hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, |
| 92 | void *font_data, |
| 93 | hb_codepoint_t unicode, |
| 94 | hb_codepoint_t *glyph, |
| 95 | void *user_data HB_UNUSED) |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 96 | |
| 97 | { |
Behdad Esfahbod | 3608a68 | 2014-05-12 13:46:29 -0400 | [diff] [blame] | 98 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
Behdad Esfahbod | 8b5bc14 | 2016-02-24 19:05:23 +0900 | [diff] [blame] | 99 | return ot_font->cmap.get_nominal_glyph (unicode, glyph); |
| 100 | } |
| 101 | |
| 102 | static hb_bool_t |
| 103 | hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, |
| 104 | void *font_data, |
| 105 | hb_codepoint_t unicode, |
| 106 | hb_codepoint_t variation_selector, |
| 107 | hb_codepoint_t *glyph, |
| 108 | void *user_data HB_UNUSED) |
| 109 | { |
| 110 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 111 | return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | static hb_position_t |
Behdad Esfahbod | bd3b11d | 2017-01-23 17:34:44 -0800 | [diff] [blame] | 115 | hb_ot_get_glyph_h_advance (hb_font_t *font, |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 116 | void *font_data, |
| 117 | hb_codepoint_t glyph, |
| 118 | void *user_data HB_UNUSED) |
| 119 | { |
| 120 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
Behdad Esfahbod | bd3b11d | 2017-01-23 17:34:44 -0800 | [diff] [blame] | 121 | return font->em_scale_x (ot_font->h_metrics.get_advance (glyph, font)); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static hb_position_t |
Behdad Esfahbod | bd3b11d | 2017-01-23 17:34:44 -0800 | [diff] [blame] | 125 | hb_ot_get_glyph_v_advance (hb_font_t *font, |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 126 | void *font_data, |
| 127 | hb_codepoint_t glyph, |
| 128 | void *user_data HB_UNUSED) |
| 129 | { |
Behdad Esfahbod | d41b809 | 2014-09-25 13:04:08 +0300 | [diff] [blame] | 130 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
Behdad Esfahbod | bd3b11d | 2017-01-23 17:34:44 -0800 | [diff] [blame] | 131 | return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph, font)); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 132 | } |
| 133 | |
Behdad Esfahbod | 77acc11 | 2017-11-01 19:33:09 -0600 | [diff] [blame] | 134 | static hb_position_t |
| 135 | hb_ot_get_glyph_h_kerning (hb_font_t *font, |
| 136 | void *font_data, |
| 137 | hb_codepoint_t left_glyph, |
| 138 | hb_codepoint_t right_glyph, |
| 139 | void *user_data HB_UNUSED) |
| 140 | { |
| 141 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 142 | return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph)); |
| 143 | } |
| 144 | |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 145 | static hb_bool_t |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 146 | hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED, |
| 147 | void *font_data, |
| 148 | hb_codepoint_t glyph, |
| 149 | hb_glyph_extents_t *extents, |
| 150 | void *user_data HB_UNUSED) |
| 151 | { |
Behdad Esfahbod | b50fcfa | 2015-08-23 14:42:20 +0100 | [diff] [blame] | 152 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
Behdad Esfahbod | f00ab2a | 2016-05-02 10:24:00 +0200 | [diff] [blame] | 153 | bool ret = ot_font->glyf->get_extents (glyph, extents); |
Behdad Esfahbod | 4b58c9e | 2016-12-02 19:25:54 -0800 | [diff] [blame] | 154 | if (!ret) |
Behdad Esfahbod | efca7bf | 2016-12-02 15:11:37 -0800 | [diff] [blame] | 155 | ret = ot_font->cbdt->get_extents (glyph, extents); |
Behdad Esfahbod | 79e8e27 | 2017-01-23 17:55:31 -0800 | [diff] [blame] | 156 | // TODO Hook up side-bearings variations. |
Behdad Esfahbod | b50fcfa | 2015-08-23 14:42:20 +0100 | [diff] [blame] | 157 | extents->x_bearing = font->em_scale_x (extents->x_bearing); |
| 158 | extents->y_bearing = font->em_scale_y (extents->y_bearing); |
| 159 | extents->width = font->em_scale_x (extents->width); |
| 160 | extents->height = font->em_scale_y (extents->height); |
| 161 | return ret; |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 162 | } |
| 163 | |
Simon Cozens | 6f2e6de | 2015-10-26 16:23:22 +0900 | [diff] [blame] | 164 | static hb_bool_t |
Khaled Hosny | 9d4d2fb | 2017-10-16 10:05:42 +0200 | [diff] [blame] | 165 | hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED, |
| 166 | void *font_data, |
| 167 | hb_codepoint_t glyph, |
| 168 | char *name, unsigned int size, |
| 169 | void *user_data HB_UNUSED) |
| 170 | { |
| 171 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 172 | return ot_font->post->get_glyph_name (glyph, name, size); |
| 173 | } |
| 174 | |
| 175 | static hb_bool_t |
Khaled Hosny | d9e166f | 2017-10-18 20:49:16 +0200 | [diff] [blame] | 176 | hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, |
| 177 | void *font_data, |
| 178 | const char *name, int len, |
| 179 | hb_codepoint_t *glyph, |
| 180 | void *user_data HB_UNUSED) |
| 181 | { |
| 182 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 183 | return ot_font->post->get_glyph_from_name (name, len, glyph); |
| 184 | } |
| 185 | |
| 186 | static hb_bool_t |
Simon Cozens | 6f2e6de | 2015-10-26 16:23:22 +0900 | [diff] [blame] | 187 | hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED, |
| 188 | void *font_data, |
| 189 | hb_font_extents_t *metrics, |
| 190 | void *user_data HB_UNUSED) |
| 191 | { |
| 192 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 193 | metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender); |
| 194 | metrics->descender = font->em_scale_y (ot_font->h_metrics.descender); |
| 195 | metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap); |
Behdad Esfahbod | 79e8e27 | 2017-01-23 17:55:31 -0800 | [diff] [blame] | 196 | // TODO Hook up variations. |
Behdad Esfahbod | b3b0816 | 2016-10-26 17:19:07 +0200 | [diff] [blame] | 197 | return ot_font->h_metrics.has_font_extents; |
Simon Cozens | 6f2e6de | 2015-10-26 16:23:22 +0900 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | static hb_bool_t |
| 201 | hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED, |
| 202 | void *font_data, |
| 203 | hb_font_extents_t *metrics, |
| 204 | void *user_data HB_UNUSED) |
| 205 | { |
| 206 | const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; |
| 207 | metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender); |
| 208 | metrics->descender = font->em_scale_x (ot_font->v_metrics.descender); |
| 209 | metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap); |
Behdad Esfahbod | 79e8e27 | 2017-01-23 17:55:31 -0800 | [diff] [blame] | 210 | // TODO Hook up variations. |
Behdad Esfahbod | b3b0816 | 2016-10-26 17:19:07 +0200 | [diff] [blame] | 211 | return ot_font->v_metrics.has_font_extents; |
Simon Cozens | 6f2e6de | 2015-10-26 16:23:22 +0900 | [diff] [blame] | 212 | } |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 213 | |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 214 | static hb_font_funcs_t *static_ot_funcs = nullptr; |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 215 | |
| 216 | #ifdef HB_USE_ATEXIT |
| 217 | static |
| 218 | void free_static_ot_funcs (void) |
| 219 | { |
| 220 | hb_font_funcs_destroy (static_ot_funcs); |
| 221 | } |
| 222 | #endif |
| 223 | |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 224 | static hb_font_funcs_t * |
| 225 | _hb_ot_get_font_funcs (void) |
| 226 | { |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 227 | retry: |
| 228 | hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 229 | |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 230 | if (unlikely (!funcs)) |
| 231 | { |
| 232 | funcs = hb_font_funcs_create (); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 233 | |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 234 | hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, nullptr, nullptr); |
| 235 | hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, nullptr, nullptr); |
| 236 | hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, nullptr, nullptr); |
| 237 | hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, nullptr, nullptr); |
| 238 | hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, nullptr, nullptr); |
| 239 | hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, nullptr, nullptr); |
| 240 | //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, nullptr, nullptr); |
| 241 | //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, nullptr, nullptr); |
Behdad Esfahbod | 4b3278e | 2017-11-01 19:41:29 -0600 | [diff] [blame] | 242 | hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr); |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 243 | //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr); |
| 244 | hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr); |
Behdad Esfahbod | 7b40876 | 2017-11-14 20:22:05 -0800 | [diff] [blame] | 245 | //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr); |
Khaled Hosny | 9d4d2fb | 2017-10-16 10:05:42 +0200 | [diff] [blame] | 246 | hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr); |
Khaled Hosny | d9e166f | 2017-10-18 20:49:16 +0200 | [diff] [blame] | 247 | hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, nullptr, nullptr); |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 248 | |
| 249 | hb_font_funcs_make_immutable (funcs); |
| 250 | |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 251 | if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, nullptr, funcs)) { |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 252 | hb_font_funcs_destroy (funcs); |
| 253 | goto retry; |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 254 | } |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 255 | |
| 256 | #ifdef HB_USE_ATEXIT |
| 257 | atexit (free_static_ot_funcs); /* First person registers atexit() callback. */ |
| 258 | #endif |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 259 | }; |
| 260 | |
Behdad Esfahbod | 75ea2da | 2015-11-04 20:43:59 -0800 | [diff] [blame] | 261 | return funcs; |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 265 | /** |
Behdad Esfahbod | 35d1858 | 2015-11-26 19:30:37 -0500 | [diff] [blame] | 266 | * hb_ot_font_set_funcs: |
| 267 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 268 | * Since: 0.9.28 |
| 269 | **/ |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 270 | void |
| 271 | hb_ot_font_set_funcs (hb_font_t *font) |
| 272 | { |
Behdad Esfahbod | 3224a59 | 2015-10-07 17:33:02 -0400 | [diff] [blame] | 273 | hb_ot_font_t *ot_font = _hb_ot_font_create (font->face); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 274 | if (unlikely (!ot_font)) |
| 275 | return; |
| 276 | |
| 277 | hb_font_set_funcs (font, |
| 278 | _hb_ot_get_font_funcs (), |
| 279 | ot_font, |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 280 | _hb_ot_font_destroy); |
Behdad Esfahbod | 9036484 | 2014-03-24 14:26:36 -0700 | [diff] [blame] | 281 | } |