Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/graphite/src/inc/Error.h
9906 views
1
// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
2
// Copyright 2013, SIL International, All rights reserved.
3
4
#pragma once
5
6
// numbers are explicitly assigned for future proofing
7
8
namespace graphite2
9
{
10
11
class Error
12
{
13
public:
14
Error() : _e(0) {};
15
operator bool() { return (_e != 0); }
16
int error() { return _e; }
17
void error(int e) { _e = e; }
18
bool test(bool pr, int err) { return (_e = pr ? err : 0); }
19
20
private:
21
int _e;
22
};
23
24
enum errcontext {
25
EC_READGLYPHS = 1, // while reading glyphs
26
EC_READSILF = 2, // in Silf table
27
EC_ASILF = 3, // in Silf %d
28
EC_APASS = 4, // in Silf %d, pass %d
29
EC_PASSCCODE = 5, // in pass constraint code for Silf %d, pass %d
30
EC_ARULE = 6, // in Silf %d, pass %d, rule %d
31
EC_ASTARTS = 7, // in Silf %d, pass %d, start state %d
32
EC_ATRANS = 8, // in Silf %d, pass %d, fsm state %d
33
EC_ARULEMAP = 9 // in Silf %d, pass %d, state %d
34
};
35
36
enum error {
37
E_OUTOFMEM = 1, // Out of memory
38
E_NOGLYPHS = 2, // There are no glyphs in the font
39
E_BADUPEM = 3, // The units per em for the font is bad (0)
40
E_BADCMAP = 4, // The font does not contain any useful cmaps
41
E_NOSILF = 5, // Missing Silf table
42
E_TOOOLD = 6, // Silf table version is too old
43
E_BADSIZE = 7, // context object has the wrong structural size
44
// Silf Subtable Errors take a Silf subtable number * 256 in the context
45
E_BADMAXGLYPH = 8, // Silf max glyph id is too high
46
E_BADNUMJUSTS = 9, // Number of Silf justification blocks is too high
47
E_BADENDJUSTS = 10, // Silf justification blocks take too much of the Silf table space
48
E_BADCRITFEATURES = 11, // Critical features section in a Silf table is too big
49
E_BADSCRIPTTAGS = 12, // Silf script tags area is too big
50
E_BADAPSEUDO = 13, // The pseudo glyph attribute number is too high
51
E_BADABREAK = 14, // The linebreak glyph attribute number is too high
52
E_BADABIDI = 15, // The bidi glyph attribute number is too high
53
E_BADAMIRROR = 16, // The mirrored glyph attribute number is too high
54
E_BADNUMPASSES = 17, // The number of passes is > 128
55
E_BADPASSESSTART = 18, // The Silf table is too small to hold any passes
56
E_BADPASSBOUND = 19, // The positioning pass number is too low or the substitution pass number is too high
57
E_BADPPASS = 20, // The positioning pass number is too high
58
E_BADSPASS = 21, // the substitution pass number is too high
59
E_BADJPASSBOUND = 22, // the justification pass must be higher than the positioning pass
60
E_BADJPASS = 23, // the justification pass is too high
61
E_BADALIG = 24, // the number of initial ligature component glyph attributes is too high
62
E_BADBPASS = 25, // the bidi pass number is specified and is either too high or too low
63
E_BADNUMPSEUDO = 26, // The number of pseudo glyphs is too high
64
E_BADCLASSSIZE = 27, // The size of the classes block is bad
65
E_TOOMANYLINEAR = 28, // The number of linear classes in the silf table is too high
66
E_CLASSESTOOBIG = 29, // There are too many classes for the space allocated in the Silf subtable
67
E_MISALIGNEDCLASSES = 30, // The class offsets in the class table don't line up with the number of classes
68
E_HIGHCLASSOFFSET = 31, // The class offsets point out of the class table
69
E_BADCLASSOFFSET = 32, // A class offset is less than one following it
70
E_BADCLASSLOOKUPINFO = 33, // The search header info for a non-linear class has wrong values in it
71
// Pass subtable errors. Context has pass number * 65536
72
E_BADPASSSTART = 34, // The start offset for a particular pass is bad
73
E_BADPASSEND = 35, // The end offset for a particular pass is bad
74
E_BADPASSLENGTH = 36, // The length of the pass is too small
75
E_BADNUMTRANS = 37, // The number of transition states in the fsm is bad
76
E_BADNUMSUCCESS = 38, // The number of success states in the fsm is bad
77
E_BADNUMSTATES = 39, // The number of states in the fsm is bad
78
E_NORANGES = 40, // There are no columns in the fsm
79
E_BADRULEMAPLEN = 41, // The size of the success state to rule mapping is bad
80
E_BADCTXTLENBOUNDS = 42, // The precontext maximum is greater than its minimum
81
E_BADCTXTLENS = 43, // The lists of rule lengths or pre context lengths is bad
82
E_BADPASSCCODEPTR = 44, // The pass constraint code position does not align with where the forward reference says it should be
83
E_BADRULECCODEPTR = 45, // The rule constraint code position does not align with where the forward reference says it should be
84
E_BADCCODELEN = 46, // Bad rule/pass constraint code length
85
E_BADACTIONCODEPTR = 47, // The action code position does not align with where the forward reference says it should be
86
E_MUTABLECCODE = 48, // Constraint code edits slots. It shouldn't.
87
E_BADSTATE = 49, // Bad state transition referencing an illegal state
88
E_BADRULEMAPPING = 50, // The structure of the rule mapping is bad
89
E_BADRANGE = 51, // Bad column range structure including a glyph in more than one column
90
E_BADRULENUM = 52, // A reference to a rule is out of range (too high)
91
E_BADACOLLISION = 53, // Bad Silf table collision attribute number (too high)
92
E_BADEMPTYPASS = 54, // Can't have empty passes (no rules) except for collision passes
93
E_BADSILFVERSION = 55, // The Silf table has a bad version (probably too high)
94
E_BADCOLLISIONPASS = 56, // Collision flags set on a non positioning pass
95
E_BADNUMCOLUMNS = 57, // Arbitrarily limit number of columns in fsm
96
// Code errors
97
E_CODEFAILURE = 60, // Base code error. The following subcodes must align with Machine::Code::status_t in Code.h
98
E_CODEALLOC = 61, // Out of memory
99
E_INVALIDOPCODE = 62, // Invalid op code
100
E_UNIMPOPCODE = 63, // Unimplemented op code encountered
101
E_OUTOFRANGECODE = 64, // Code argument out of range
102
E_BADJUMPCODE = 65, // Code jumps past end of op codes
103
E_CODEBADARGS = 66, // Code arguments exhausted
104
E_CODENORETURN = 67, // Missing return type op code at end of code
105
E_CODENESTEDCTXT = 68, // Nested context encountered in code
106
// Compression errors
107
E_BADSCHEME = 69,
108
E_SHRINKERFAILED = 70,
109
};
110
111
}
112
113