xref: /aosp_15_r20/external/harfbuzz_ng/src/hb-limits.hh (revision 2d1272b857b1f7575e6e246373e1cb218663db8a)
1 /*
2  * Copyright © 2022  Behdad Esfahbod
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 
25 #ifndef HB_LIMITS_HH
26 #define HB_LIMITS_HH
27 
28 #include "hb.hh"
29 
30 
31 #ifndef HB_BUFFER_MAX_LEN_FACTOR
32 #define HB_BUFFER_MAX_LEN_FACTOR 64
33 #endif
34 #ifndef HB_BUFFER_MAX_LEN_MIN
35 #define HB_BUFFER_MAX_LEN_MIN 16384
36 #endif
37 #ifndef HB_BUFFER_MAX_LEN_DEFAULT
38 #define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
39 #endif
40 
41 #ifndef HB_BUFFER_MAX_OPS_FACTOR
42 #define HB_BUFFER_MAX_OPS_FACTOR 1024
43 #endif
44 #ifndef HB_BUFFER_MAX_OPS_MIN
45 #define HB_BUFFER_MAX_OPS_MIN 16384
46 #endif
47 #ifndef HB_BUFFER_MAX_OPS_DEFAULT
48 #define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */
49 #endif
50 
51 
52 #ifndef HB_MAX_NESTING_LEVEL
53 #define HB_MAX_NESTING_LEVEL 64
54 #endif
55 
56 
57 #ifndef HB_MAX_CONTEXT_LENGTH
58 #define HB_MAX_CONTEXT_LENGTH 64
59 #endif
60 
61 #ifndef HB_CLOSURE_MAX_STAGES
62 /*
63  * The maximum number of times a lookup can be applied during shaping.
64  * Used to limit the number of iterations of the closure algorithm.
65  * This must be larger than the number of times add_gsub_pause() is
66  * called in a collect_features call of any shaper.
67  */
68 #define HB_CLOSURE_MAX_STAGES 12
69 #endif
70 
71 #ifndef HB_MAX_SCRIPTS
72 #define HB_MAX_SCRIPTS 500
73 #endif
74 
75 #ifndef HB_MAX_LANGSYS
76 #define HB_MAX_LANGSYS 2000
77 #endif
78 
79 #ifndef HB_MAX_LANGSYS_FEATURE_COUNT
80 #define HB_MAX_LANGSYS_FEATURE_COUNT 50000
81 #endif
82 
83 #ifndef HB_MAX_FEATURE_INDICES
84 #define HB_MAX_FEATURE_INDICES 1500
85 #endif
86 
87 #ifndef HB_MAX_LOOKUP_VISIT_COUNT
88 #define HB_MAX_LOOKUP_VISIT_COUNT 35000
89 #endif
90 
91 #ifndef HB_MAX_GRAPH_EDGE_COUNT
92 #define HB_MAX_GRAPH_EDGE_COUNT 2048
93 #endif
94 
95 #ifndef HB_VAR_COMPOSITE_MAX_AXES
96 #define HB_VAR_COMPOSITE_MAX_AXES 4096
97 #endif
98 
99 #ifndef HB_GLYF_MAX_POINTS
100 #define HB_GLYF_MAX_POINTS 200000
101 #endif
102 
103 #ifndef HB_CFF_MAX_OPS
104 #define HB_CFF_MAX_OPS 200000
105 #endif
106 
107 #ifndef HB_MAX_COMPOSITE_OPERATIONS_PER_GLYPH
108 #define HB_MAX_COMPOSITE_OPERATIONS_PER_GLYPH 64
109 #endif
110 
111 
112 #endif /* HB_LIMITS_HH */
113