Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Side by Side Diff: third_party/ots/src/cff_type2_charstring.h

Issue 775893002: Updating OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating with 4800 warning fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/ots/src/cff.cc ('k') | third_party/ots/src/cff_type2_charstring.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef OTS_CFF_TYPE2_CHARSTRING_H_
6 #define OTS_CFF_TYPE2_CHARSTRING_H_
7
8 #include "cff.h"
9 #include "ots.h"
10
11 #include <map>
12 #include <vector>
13
14 namespace ots {
15
16 // Validates all charstrings in |char_strings_index|. Charstring is a small
17 // language for font hinting defined in Adobe Technical Note #5177.
18 // http://www.adobe.com/devnet/font/pdfs/5177.Type2.pdf
19 //
20 // The validation will fail if one of the following conditions is met:
21 // 1. The code uses more than 48 values of argument stack.
22 // 2. The code uses deeply nested subroutine calls (more than 10 levels.)
23 // 3. The code passes invalid number of operands to an operator.
24 // 4. The code calls an undefined global or local subroutine.
25 // 5. The code uses one of the following operators that are unlikely used in
26 // an ordinary fonts, and could be dangerous: random, put, get, index, roll.
27 //
28 // Arguments:
29 // global_subrs_index: Global subroutines which could be called by a charstring
30 // in |char_strings_index|.
31 // fd_select: A map from glyph # to font #.
32 // local_subrs_per_font: A list of Local Subrs associated with FDArrays. Can be
33 // empty.
34 // local_subrs: A Local Subrs associated with Top DICT. Can be NULL.
35 // cff_table: A buffer which contains actual byte code of charstring, global
36 // subroutines and local subroutines.
37 bool ValidateType2CharStringIndex(
38 OpenTypeFile *file,
39 const CFFIndex &char_strings_index,
40 const CFFIndex &global_subrs_index,
41 const std::map<uint16_t, uint8_t> &fd_select,
42 const std::vector<CFFIndex *> &local_subrs_per_font,
43 const CFFIndex *local_subrs,
44 Buffer *cff_table);
45
46 // The list of Operators. See Appendix. A in Adobe Technical Note #5177.
47 enum Type2CharStringOperator {
48 kHStem = 1,
49 kVStem = 3,
50 kVMoveTo = 4,
51 kRLineTo = 5,
52 kHLineTo = 6,
53 kVLineTo = 7,
54 kRRCurveTo = 8,
55 kCallSubr = 10,
56 kReturn = 11,
57 kEndChar = 14,
58 kHStemHm = 18,
59 kHintMask = 19,
60 kCntrMask = 20,
61 kRMoveTo = 21,
62 kHMoveTo = 22,
63 kVStemHm = 23,
64 kRCurveLine = 24,
65 kRLineCurve = 25,
66 kVVCurveTo = 26,
67 kHHCurveTo = 27,
68 kCallGSubr = 29,
69 kVHCurveTo = 30,
70 kHVCurveTo = 31,
71 kDotSection = 12 << 8,
72 kAnd = (12 << 8) + 3,
73 kOr = (12 << 8) + 4,
74 kNot = (12 << 8) + 5,
75 kAbs = (12 << 8) + 9,
76 kAdd = (12 << 8) + 10,
77 kSub = (12 << 8) + 11,
78 kDiv = (12 << 8) + 12,
79 kNeg = (12 << 8) + 14,
80 kEq = (12 << 8) + 15,
81 kDrop = (12 << 8) + 18,
82 kPut = (12 << 8) + 20,
83 kGet = (12 << 8) + 21,
84 kIfElse = (12 << 8) + 22,
85 kRandom = (12 << 8) + 23,
86 kMul = (12 << 8) + 24,
87 kSqrt = (12 << 8) + 26,
88 kDup = (12 << 8) + 27,
89 kExch = (12 << 8) + 28,
90 kIndex = (12 << 8) + 29,
91 kRoll = (12 << 8) + 30,
92 kHFlex = (12 << 8) + 34,
93 kFlex = (12 << 8) + 35,
94 kHFlex1 = (12 << 8) + 36,
95 kFlex1 = (12 << 8) + 37,
96 // Operators that are undocumented, such as 'blend', will be rejected.
97 };
98
99 } // namespace ots
100
101 #endif // OTS_CFF_TYPE2_CHARSTRING_H_
OLDNEW
« no previous file with comments | « third_party/ots/src/cff.cc ('k') | third_party/ots/src/cff_type2_charstring.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698