Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 1 | /* |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 2 | * Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu> |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 3 | * Copyright © 2018 Google, Inc. |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 4 | * Copyright © 2018-2019 Ebrahim Byagowi |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 5 | * |
| 6 | * This is part of HarfBuzz, a text shaping library. |
| 7 | * |
| 8 | * Permission is hereby granted, without written agreement and without |
| 9 | * license or royalty fees, to use, copy, modify, and distribute this |
| 10 | * software and its documentation for any purpose, provided that the |
| 11 | * above copyright notice and the following two paragraphs appear in |
| 12 | * all copies of this software. |
| 13 | * |
| 14 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 15 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 17 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 18 | * DAMAGE. |
| 19 | * |
| 20 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 21 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 23 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 24 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 25 | * |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 26 | * Google Author(s): Behdad Esfahbod |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 27 | */ |
| 28 | |
Ebrahim Byagowi | 0ad8c66 | 2018-02-26 12:45:08 +0330 | [diff] [blame] | 29 | #ifndef HB_OT_LAYOUT_BASE_TABLE_HH |
| 30 | #define HB_OT_LAYOUT_BASE_TABLE_HH |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 31 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 32 | #include "hb-open-type.hh" |
| 33 | #include "hb-ot-layout-common.hh" |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 34 | |
| 35 | namespace OT { |
| 36 | |
| 37 | /* |
Ebrahim Byagowi | a02c3ee | 2018-04-12 13:38:19 +0430 | [diff] [blame] | 38 | * BASE -- Baseline |
| 39 | * https://docs.microsoft.com/en-us/typography/opentype/spec/base |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 40 | */ |
| 41 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 42 | struct BaseCoordFormat1 |
| 43 | { |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 44 | hb_position_t get_coord () const { return coordinate; } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 45 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 46 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 47 | { |
| 48 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 49 | return_trace (likely (c->check_struct (this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 50 | } |
| 51 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 52 | protected: |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 53 | HBUINT16 format; /* Format identifier--format = 1 */ |
Behdad Esfahbod | da48aca | 2018-08-06 05:52:12 -0700 | [diff] [blame] | 54 | FWORD coordinate; /* X or Y value, in design units */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 55 | public: |
| 56 | DEFINE_SIZE_STATIC (4); |
| 57 | }; |
| 58 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 59 | struct BaseCoordFormat2 |
| 60 | { |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 61 | hb_position_t get_coord () const |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 62 | { |
| 63 | /* TODO */ |
| 64 | return coordinate; |
| 65 | } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 66 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 67 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 68 | { |
| 69 | TRACE_SANITIZE (this); |
| 70 | return_trace (c->check_struct (this)); |
| 71 | } |
| 72 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 73 | protected: |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 74 | HBUINT16 format; /* Format identifier--format = 2 */ |
Behdad Esfahbod | da48aca | 2018-08-06 05:52:12 -0700 | [diff] [blame] | 75 | FWORD coordinate; /* X or Y value, in design units */ |
Behdad Esfahbod | c852b86 | 2021-09-19 16:30:12 -0400 | [diff] [blame] | 76 | HBGlyphID16 referenceGlyph; /* Glyph ID of control glyph */ |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 77 | HBUINT16 coordPoint; /* Index of contour point on the |
| 78 | * reference glyph */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 79 | public: |
| 80 | DEFINE_SIZE_STATIC (8); |
| 81 | }; |
| 82 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 83 | struct BaseCoordFormat3 |
| 84 | { |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 85 | hb_position_t get_coord (hb_font_t *font, |
| 86 | const VariationStore &var_store, |
| 87 | hb_direction_t direction) const |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 88 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 89 | const Device &device = this+deviceTable; |
| 90 | return coordinate + (HB_DIRECTION_IS_VERTICAL (direction) ? |
| 91 | device.get_y_delta (font, var_store) : |
| 92 | device.get_x_delta (font, var_store)); |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 93 | } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 94 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 95 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 96 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 97 | { |
| 98 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 99 | return_trace (likely (c->check_struct (this) && |
| 100 | deviceTable.sanitize (c, this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 101 | } |
| 102 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 103 | protected: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 104 | HBUINT16 format; /* Format identifier--format = 3 */ |
| 105 | FWORD coordinate; /* X or Y value, in design units */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 106 | Offset16To<Device> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 107 | deviceTable; /* Offset to Device table for X or |
| 108 | * Y value, from beginning of |
| 109 | * BaseCoord table (may be NULL). */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 110 | public: |
| 111 | DEFINE_SIZE_STATIC (6); |
| 112 | }; |
| 113 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 114 | struct BaseCoord |
| 115 | { |
Ebrahim Byagowi | d9c44e7 | 2019-07-28 20:35:32 +0430 | [diff] [blame] | 116 | bool has_data () const { return u.format; } |
| 117 | |
Ebrahim Byagowi | ed2965a | 2019-07-30 03:34:10 +0430 | [diff] [blame] | 118 | hb_position_t get_coord (hb_font_t *font, |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 119 | const VariationStore &var_store, |
Ebrahim Byagowi | ed2965a | 2019-07-30 03:34:10 +0430 | [diff] [blame] | 120 | hb_direction_t direction) const |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 121 | { |
| 122 | switch (u.format) { |
| 123 | case 1: return u.format1.get_coord (); |
| 124 | case 2: return u.format2.get_coord (); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 125 | case 3: return u.format3.get_coord (font, var_store, direction); |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 126 | default:return 0; |
| 127 | } |
| 128 | } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 129 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 130 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 131 | { |
| 132 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 133 | if (unlikely (!u.format.sanitize (c))) return_trace (false); |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 134 | switch (u.format) { |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 135 | case 1: return_trace (u.format1.sanitize (c)); |
| 136 | case 2: return_trace (u.format2.sanitize (c)); |
| 137 | case 3: return_trace (u.format3.sanitize (c)); |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 138 | default:return_trace (false); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 139 | } |
| 140 | } |
| 141 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 142 | protected: |
| 143 | union { |
Ebrahim Byagowi | d9c44e7 | 2019-07-28 20:35:32 +0430 | [diff] [blame] | 144 | HBUINT16 format; |
| 145 | BaseCoordFormat1 format1; |
| 146 | BaseCoordFormat2 format2; |
| 147 | BaseCoordFormat3 format3; |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 148 | } u; |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 149 | public: |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 150 | DEFINE_SIZE_UNION (2, format); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 151 | }; |
| 152 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 153 | struct FeatMinMaxRecord |
| 154 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 155 | int cmp (hb_tag_t key) const { return tag.cmp (key); } |
| 156 | |
| 157 | bool has_data () const { return tag; } |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 158 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 159 | void get_min_max (const BaseCoord **min, const BaseCoord **max) const |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 160 | { |
| 161 | if (likely (min)) *min = &(this+minCoord); |
| 162 | if (likely (max)) *max = &(this+maxCoord); |
| 163 | } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 164 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 165 | bool sanitize (hb_sanitize_context_t *c, const void *base) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 166 | { |
| 167 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 168 | return_trace (likely (c->check_struct (this) && |
| 169 | minCoord.sanitize (c, this) && |
| 170 | maxCoord.sanitize (c, this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 171 | } |
| 172 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 173 | protected: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 174 | Tag tag; /* 4-byte feature identification tag--must |
| 175 | * match feature tag in FeatureList */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 176 | Offset16To<BaseCoord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 177 | minCoord; /* Offset to BaseCoord table that defines |
| 178 | * the minimum extent value, from beginning |
| 179 | * of MinMax table (may be NULL) */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 180 | Offset16To<BaseCoord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 181 | maxCoord; /* Offset to BaseCoord table that defines |
| 182 | * the maximum extent value, from beginning |
| 183 | * of MinMax table (may be NULL) */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 184 | public: |
| 185 | DEFINE_SIZE_STATIC (8); |
| 186 | |
| 187 | }; |
| 188 | |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 189 | struct MinMax |
| 190 | { |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 191 | void get_min_max (hb_tag_t feature_tag, |
Ebrahim Byagowi | eddd456 | 2019-07-28 02:21:54 +0430 | [diff] [blame] | 192 | const BaseCoord **min, |
| 193 | const BaseCoord **max) const |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 194 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 195 | const FeatMinMaxRecord &minMaxCoord = featMinMaxRecords.bsearch (feature_tag); |
| 196 | if (minMaxCoord.has_data ()) |
| 197 | minMaxCoord.get_min_max (min, max); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 198 | else |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 199 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 200 | if (likely (min)) *min = &(this+minCoord); |
| 201 | if (likely (max)) *max = &(this+maxCoord); |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 202 | } |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 203 | } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 204 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 205 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 206 | { |
| 207 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 208 | return_trace (likely (c->check_struct (this) && |
| 209 | minCoord.sanitize (c, this) && |
| 210 | maxCoord.sanitize (c, this) && |
| 211 | featMinMaxRecords.sanitize (c, this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 212 | } |
| 213 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 214 | protected: |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 215 | Offset16To<BaseCoord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 216 | minCoord; /* Offset to BaseCoord table that defines |
| 217 | * minimum extent value, from the beginning |
| 218 | * of MinMax table (may be NULL) */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 219 | Offset16To<BaseCoord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 220 | maxCoord; /* Offset to BaseCoord table that defines |
| 221 | * maximum extent value, from the beginning |
| 222 | * of MinMax table (may be NULL) */ |
Behdad Esfahbod | 4dba749 | 2021-03-31 16:09:39 -0600 | [diff] [blame] | 223 | SortedArray16Of<FeatMinMaxRecord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 224 | featMinMaxRecords; |
| 225 | /* Array of FeatMinMaxRecords, in alphabetical |
| 226 | * order by featureTableTag */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 227 | public: |
Behdad Esfahbod | 7a70c20 | 2018-02-27 12:45:26 -0800 | [diff] [blame] | 228 | DEFINE_SIZE_ARRAY (6, featMinMaxRecords); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 229 | }; |
| 230 | |
Behdad Esfahbod | 551fa2d | 2018-02-25 16:32:17 -0800 | [diff] [blame] | 231 | struct BaseValues |
| 232 | { |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 233 | const BaseCoord &get_base_coord (int baseline_tag_index) const |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 234 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 235 | if (baseline_tag_index == -1) baseline_tag_index = defaultIndex; |
| 236 | return this+baseCoords[baseline_tag_index]; |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 237 | } |
| 238 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 239 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 240 | { |
| 241 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 242 | return_trace (likely (c->check_struct (this) && |
| 243 | baseCoords.sanitize (c, this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 244 | } |
| 245 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 246 | protected: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 247 | Index defaultIndex; /* Index number of default baseline for this |
| 248 | * script — equals index position of baseline tag |
| 249 | * in baselineTags array of the BaseTagList */ |
Behdad Esfahbod | 6c4e049 | 2021-03-31 15:31:32 -0600 | [diff] [blame] | 250 | Array16OfOffset16To<BaseCoord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 251 | baseCoords; /* Number of BaseCoord tables defined — should equal |
| 252 | * baseTagCount in the BaseTagList |
| 253 | * |
| 254 | * Array of offsets to BaseCoord tables, from beginning of |
| 255 | * BaseValues table — order matches baselineTags array in |
| 256 | * the BaseTagList */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 257 | public: |
Behdad Esfahbod | da48aca | 2018-08-06 05:52:12 -0700 | [diff] [blame] | 258 | DEFINE_SIZE_ARRAY (4, baseCoords); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 259 | }; |
| 260 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 261 | struct BaseLangSysRecord |
| 262 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 263 | int cmp (hb_tag_t key) const { return baseLangSysTag.cmp (key); } |
| 264 | |
| 265 | bool has_data () const { return baseLangSysTag; } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 266 | |
Ebrahim Byagowi | 69655d5 | 2019-07-28 20:39:20 +0430 | [diff] [blame] | 267 | const MinMax &get_min_max () const { return this+minMax; } |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 268 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 269 | bool sanitize (hb_sanitize_context_t *c, const void *base) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 270 | { |
| 271 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 272 | return_trace (likely (c->check_struct (this) && |
| 273 | minMax.sanitize (c, this))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 274 | } |
| 275 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 276 | protected: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 277 | Tag baseLangSysTag; /* 4-byte language system identification tag */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 278 | Offset16To<MinMax> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 279 | minMax; /* Offset to MinMax table, from beginning |
| 280 | * of BaseScript table */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 281 | public: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 282 | DEFINE_SIZE_STATIC (6); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 283 | }; |
| 284 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 285 | struct BaseScript |
| 286 | { |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 287 | const MinMax &get_min_max (hb_tag_t language_tag) const |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 288 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 289 | const BaseLangSysRecord& record = baseLangSysRecords.bsearch (language_tag); |
| 290 | return record.has_data () ? record.get_min_max () : this+defaultMinMax; |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 291 | } |
| 292 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 293 | const BaseCoord &get_base_coord (int baseline_tag_index) const |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 294 | { return (this+baseValues).get_base_coord (baseline_tag_index); } |
| 295 | |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 296 | bool has_data () const { return baseValues; } |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 297 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 298 | bool sanitize (hb_sanitize_context_t *c) const |
Ebrahim Byagowi | 0ad8c66 | 2018-02-26 12:45:08 +0330 | [diff] [blame] | 299 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 300 | TRACE_SANITIZE (this); |
| 301 | return_trace (likely (c->check_struct (this) && |
| 302 | baseValues.sanitize (c, this) && |
| 303 | defaultMinMax.sanitize (c, this) && |
| 304 | baseLangSysRecords.sanitize (c, this))); |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 305 | } |
| 306 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 307 | protected: |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 308 | Offset16To<BaseValues> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 309 | baseValues; /* Offset to BaseValues table, from beginning |
| 310 | * of BaseScript table (may be NULL) */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 311 | Offset16To<MinMax> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 312 | defaultMinMax; /* Offset to MinMax table, from beginning of |
| 313 | * BaseScript table (may be NULL) */ |
Behdad Esfahbod | 4dba749 | 2021-03-31 16:09:39 -0600 | [diff] [blame] | 314 | SortedArray16Of<BaseLangSysRecord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 315 | baseLangSysRecords; |
| 316 | /* Number of BaseLangSysRecords |
| 317 | * defined — may be zero (0) */ |
| 318 | |
| 319 | public: |
| 320 | DEFINE_SIZE_ARRAY (6, baseLangSysRecords); |
| 321 | }; |
| 322 | |
| 323 | struct BaseScriptList; |
| 324 | struct BaseScriptRecord |
| 325 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 326 | int cmp (hb_tag_t key) const { return baseScriptTag.cmp (key); } |
| 327 | |
| 328 | bool has_data () const { return baseScriptTag; } |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 329 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 330 | const BaseScript &get_base_script (const BaseScriptList *list) const |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 331 | { return list+baseScript; } |
| 332 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 333 | bool sanitize (hb_sanitize_context_t *c, const void *base) const |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 334 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 335 | TRACE_SANITIZE (this); |
| 336 | return_trace (likely (c->check_struct (this) && |
| 337 | baseScript.sanitize (c, base))); |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 338 | } |
| 339 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 340 | protected: |
| 341 | Tag baseScriptTag; /* 4-byte script identification tag */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 342 | Offset16To<BaseScript> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 343 | baseScript; /* Offset to BaseScript table, from beginning |
| 344 | * of BaseScriptList */ |
| 345 | |
| 346 | public: |
| 347 | DEFINE_SIZE_STATIC (6); |
| 348 | }; |
| 349 | |
| 350 | struct BaseScriptList |
| 351 | { |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 352 | const BaseScript &get_base_script (hb_tag_t script) const |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 353 | { |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 354 | const BaseScriptRecord *record = &baseScriptRecords.bsearch (script); |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 355 | if (!record->has_data ()) record = &baseScriptRecords.bsearch (HB_TAG ('D','F','L','T')); |
Ebrahim Byagowi | c7b22b9 | 2019-07-28 19:46:57 +0430 | [diff] [blame] | 356 | return record->has_data () ? record->get_base_script (this) : Null (BaseScript); |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 357 | } |
| 358 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 359 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 360 | { |
| 361 | TRACE_SANITIZE (this); |
| 362 | return_trace (c->check_struct (this) && |
Behdad Esfahbod | da48aca | 2018-08-06 05:52:12 -0700 | [diff] [blame] | 363 | baseScriptRecords.sanitize (c, this)); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 364 | } |
| 365 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 366 | protected: |
Behdad Esfahbod | 4dba749 | 2021-03-31 16:09:39 -0600 | [diff] [blame] | 367 | SortedArray16Of<BaseScriptRecord> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 368 | baseScriptRecords; |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 369 | |
| 370 | public: |
Behdad Esfahbod | da48aca | 2018-08-06 05:52:12 -0700 | [diff] [blame] | 371 | DEFINE_SIZE_ARRAY (2, baseScriptRecords); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 372 | }; |
| 373 | |
Elie Roux | a0bdd54 | 2017-02-25 16:34:58 +0100 | [diff] [blame] | 374 | struct Axis |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 375 | { |
Ebrahim Byagowi | ed2965a | 2019-07-30 03:34:10 +0430 | [diff] [blame] | 376 | bool get_baseline (hb_tag_t baseline_tag, |
| 377 | hb_tag_t script_tag, |
| 378 | hb_tag_t language_tag, |
| 379 | const BaseCoord **coord) const |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 380 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 381 | const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); |
Koji Ishii | 7e6070a | 2020-08-31 17:21:21 +0900 | [diff] [blame] | 382 | if (!base_script.has_data ()) |
| 383 | { |
| 384 | *coord = nullptr; |
| 385 | return false; |
| 386 | } |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 387 | |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 388 | if (likely (coord)) |
| 389 | { |
| 390 | unsigned int tag_index = 0; |
Koji Ishii | 7e6070a | 2020-08-31 17:21:21 +0900 | [diff] [blame] | 391 | if (!(this+baseTagList).bfind (baseline_tag, &tag_index)) |
| 392 | { |
| 393 | *coord = nullptr; |
| 394 | return false; |
| 395 | } |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 396 | *coord = &base_script.get_base_coord (tag_index); |
| 397 | } |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 398 | |
| 399 | return true; |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 400 | } |
| 401 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 402 | bool get_min_max (hb_tag_t script_tag, |
| 403 | hb_tag_t language_tag, |
| 404 | hb_tag_t feature_tag, |
| 405 | const BaseCoord **min_coord, |
| 406 | const BaseCoord **max_coord) const |
Ebrahim Byagowi | 0ad8c66 | 2018-02-26 12:45:08 +0330 | [diff] [blame] | 407 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 408 | const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); |
Koji Ishii | 7e6070a | 2020-08-31 17:21:21 +0900 | [diff] [blame] | 409 | if (!base_script.has_data ()) |
| 410 | { |
| 411 | *min_coord = *max_coord = nullptr; |
| 412 | return false; |
| 413 | } |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 414 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 415 | base_script.get_min_max (language_tag).get_min_max (feature_tag, min_coord, max_coord); |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 416 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 417 | return true; |
Elie Roux | d34e35b | 2017-02-25 20:41:05 +0100 | [diff] [blame] | 418 | } |
| 419 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 420 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 421 | { |
| 422 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 423 | return_trace (likely (c->check_struct (this) && |
| 424 | (this+baseTagList).sanitize (c) && |
| 425 | (this+baseScriptList).sanitize (c))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 426 | } |
| 427 | |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 428 | protected: |
Behdad Esfahbod | 4dba749 | 2021-03-31 16:09:39 -0600 | [diff] [blame] | 429 | Offset16To<SortedArray16Of<Tag>> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 430 | baseTagList; /* Offset to BaseTagList table, from beginning |
| 431 | * of Axis table (may be NULL) |
| 432 | * Array of 4-byte baseline identification tags — must |
| 433 | * be in alphabetical order */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 434 | Offset16To<BaseScriptList> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 435 | baseScriptList; /* Offset to BaseScriptList table, from beginning |
| 436 | * of Axis table |
| 437 | * Array of BaseScriptRecords, in alphabetical order |
| 438 | * by baseScriptTag */ |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 439 | |
| 440 | public: |
| 441 | DEFINE_SIZE_STATIC (4); |
| 442 | }; |
| 443 | |
Behdad Esfahbod | d7633d0 | 2018-02-27 12:50:57 -0800 | [diff] [blame] | 444 | struct BASE |
Elie Roux | f131f00 | 2017-02-19 10:12:22 +0100 | [diff] [blame] | 445 | { |
Behdad Esfahbod | ef00654 | 2019-01-22 12:08:57 +0100 | [diff] [blame] | 446 | static constexpr hb_tag_t tableTag = HB_OT_TAG_BASE; |
Elie Roux | f131f00 | 2017-02-19 10:12:22 +0100 | [diff] [blame] | 447 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 448 | const Axis &get_axis (hb_direction_t direction) const |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 449 | { return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; } |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 450 | |
Ebrahim Byagowi | e412008 | 2018-12-17 21:31:01 +0330 | [diff] [blame] | 451 | const VariationStore &get_var_store () const |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 452 | { return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; } |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 453 | |
Ebrahim Byagowi | ed2965a | 2019-07-30 03:34:10 +0430 | [diff] [blame] | 454 | bool get_baseline (hb_font_t *font, |
| 455 | hb_tag_t baseline_tag, |
| 456 | hb_direction_t direction, |
| 457 | hb_tag_t script_tag, |
| 458 | hb_tag_t language_tag, |
| 459 | hb_position_t *base) const |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 460 | { |
Ebrahim Byagowi | 69655d5 | 2019-07-28 20:39:20 +0430 | [diff] [blame] | 461 | const BaseCoord *base_coord = nullptr; |
Ebrahim Byagowi | ed2965a | 2019-07-30 03:34:10 +0430 | [diff] [blame] | 462 | if (unlikely (!get_axis (direction).get_baseline (baseline_tag, script_tag, language_tag, &base_coord) || |
Ebrahim Byagowi | 87454c4 | 2019-07-28 20:46:47 +0430 | [diff] [blame] | 463 | !base_coord || !base_coord->has_data ())) |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 464 | return false; |
| 465 | |
Ebrahim Byagowi | 87454c4 | 2019-07-28 20:46:47 +0430 | [diff] [blame] | 466 | if (likely (base)) |
Ebrahim Byagowi | a157342 | 2019-07-28 18:54:13 +0430 | [diff] [blame] | 467 | *base = base_coord->get_coord (font, get_var_store (), direction); |
| 468 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 469 | return true; |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 470 | } |
| 471 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 472 | /* TODO: Expose this separately sometime? */ |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 473 | bool get_min_max (hb_font_t *font, |
| 474 | hb_direction_t direction, |
| 475 | hb_tag_t script_tag, |
| 476 | hb_tag_t language_tag, |
| 477 | hb_tag_t feature_tag, |
| 478 | hb_position_t *min, |
| 479 | hb_position_t *max) |
Ebrahim Byagowi | 0ad8c66 | 2018-02-26 12:45:08 +0330 | [diff] [blame] | 480 | { |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 481 | const BaseCoord *min_coord, *max_coord; |
| 482 | if (!get_axis (direction).get_min_max (script_tag, language_tag, feature_tag, |
| 483 | &min_coord, &max_coord)) |
| 484 | return false; |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 485 | |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 486 | const VariationStore &var_store = get_var_store (); |
| 487 | if (likely (min && min_coord)) *min = min_coord->get_coord (font, var_store, direction); |
| 488 | if (likely (max && max_coord)) *max = max_coord->get_coord (font, var_store, direction); |
| 489 | return true; |
Elie Roux | 3963315 | 2017-02-26 15:07:53 +0100 | [diff] [blame] | 490 | } |
| 491 | |
Ebrahim Byagowi | b2ebaa9 | 2018-12-16 22:38:10 +0330 | [diff] [blame] | 492 | bool sanitize (hb_sanitize_context_t *c) const |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 493 | { |
| 494 | TRACE_SANITIZE (this); |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 495 | return_trace (likely (c->check_struct (this) && |
| 496 | likely (version.major == 1) && |
| 497 | hAxis.sanitize (c, this) && |
| 498 | vAxis.sanitize (c, this) && |
| 499 | (version.to_int () < 0x00010001u || varStore.sanitize (c, this)))); |
Elie Roux | 1d30c6d | 2017-02-25 16:19:35 +0100 | [diff] [blame] | 500 | } |
| 501 | |
Elie Roux | f131f00 | 2017-02-19 10:12:22 +0100 | [diff] [blame] | 502 | protected: |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 503 | FixedVersion<>version; /* Version of the BASE table */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 504 | Offset16To<Axis>hAxis; /* Offset to horizontal Axis table, from beginning |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 505 | * of BASE table (may be NULL) */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 506 | Offset16To<Axis>vAxis; /* Offset to vertical Axis table, from beginning |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 507 | * of BASE table (may be NULL) */ |
Behdad Esfahbod | ad28f97 | 2021-03-31 12:49:14 -0600 | [diff] [blame] | 508 | Offset32To<VariationStore> |
Ebrahim Byagowi | b8a78ce | 2018-11-03 22:28:30 +0330 | [diff] [blame] | 509 | varStore; /* Offset to the table of Item Variation |
| 510 | * Store--from beginning of BASE |
| 511 | * header (may be NULL). Introduced |
| 512 | * in version 0x00010001. */ |
Elie Roux | f131f00 | 2017-02-19 10:12:22 +0100 | [diff] [blame] | 513 | public: |
Behdad Esfahbod | d7633d0 | 2018-02-27 12:50:57 -0800 | [diff] [blame] | 514 | DEFINE_SIZE_MIN (8); |
Elie Roux | f748e11 | 2017-02-18 19:54:33 +0100 | [diff] [blame] | 515 | }; |
| 516 | |
| 517 | |
| 518 | } /* namespace OT */ |
| 519 | |
| 520 | |
Ebrahim Byagowi | 0ad8c66 | 2018-02-26 12:45:08 +0330 | [diff] [blame] | 521 | #endif /* HB_OT_LAYOUT_BASE_TABLE_HH */ |