Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2009 Red Hat, Inc. |
| 3 | * Copyright © 2012 Google, Inc. |
| 4 | * |
| 5 | * This is part of HarfBuzz, a text shaping library. |
| 6 | * |
| 7 | * Permission is hereby granted, without written agreement and without |
| 8 | * license or royalty fees, to use, copy, modify, and distribute this |
| 9 | * software and its documentation for any purpose, provided that the |
| 10 | * above copyright notice and the following two paragraphs appear in |
| 11 | * all copies of this software. |
| 12 | * |
| 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 17 | * DAMAGE. |
| 18 | * |
| 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 24 | * |
| 25 | * Red Hat Author(s): Behdad Esfahbod |
| 26 | * Google Author(s): Behdad Esfahbod |
| 27 | */ |
| 28 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 29 | #include "hb.hh" |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 30 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 31 | #include "hb-face.hh" |
| 32 | #include "hb-blob.hh" |
| 33 | #include "hb-open-file.hh" |
Behdad Esfahbod | a84309a | 2018-08-26 09:33:01 -0700 | [diff] [blame] | 34 | #include "hb-ot-face.hh" |
Behdad Esfahbod | 3a0b3a2 | 2018-08-26 15:11:24 -0700 | [diff] [blame] | 35 | #include "hb-ot-cmap-table.hh" |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 36 | #include "hb-map.hh" |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 37 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 38 | |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 39 | /** |
Behdad Esfahbod | 00cf4e5 | 2018-10-27 04:07:33 -0700 | [diff] [blame] | 40 | * SECTION:hb-face |
Behdad Esfahbod | cf5fa57 | 2018-10-27 04:50:38 -0700 | [diff] [blame] | 41 | * @title: hb-face |
Behdad Esfahbod | 5dd86aa | 2018-10-27 04:28:40 -0700 | [diff] [blame] | 42 | * @short_description: Font face objects |
Behdad Esfahbod | 00cf4e5 | 2018-10-27 04:07:33 -0700 | [diff] [blame] | 43 | * @include: hb.h |
| 44 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 45 | * A font face is an object that represents a single face from within a |
| 46 | * font family. |
| 47 | * |
| 48 | * More precisely, a font face represents a single face in a binary font file. |
Behdad Esfahbod | 00cf4e5 | 2018-10-27 04:07:33 -0700 | [diff] [blame] | 49 | * Font faces are typically built from a binary blob and a face index. |
| 50 | * Font faces are used to create fonts. |
| 51 | **/ |
| 52 | |
| 53 | |
| 54 | /** |
Behdad Esfahbod | 55bae68 | 2018-09-24 10:43:06 -0400 | [diff] [blame] | 55 | * hb_face_count: |
| 56 | * @blob: a blob. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 57 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 58 | * Fetches the number of faces in a blob. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 59 | * |
Behdad Esfahbod | 55bae68 | 2018-09-24 10:43:06 -0400 | [diff] [blame] | 60 | * Return value: Number of faces in @blob |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 61 | * |
Behdad Esfahbod | df01f3e | 2018-06-05 15:17:39 -0700 | [diff] [blame] | 62 | * Since: 1.7.7 |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 63 | **/ |
| 64 | unsigned int |
| 65 | hb_face_count (hb_blob_t *blob) |
| 66 | { |
| 67 | if (unlikely (!blob)) |
| 68 | return 0; |
| 69 | |
Behdad Esfahbod | 1e9e344 | 2018-07-17 19:17:59 +0200 | [diff] [blame] | 70 | /* TODO We shouldn't be sanitizing blob. Port to run sanitizer and return if not sane. */ |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 71 | /* Make API signature const after. */ |
Behdad Esfahbod | ed7b2e5 | 2018-08-01 23:59:09 -0700 | [diff] [blame] | 72 | hb_blob_t *sanitized = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)); |
Ebrahim Byagowi | 8220ef8 | 2018-06-05 22:50:53 +0430 | [diff] [blame] | 73 | const OT::OpenTypeFontFile& ot = *sanitized->as<OT::OpenTypeFontFile> (); |
Behdad Esfahbod | 1e9e344 | 2018-07-17 19:17:59 +0200 | [diff] [blame] | 74 | unsigned int ret = ot.get_face_count (); |
| 75 | hb_blob_destroy (sanitized); |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 76 | |
Behdad Esfahbod | 1e9e344 | 2018-07-17 19:17:59 +0200 | [diff] [blame] | 77 | return ret; |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 78 | } |
| 79 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 80 | /* |
| 81 | * hb_face_t |
| 82 | */ |
| 83 | |
Behdad Esfahbod | 3506672 | 2018-08-06 06:17:48 -0700 | [diff] [blame] | 84 | DEFINE_NULL_INSTANCE (hb_face_t) = |
| 85 | { |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 86 | HB_OBJECT_HEADER_STATIC, |
| 87 | |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 88 | nullptr, /* reference_table_func */ |
| 89 | nullptr, /* user_data */ |
| 90 | nullptr, /* destroy */ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 91 | |
| 92 | 0, /* index */ |
Behdad Esfahbod | 140797d | 2020-06-29 03:51:09 -0700 | [diff] [blame] | 93 | 1000, /* upem */ |
| 94 | 0, /* num_glyphs */ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 95 | |
Behdad Esfahbod | e88d47b | 2018-11-11 16:25:43 -0500 | [diff] [blame] | 96 | /* Zero for the rest is fine. */ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 100 | /** |
| 101 | * hb_face_create_for_tables: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 102 | * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): Table-referencing function |
| 103 | * @user_data: A pointer to the user data |
Khaled Hosny | 9936490 | 2020-12-31 00:19:29 +0200 | [diff] [blame] | 104 | * @destroy: (nullable): A callback to call when @data is not needed anymore |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 105 | * |
Khaled Hosny | cc7b3a1 | 2020-09-26 10:22:39 +0200 | [diff] [blame] | 106 | * Variant of hb_face_create(), built for those cases where it is more |
| 107 | * convenient to provide data for individual tables instead of the whole font |
| 108 | * data. With the caveat that hb_face_get_table_tags() does not currently work |
| 109 | * with faces created this way. |
Khaled Hosny | 4811e8f | 2021-06-07 10:54:36 +0200 | [diff] [blame] | 110 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 111 | * Creates a new face object from the specified @user_data and @reference_table_func, |
Khaled Hosny | 4811e8f | 2021-06-07 10:54:36 +0200 | [diff] [blame] | 112 | * with the @destroy callback. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 113 | * |
n8willis | 41b46a3 | 2020-04-26 16:01:31 +0100 | [diff] [blame] | 114 | * Return value: (transfer full): The new face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 115 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 116 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 117 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 118 | hb_face_t * |
| 119 | hb_face_create_for_tables (hb_reference_table_func_t reference_table_func, |
| 120 | void *user_data, |
| 121 | hb_destroy_func_t destroy) |
| 122 | { |
| 123 | hb_face_t *face; |
| 124 | |
| 125 | if (!reference_table_func || !(face = hb_object_create<hb_face_t> ())) { |
| 126 | if (destroy) |
| 127 | destroy (user_data); |
| 128 | return hb_face_get_empty (); |
| 129 | } |
| 130 | |
| 131 | face->reference_table_func = reference_table_func; |
| 132 | face->user_data = user_data; |
| 133 | face->destroy = destroy; |
| 134 | |
Behdad Esfahbod | fc44dea | 2018-11-13 11:54:33 -0500 | [diff] [blame] | 135 | face->num_glyphs.set_relaxed (-1); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 136 | |
Behdad Esfahbod | ce5da0f | 2018-11-16 02:29:13 -0500 | [diff] [blame] | 137 | face->data.init0 (face); |
Behdad Esfahbod | 914b595 | 2018-11-05 22:39:50 -0500 | [diff] [blame] | 138 | face->table.init0 (face); |
| 139 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 140 | return face; |
| 141 | } |
| 142 | |
| 143 | |
| 144 | typedef struct hb_face_for_data_closure_t { |
| 145 | hb_blob_t *blob; |
| 146 | unsigned int index; |
| 147 | } hb_face_for_data_closure_t; |
| 148 | |
| 149 | static hb_face_for_data_closure_t * |
| 150 | _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index) |
| 151 | { |
| 152 | hb_face_for_data_closure_t *closure; |
| 153 | |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 154 | closure = (hb_face_for_data_closure_t *) hb_calloc (1, sizeof (hb_face_for_data_closure_t)); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 155 | if (unlikely (!closure)) |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 156 | return nullptr; |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 157 | |
| 158 | closure->blob = blob; |
| 159 | closure->index = index; |
| 160 | |
| 161 | return closure; |
| 162 | } |
| 163 | |
| 164 | static void |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 165 | _hb_face_for_data_closure_destroy (void *data) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 166 | { |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 167 | hb_face_for_data_closure_t *closure = (hb_face_for_data_closure_t *) data; |
| 168 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 169 | hb_blob_destroy (closure->blob); |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 170 | hb_free (closure); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | static hb_blob_t * |
| 174 | _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) |
| 175 | { |
| 176 | hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) user_data; |
| 177 | |
| 178 | if (tag == HB_TAG_NONE) |
| 179 | return hb_blob_reference (data->blob); |
| 180 | |
Behdad Esfahbod | eba1c16 | 2018-05-08 02:47:42 -0700 | [diff] [blame] | 181 | const OT::OpenTypeFontFile &ot_file = *data->blob->as<OT::OpenTypeFontFile> (); |
Behdad Esfahbod | 9479ffe | 2018-09-11 16:41:26 +0200 | [diff] [blame] | 182 | unsigned int base_offset; |
| 183 | const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index, &base_offset); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 184 | |
| 185 | const OT::OpenTypeTable &table = ot_face.get_table_by_tag (tag); |
| 186 | |
Behdad Esfahbod | 9479ffe | 2018-09-11 16:41:26 +0200 | [diff] [blame] | 187 | hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, base_offset + table.offset, table.length); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 188 | |
| 189 | return blob; |
| 190 | } |
| 191 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 192 | /** |
Behdad Esfahbod | 085d429 | 2013-09-12 17:14:33 -0400 | [diff] [blame] | 193 | * hb_face_create: (Xconstructor) |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 194 | * @blob: #hb_blob_t to work upon |
| 195 | * @index: The index of the face within @blob |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 196 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 197 | * Constructs a new face object from the specified blob and |
n8willis | 726e320 | 2020-04-26 15:56:57 +0100 | [diff] [blame] | 198 | * a face index into that blob. This is used for blobs of |
| 199 | * file formats such as Dfont and TTC that can contain more |
| 200 | * than one face. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 201 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 202 | * Return value: (transfer full): The new face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 203 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 204 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 205 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 206 | hb_face_t * |
| 207 | hb_face_create (hb_blob_t *blob, |
| 208 | unsigned int index) |
| 209 | { |
| 210 | hb_face_t *face; |
| 211 | |
Behdad Esfahbod | eb0bf3a | 2014-08-06 15:36:41 -0400 | [diff] [blame] | 212 | if (unlikely (!blob)) |
| 213 | blob = hb_blob_get_empty (); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 214 | |
Sebastian Rasmussen | 12a9d57 | 2020-06-24 03:25:43 +0800 | [diff] [blame] | 215 | blob = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)); |
| 216 | |
| 217 | hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (blob, index); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 218 | |
| 219 | if (unlikely (!closure)) |
Sebastian Rasmussen | 12a9d57 | 2020-06-24 03:25:43 +0800 | [diff] [blame] | 220 | { |
| 221 | hb_blob_destroy (blob); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 222 | return hb_face_get_empty (); |
Sebastian Rasmussen | 12a9d57 | 2020-06-24 03:25:43 +0800 | [diff] [blame] | 223 | } |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 224 | |
| 225 | face = hb_face_create_for_tables (_hb_face_for_data_reference_table, |
| 226 | closure, |
Behdad Esfahbod | e1b6d92 | 2017-10-11 15:51:31 +0200 | [diff] [blame] | 227 | _hb_face_for_data_closure_destroy); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 228 | |
Behdad Esfahbod | d3d3691 | 2017-02-03 15:42:03 -0800 | [diff] [blame] | 229 | face->index = index; |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 230 | |
| 231 | return face; |
| 232 | } |
| 233 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 234 | /** |
| 235 | * hb_face_get_empty: |
| 236 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 237 | * Fetches the singleton empty face object. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 238 | * |
Khaled Hosny | 3d7a361 | 2020-12-30 23:58:37 +0200 | [diff] [blame] | 239 | * Return value: (transfer full): The empty face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 240 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 241 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 242 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 243 | hb_face_t * |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 244 | hb_face_get_empty () |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 245 | { |
Ebrahim Byagowi | 2dda6dd | 2020-04-20 14:12:45 +0430 | [diff] [blame] | 246 | return const_cast<hb_face_t *> (&Null (hb_face_t)); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 250 | /** |
| 251 | * hb_face_reference: (skip) |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 252 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 253 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 254 | * Increases the reference count on a face object. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 255 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 256 | * Return value: The @face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 257 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 258 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 259 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 260 | hb_face_t * |
| 261 | hb_face_reference (hb_face_t *face) |
| 262 | { |
| 263 | return hb_object_reference (face); |
| 264 | } |
| 265 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 266 | /** |
| 267 | * hb_face_destroy: (skip) |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 268 | * @face: A face object |
Khaled Hosny | 4811e8f | 2021-06-07 10:54:36 +0200 | [diff] [blame] | 269 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 270 | * Decreases the reference count on a face object. When the |
| 271 | * reference count reaches zero, the face is destroyed, |
| 272 | * freeing all memory. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 273 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 274 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 275 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 276 | void |
| 277 | hb_face_destroy (hb_face_t *face) |
| 278 | { |
| 279 | if (!hb_object_destroy (face)) return; |
| 280 | |
Behdad Esfahbod | f6fc557 | 2018-11-05 13:23:54 -0500 | [diff] [blame] | 281 | for (hb_face_t::plan_node_t *node = face->shape_plans; node; ) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 282 | { |
| 283 | hb_face_t::plan_node_t *next = node->next; |
| 284 | hb_shape_plan_destroy (node->shape_plan); |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 285 | hb_free (node); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 286 | node = next; |
| 287 | } |
| 288 | |
Behdad Esfahbod | ce5da0f | 2018-11-16 02:29:13 -0500 | [diff] [blame] | 289 | face->data.fini (); |
Behdad Esfahbod | 914b595 | 2018-11-05 22:39:50 -0500 | [diff] [blame] | 290 | face->table.fini (); |
| 291 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 292 | if (face->destroy) |
| 293 | face->destroy (face->user_data); |
| 294 | |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 295 | hb_free (face); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 296 | } |
| 297 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 298 | /** |
| 299 | * hb_face_set_user_data: (skip) |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 300 | * @face: A face object |
| 301 | * @key: The user-data key to set |
| 302 | * @data: A pointer to the user data |
Khaled Hosny | 9936490 | 2020-12-31 00:19:29 +0200 | [diff] [blame] | 303 | * @destroy: (nullable): A callback to call when @data is not needed anymore |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 304 | * @replace: Whether to replace an existing data with the same key |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 305 | * |
Khaled Hosny | 4811e8f | 2021-06-07 10:54:36 +0200 | [diff] [blame] | 306 | * Attaches a user-data key/data pair to the given face object. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 307 | * |
Khaled Hosny | f88e845 | 2020-12-24 21:28:37 +0200 | [diff] [blame] | 308 | * Return value: %true if success, %false otherwise |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 309 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 310 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 311 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 312 | hb_bool_t |
| 313 | hb_face_set_user_data (hb_face_t *face, |
| 314 | hb_user_data_key_t *key, |
| 315 | void * data, |
| 316 | hb_destroy_func_t destroy, |
| 317 | hb_bool_t replace) |
| 318 | { |
| 319 | return hb_object_set_user_data (face, key, data, destroy, replace); |
| 320 | } |
| 321 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 322 | /** |
| 323 | * hb_face_get_user_data: (skip) |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 324 | * @face: A face object |
| 325 | * @key: The user-data key to query |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 326 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 327 | * Fetches the user data associated with the specified key, |
| 328 | * attached to the specified face object. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 329 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 330 | * Return value: (transfer none): A pointer to the user data |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 331 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 332 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 333 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 334 | void * |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 335 | hb_face_get_user_data (const hb_face_t *face, |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 336 | hb_user_data_key_t *key) |
| 337 | { |
| 338 | return hb_object_get_user_data (face, key); |
| 339 | } |
| 340 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 341 | /** |
| 342 | * hb_face_make_immutable: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 343 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 344 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 345 | * Makes the given face object immutable. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 346 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 347 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 348 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 349 | void |
| 350 | hb_face_make_immutable (hb_face_t *face) |
| 351 | { |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 352 | if (hb_object_is_immutable (face)) |
Behdad Esfahbod | 90a0f9f | 2018-09-26 15:03:07 -0400 | [diff] [blame] | 353 | return; |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 354 | |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 355 | hb_object_make_immutable (face); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 356 | } |
| 357 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 358 | /** |
| 359 | * hb_face_is_immutable: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 360 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 361 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 362 | * Tests whether the given face object is immutable. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 363 | * |
Khaled Hosny | a8e72ee | 2020-12-30 23:08:40 +0200 | [diff] [blame] | 364 | * Return value: %true is @face is immutable, %false otherwise |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 365 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 366 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 367 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 368 | hb_bool_t |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 369 | hb_face_is_immutable (const hb_face_t *face) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 370 | { |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 371 | return hb_object_is_immutable (face); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 375 | /** |
| 376 | * hb_face_reference_table: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 377 | * @face: A face object |
| 378 | * @tag: The #hb_tag_t of the table to query |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 379 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 380 | * Fetches a reference to the specified table within |
| 381 | * the specified face. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 382 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 383 | * Return value: (transfer full): A pointer to the @tag table within @face |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 384 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 385 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 386 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 387 | hb_blob_t * |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 388 | hb_face_reference_table (const hb_face_t *face, |
| 389 | hb_tag_t tag) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 390 | { |
Ebrahim Byagowi | f441a7c | 2019-09-01 02:18:09 +0430 | [diff] [blame] | 391 | if (unlikely (tag == HB_TAG_NONE)) |
| 392 | return hb_blob_get_empty (); |
| 393 | |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 394 | return face->reference_table (tag); |
| 395 | } |
| 396 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 397 | /** |
| 398 | * hb_face_reference_blob: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 399 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 400 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 401 | * Fetches a pointer to the binary blob that contains the |
Khaled Hosny | cc7b3a1 | 2020-09-26 10:22:39 +0200 | [diff] [blame] | 402 | * specified face. Returns an empty blob if referencing face data is not |
| 403 | * possible. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 404 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 405 | * Return value: (transfer full): A pointer to the blob for @face |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 406 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 407 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 408 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 409 | hb_blob_t * |
| 410 | hb_face_reference_blob (hb_face_t *face) |
| 411 | { |
| 412 | return face->reference_table (HB_TAG_NONE); |
| 413 | } |
| 414 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 415 | /** |
| 416 | * hb_face_set_index: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 417 | * @face: A face object |
| 418 | * @index: The index to assign |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 419 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 420 | * Assigns the specified face-index to @face. Fails if the |
| 421 | * face is immutable. |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 422 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 423 | * <note>Note: face indices within a collection are zero-based.</note> |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 424 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 425 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 426 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 427 | void |
| 428 | hb_face_set_index (hb_face_t *face, |
| 429 | unsigned int index) |
| 430 | { |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 431 | if (hb_object_is_immutable (face)) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 432 | return; |
| 433 | |
| 434 | face->index = index; |
| 435 | } |
| 436 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 437 | /** |
| 438 | * hb_face_get_index: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 439 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 440 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 441 | * Fetches the face-index corresponding to the given face. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 442 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 443 | * <note>Note: face indices within a collection are zero-based.</note> |
Ebrahim Byagowi | 32da0c6 | 2018-06-05 18:56:26 +0430 | [diff] [blame] | 444 | * |
Khaled Hosny | 4811e8f | 2021-06-07 10:54:36 +0200 | [diff] [blame] | 445 | * Return value: The index of @face. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 446 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 447 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 448 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 449 | unsigned int |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 450 | hb_face_get_index (const hb_face_t *face) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 451 | { |
| 452 | return face->index; |
| 453 | } |
| 454 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 455 | /** |
| 456 | * hb_face_set_upem: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 457 | * @face: A face object |
| 458 | * @upem: The units-per-em value to assign |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 459 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 460 | * Sets the units-per-em (upem) for a face object to the specified value. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 461 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 462 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 463 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 464 | void |
| 465 | hb_face_set_upem (hb_face_t *face, |
| 466 | unsigned int upem) |
| 467 | { |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 468 | if (hb_object_is_immutable (face)) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 469 | return; |
| 470 | |
Behdad Esfahbod | fc44dea | 2018-11-13 11:54:33 -0500 | [diff] [blame] | 471 | face->upem.set_relaxed (upem); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 472 | } |
| 473 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 474 | /** |
| 475 | * hb_face_get_upem: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 476 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 477 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 478 | * Fetches the units-per-em (upem) value of the specified face object. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 479 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 480 | * Return value: The upem value of @face |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 481 | * |
Behdad Esfahbod | 5d74ff0 | 2015-09-03 14:55:59 +0430 | [diff] [blame] | 482 | * Since: 0.9.2 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 483 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 484 | unsigned int |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 485 | hb_face_get_upem (const hb_face_t *face) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 486 | { |
| 487 | return face->get_upem (); |
| 488 | } |
| 489 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 490 | /** |
| 491 | * hb_face_set_glyph_count: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 492 | * @face: A face object |
| 493 | * @glyph_count: The glyph-count value to assign |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 494 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 495 | * Sets the glyph count for a face object to the specified value. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 496 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 497 | * Since: 0.9.7 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 498 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 499 | void |
| 500 | hb_face_set_glyph_count (hb_face_t *face, |
| 501 | unsigned int glyph_count) |
| 502 | { |
Behdad Esfahbod | 5570c87 | 2018-11-03 14:51:38 -0400 | [diff] [blame] | 503 | if (hb_object_is_immutable (face)) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 504 | return; |
| 505 | |
Behdad Esfahbod | fc44dea | 2018-11-13 11:54:33 -0500 | [diff] [blame] | 506 | face->num_glyphs.set_relaxed (glyph_count); |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 507 | } |
| 508 | |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 509 | /** |
| 510 | * hb_face_get_glyph_count: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 511 | * @face: A face object |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 512 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 513 | * Fetches the glyph-count value of the specified face object. |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 514 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 515 | * Return value: The glyph-count value of @face |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 516 | * |
Sascha Brawer | 01c3a88 | 2015-06-01 13:22:01 +0200 | [diff] [blame] | 517 | * Since: 0.9.7 |
Behdad Esfahbod | 288f289 | 2013-09-06 15:40:22 -0400 | [diff] [blame] | 518 | **/ |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 519 | unsigned int |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 520 | hb_face_get_glyph_count (const hb_face_t *face) |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 521 | { |
| 522 | return face->get_num_glyphs (); |
| 523 | } |
| 524 | |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 525 | /** |
| 526 | * hb_face_get_table_tags: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 527 | * @face: A face object |
| 528 | * @start_offset: The index of first table tag to retrieve |
| 529 | * @table_count: (inout): Input = the maximum number of table tags to return; |
| 530 | * Output = the actual number of table tags returned (may be zero) |
| 531 | * @table_tags: (out) (array length=table_count): The array of table tags found |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 532 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 533 | * Fetches a list of all table tags for a face, if possible. The list returned will |
| 534 | * begin at the offset provided |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 535 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 536 | * Return value: Total number of tables, or zero if it is not possible to list |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 537 | * |
| 538 | * Since: 1.6.0 |
| 539 | **/ |
| 540 | unsigned int |
Behdad Esfahbod | 16ccfaf | 2018-08-01 22:50:06 -0700 | [diff] [blame] | 541 | hb_face_get_table_tags (const hb_face_t *face, |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 542 | unsigned int start_offset, |
| 543 | unsigned int *table_count, /* IN/OUT */ |
| 544 | hb_tag_t *table_tags /* OUT */) |
| 545 | { |
prrace | 498e437 | 2018-06-09 16:04:28 -0700 | [diff] [blame] | 546 | if (face->destroy != (hb_destroy_func_t) _hb_face_for_data_closure_destroy) |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 547 | { |
| 548 | if (table_count) |
| 549 | *table_count = 0; |
| 550 | return 0; |
| 551 | } |
Behdad Esfahbod | 2e3a07a | 2013-08-26 18:49:07 -0400 | [diff] [blame] | 552 | |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 553 | hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) face->user_data; |
| 554 | |
Behdad Esfahbod | eba1c16 | 2018-05-08 02:47:42 -0700 | [diff] [blame] | 555 | const OT::OpenTypeFontFile &ot_file = *data->blob->as<OT::OpenTypeFontFile> (); |
Behdad Esfahbod | 94b3caf | 2017-10-11 17:22:44 +0200 | [diff] [blame] | 556 | const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index); |
| 557 | |
| 558 | return ot_face.get_table_tags (start_offset, table_count, table_tags); |
| 559 | } |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 560 | |
| 561 | |
| 562 | /* |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 563 | * Character set. |
| 564 | */ |
| 565 | |
Behdad Esfahbod | a84309a | 2018-08-26 09:33:01 -0700 | [diff] [blame] | 566 | |
Behdad Esfahbod | 27de7c4 | 2019-06-19 20:07:02 -0700 | [diff] [blame] | 567 | #ifndef HB_NO_FACE_COLLECT_UNICODES |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 568 | /** |
| 569 | * hb_face_collect_unicodes: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 570 | * @face: A face object |
| 571 | * @out: The set to add Unicode characters to |
| 572 | * |
| 573 | * Collects all of the Unicode characters covered by @face and adds |
| 574 | * them to the #hb_set_t set @out. |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 575 | * |
Behdad Esfahbod | 54d332d | 2018-09-10 11:37:24 +0200 | [diff] [blame] | 576 | * Since: 1.9.0 |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 577 | */ |
| 578 | void |
| 579 | hb_face_collect_unicodes (hb_face_t *face, |
| 580 | hb_set_t *out) |
| 581 | { |
Michiharu Ariza | 5ab50ee | 2020-02-29 01:32:29 -0800 | [diff] [blame] | 582 | face->table.cmap->collect_unicodes (out, face->get_num_glyphs ()); |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 583 | } |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 584 | /** |
| 585 | * hb_face_collect_variation_selectors: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 586 | * @face: A face object |
| 587 | * @out: The set to add Variation Selector characters to |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 588 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 589 | * Collects all Unicode "Variation Selector" characters covered by @face and adds |
| 590 | * them to the #hb_set_t set @out. |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 591 | * |
Behdad Esfahbod | 54d332d | 2018-09-10 11:37:24 +0200 | [diff] [blame] | 592 | * Since: 1.9.0 |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 593 | */ |
| 594 | void |
| 595 | hb_face_collect_variation_selectors (hb_face_t *face, |
| 596 | hb_set_t *out) |
| 597 | { |
Behdad Esfahbod | 0fe7a74 | 2018-11-05 23:08:33 -0500 | [diff] [blame] | 598 | face->table.cmap->collect_variation_selectors (out); |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 599 | } |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 600 | /** |
| 601 | * hb_face_collect_variation_unicodes: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 602 | * @face: A face object |
| 603 | * @variation_selector: The Variation Selector to query |
| 604 | * @out: The set to add Unicode characters to |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 605 | * |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 606 | * Collects all Unicode characters for @variation_selector covered by @face and adds |
| 607 | * them to the #hb_set_t set @out. |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 608 | * |
Behdad Esfahbod | 54d332d | 2018-09-10 11:37:24 +0200 | [diff] [blame] | 609 | * Since: 1.9.0 |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 610 | */ |
| 611 | void |
| 612 | hb_face_collect_variation_unicodes (hb_face_t *face, |
| 613 | hb_codepoint_t variation_selector, |
| 614 | hb_set_t *out) |
| 615 | { |
Behdad Esfahbod | 0fe7a74 | 2018-11-05 23:08:33 -0500 | [diff] [blame] | 616 | face->table.cmap->collect_variation_unicodes (variation_selector, out); |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 617 | } |
Behdad Esfahbod | 27de7c4 | 2019-06-19 20:07:02 -0700 | [diff] [blame] | 618 | #endif |
Behdad Esfahbod | dae39c5 | 2018-08-25 22:44:39 -0700 | [diff] [blame] | 619 | |
| 620 | |
| 621 | /* |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 622 | * face-builder: A face that has add_table(). |
| 623 | */ |
| 624 | |
| 625 | struct hb_face_builder_data_t |
| 626 | { |
Behdad Esfahbod | 2cb8c92 | 2021-08-05 12:27:22 -0600 | [diff] [blame] | 627 | hb_hashmap_t<hb_tag_t, hb_blob_t *> tables; |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 628 | }; |
| 629 | |
Behdad Esfahbod | 74ad5dd | 2021-08-05 11:51:54 -0600 | [diff] [blame] | 630 | static int compare_entries (const void* pa, const void* pb) |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 631 | { |
Behdad Esfahbod | 74ad5dd | 2021-08-05 11:51:54 -0600 | [diff] [blame] | 632 | const auto& a = * (const hb_pair_t<hb_tag_t, hb_blob_t*> *) pa; |
| 633 | const auto& b = * (const hb_pair_t<hb_tag_t, hb_blob_t*> *) pb; |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 634 | |
Behdad Esfahbod | 74ad5dd | 2021-08-05 11:51:54 -0600 | [diff] [blame] | 635 | /* Order by blob size first (smallest to largest) and then table tag */ |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 636 | |
Behdad Esfahbod | 74ad5dd | 2021-08-05 11:51:54 -0600 | [diff] [blame] | 637 | if (a.second->length != b.second->length) |
| 638 | return a.second->length < b.second->length ? -1 : +1; |
| 639 | |
| 640 | return a.first < b.first ? -1 : a.first == b.first ? 0 : +1; |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 641 | } |
| 642 | |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 643 | static hb_face_builder_data_t * |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 644 | _hb_face_builder_data_create () |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 645 | { |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 646 | hb_face_builder_data_t *data = (hb_face_builder_data_t *) hb_calloc (1, sizeof (hb_face_builder_data_t)); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 647 | if (unlikely (!data)) |
| 648 | return nullptr; |
| 649 | |
| 650 | data->tables.init (); |
| 651 | |
| 652 | return data; |
| 653 | } |
| 654 | |
| 655 | static void |
| 656 | _hb_face_builder_data_destroy (void *user_data) |
| 657 | { |
| 658 | hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; |
| 659 | |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 660 | for (hb_blob_t* b : data->tables.values()) |
| 661 | hb_blob_destroy (b); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 662 | |
| 663 | data->tables.fini (); |
| 664 | |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 665 | hb_free (data); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | static hb_blob_t * |
| 669 | _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data) |
| 670 | { |
| 671 | |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 672 | unsigned int table_count = data->tables.get_population (); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 673 | unsigned int face_length = table_count * 16 + 12; |
| 674 | |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 675 | for (hb_blob_t* b : data->tables.values()) |
| 676 | face_length += hb_ceil_to_4 (hb_blob_get_length (b)); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 677 | |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 678 | char *buf = (char *) hb_malloc (face_length); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 679 | if (unlikely (!buf)) |
| 680 | return nullptr; |
| 681 | |
| 682 | hb_serialize_context_t c (buf, face_length); |
Behdad Esfahbod | f9417af | 2018-12-18 13:23:32 -0500 | [diff] [blame] | 683 | c.propagate_error (data->tables); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 684 | OT::OpenTypeFontFile *f = c.start_serialize<OT::OpenTypeFontFile> (); |
| 685 | |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 686 | bool is_cff = (data->tables.has (HB_TAG ('C','F','F',' ')) |
| 687 | || data->tables.has (HB_TAG ('C','F','F','2'))); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 688 | hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag; |
| 689 | |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 690 | // Sort the tags so that produced face is deterministic. |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 691 | hb_vector_t<hb_pair_t <hb_tag_t, hb_blob_t*>> sorted_entries; |
| 692 | data->tables.iter () | hb_sink (sorted_entries); |
Garret Rieger | 8c0c217 | 2021-08-06 10:45:38 -0700 | [diff] [blame] | 693 | if (unlikely (sorted_entries.in_error ())) |
| 694 | { |
| 695 | hb_free (buf); |
| 696 | return nullptr; |
| 697 | } |
| 698 | |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 699 | sorted_entries.qsort (compare_entries); |
| 700 | bool ret = f->serialize_single (&c, sfnt_tag, + sorted_entries.iter()); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 701 | |
| 702 | c.end_serialize (); |
| 703 | |
| 704 | if (unlikely (!ret)) |
| 705 | { |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 706 | hb_free (buf); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 707 | return nullptr; |
| 708 | } |
| 709 | |
Behdad Esfahbod | 2337f0d | 2021-07-08 10:58:50 -0600 | [diff] [blame] | 710 | return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, hb_free); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 711 | } |
| 712 | |
| 713 | static hb_blob_t * |
Behdad Esfahbod | 39bd07a | 2018-10-26 21:01:11 -0700 | [diff] [blame] | 714 | _hb_face_builder_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 715 | { |
| 716 | hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; |
| 717 | |
| 718 | if (!tag) |
| 719 | return _hb_face_builder_data_reference_blob (data); |
| 720 | |
Garret Rieger | c2ee1fd | 2021-08-04 16:42:49 -0700 | [diff] [blame] | 721 | return hb_blob_reference (data->tables[tag]); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | |
| 725 | /** |
| 726 | * hb_face_builder_create: |
| 727 | * |
| 728 | * Creates a #hb_face_t that can be used with hb_face_builder_add_table(). |
| 729 | * After tables are added to the face, it can be compiled to a binary |
| 730 | * font file by calling hb_face_reference_blob(). |
| 731 | * |
HinTak | bd1be87 | 2018-10-03 07:11:22 +0800 | [diff] [blame] | 732 | * Return value: (transfer full): New face. |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 733 | * |
Behdad Esfahbod | 54d332d | 2018-09-10 11:37:24 +0200 | [diff] [blame] | 734 | * Since: 1.9.0 |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 735 | **/ |
| 736 | hb_face_t * |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 737 | hb_face_builder_create () |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 738 | { |
| 739 | hb_face_builder_data_t *data = _hb_face_builder_data_create (); |
| 740 | if (unlikely (!data)) return hb_face_get_empty (); |
| 741 | |
| 742 | return hb_face_create_for_tables (_hb_face_builder_reference_table, |
| 743 | data, |
| 744 | _hb_face_builder_data_destroy); |
| 745 | } |
| 746 | |
| 747 | /** |
| 748 | * hb_face_builder_add_table: |
Nathan Willis | 3e72feb | 2019-04-22 19:21:27 +0100 | [diff] [blame] | 749 | * @face: A face object created with hb_face_builder_create() |
| 750 | * @tag: The #hb_tag_t of the table to add |
| 751 | * @blob: The blob containing the table data to add |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 752 | * |
| 753 | * Add table for @tag with data provided by @blob to the face. @face must |
| 754 | * be created using hb_face_builder_create(). |
| 755 | * |
Behdad Esfahbod | 54d332d | 2018-09-10 11:37:24 +0200 | [diff] [blame] | 756 | * Since: 1.9.0 |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 757 | **/ |
| 758 | hb_bool_t |
| 759 | hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) |
| 760 | { |
Garret Rieger | e5bfd49 | 2021-08-05 14:03:25 -0700 | [diff] [blame] | 761 | if (tag == HB_MAP_VALUE_INVALID) |
| 762 | return false; |
| 763 | |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 764 | if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy)) |
| 765 | return false; |
| 766 | |
| 767 | hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data; |
Garret Rieger | dae32b4 | 2020-07-28 18:31:46 -0700 | [diff] [blame] | 768 | |
Garret Rieger | 222b74f | 2021-08-05 11:39:26 -0700 | [diff] [blame] | 769 | hb_blob_t* previous = data->tables.get (tag); |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 770 | if (!data->tables.set (tag, hb_blob_reference (blob))) |
| 771 | { |
| 772 | hb_blob_destroy (blob); |
Garret Rieger | dae32b4 | 2020-07-28 18:31:46 -0700 | [diff] [blame] | 773 | return false; |
Garret Rieger | dea0fe5 | 2021-08-04 16:36:20 -0700 | [diff] [blame] | 774 | } |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 775 | |
Garret Rieger | 222b74f | 2021-08-05 11:39:26 -0700 | [diff] [blame] | 776 | hb_blob_destroy (previous); |
Behdad Esfahbod | aadb2a9 | 2018-08-25 08:18:53 -0700 | [diff] [blame] | 777 | return true; |
| 778 | } |