Behdad Esfahbod | 8fe4c74 | 2012-07-24 21:05:12 -0400 | [diff] [blame] | 1 | /* |
Behdad Esfahbod | 56f541d | 2018-11-12 19:46:37 -0500 | [diff] [blame] | 2 | * Copyright © 2012,2018 Google, Inc. |
Behdad Esfahbod | 8fe4c74 | 2012-07-24 21:05:12 -0400 | [diff] [blame] | 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 |
| 25 | */ |
| 26 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 27 | #ifndef HB_SHAPE_PLAN_HH |
| 28 | #define HB_SHAPE_PLAN_HH |
Behdad Esfahbod | 8fe4c74 | 2012-07-24 21:05:12 -0400 | [diff] [blame] | 29 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 30 | #include "hb.hh" |
| 31 | #include "hb-shaper.hh" |
Behdad Esfahbod | f521a28 | 2018-11-11 21:32:01 -0500 | [diff] [blame] | 32 | #include "hb-ot-shape.hh" |
Behdad Esfahbod | 8fe4c74 | 2012-07-24 21:05:12 -0400 | [diff] [blame] | 33 | |
| 34 | |
Behdad Esfahbod | 5666122 | 2018-11-12 17:19:45 -0500 | [diff] [blame] | 35 | struct hb_shape_plan_key_t |
| 36 | { |
| 37 | hb_segment_properties_t props; |
| 38 | |
| 39 | const hb_feature_t *user_features; |
| 40 | unsigned int num_user_features; |
| 41 | |
Behdad Esfahbod | 7aad536 | 2019-06-26 13:21:03 -0700 | [diff] [blame] | 42 | #ifndef HB_NO_OT_SHAPE |
Behdad Esfahbod | cc84287 | 2018-11-12 18:48:10 -0500 | [diff] [blame] | 43 | hb_ot_shape_plan_key_t ot; |
Behdad Esfahbod | 7aad536 | 2019-06-26 13:21:03 -0700 | [diff] [blame] | 44 | #endif |
Behdad Esfahbod | 5666122 | 2018-11-12 17:19:45 -0500 | [diff] [blame] | 45 | |
| 46 | hb_shape_func_t *shaper_func; |
| 47 | const char *shaper_name; |
Behdad Esfahbod | c7be933 | 2018-11-12 17:49:15 -0500 | [diff] [blame] | 48 | |
Behdad Esfahbod | df44480 | 2019-07-02 17:11:09 -0700 | [diff] [blame] | 49 | HB_INTERNAL bool init (bool copy, |
| 50 | hb_face_t *face, |
| 51 | const hb_segment_properties_t *props, |
| 52 | const hb_feature_t *user_features, |
| 53 | unsigned int num_user_features, |
| 54 | const int *coords, |
| 55 | unsigned int num_coords, |
| 56 | const char * const *shaper_list); |
Behdad Esfahbod | c7be933 | 2018-11-12 17:49:15 -0500 | [diff] [blame] | 57 | |
Behdad Esfahbod | 79b23cc | 2022-07-20 15:38:34 -0600 | [diff] [blame] | 58 | HB_INTERNAL void fini () { hb_free ((void *) user_features); user_features = nullptr; } |
Behdad Esfahbod | cc84287 | 2018-11-12 18:48:10 -0500 | [diff] [blame] | 59 | |
Behdad Esfahbod | 6c22f3f | 2018-11-12 19:26:01 -0500 | [diff] [blame] | 60 | HB_INTERNAL bool user_features_match (const hb_shape_plan_key_t *other); |
Behdad Esfahbod | cc84287 | 2018-11-12 18:48:10 -0500 | [diff] [blame] | 61 | |
Behdad Esfahbod | 6c22f3f | 2018-11-12 19:26:01 -0500 | [diff] [blame] | 62 | HB_INTERNAL bool equal (const hb_shape_plan_key_t *other); |
Behdad Esfahbod | 5666122 | 2018-11-12 17:19:45 -0500 | [diff] [blame] | 63 | }; |
| 64 | |
Behdad Esfahbod | 027857d | 2012-07-26 17:34:25 -0400 | [diff] [blame] | 65 | struct hb_shape_plan_t |
| 66 | { |
Behdad Esfahbod | 79b23cc | 2022-07-20 15:38:34 -0600 | [diff] [blame] | 67 | ~hb_shape_plan_t () { key.fini (); } |
Behdad Esfahbod | 027857d | 2012-07-26 17:34:25 -0400 | [diff] [blame] | 68 | hb_object_header_t header; |
Behdad Esfahbod | f47b921 | 2013-12-02 05:57:27 -0500 | [diff] [blame] | 69 | hb_face_t *face_unsafe; /* We don't carry a reference to face. */ |
Behdad Esfahbod | 5666122 | 2018-11-12 17:19:45 -0500 | [diff] [blame] | 70 | hb_shape_plan_key_t key; |
Behdad Esfahbod | 7aad536 | 2019-06-26 13:21:03 -0700 | [diff] [blame] | 71 | #ifndef HB_NO_OT_SHAPE |
Behdad Esfahbod | f521a28 | 2018-11-11 21:32:01 -0500 | [diff] [blame] | 72 | hb_ot_shape_plan_t ot; |
Behdad Esfahbod | 7aad536 | 2019-06-26 13:21:03 -0700 | [diff] [blame] | 73 | #endif |
Behdad Esfahbod | 027857d | 2012-07-26 17:34:25 -0400 | [diff] [blame] | 74 | }; |
| 75 | |
Behdad Esfahbod | 027857d | 2012-07-26 17:34:25 -0400 | [diff] [blame] | 76 | |
Behdad Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 77 | #endif /* HB_SHAPE_PLAN_HH */ |