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

Side by Side Diff: src/cff_type2_charstring.cc

Issue 13449003: [OTS] Make standalone tools compile on Mac (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/idempotent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A parser for the Type 2 Charstring Format. 5 // A parser for the Type 2 Charstring Format.
6 // http://www.adobe.com/devnet/font/pdfs/5177.Type2.pdf 6 // http://www.adobe.com/devnet/font/pdfs/5177.Type2.pdf
7 7
8 #include "cff_type2_charstring.h" 8 #include "cff_type2_charstring.h"
9 9
10 #include <climits> 10 #include <climits>
(...skipping 20 matching lines...) Expand all
31 bool ExecuteType2CharString(size_t call_depth, 31 bool ExecuteType2CharString(size_t call_depth,
32 const ots::CFFIndex& global_subrs_index, 32 const ots::CFFIndex& global_subrs_index,
33 const ots::CFFIndex& local_subrs_index, 33 const ots::CFFIndex& local_subrs_index,
34 ots::Buffer *cff_table, 34 ots::Buffer *cff_table,
35 ots::Buffer *char_string, 35 ots::Buffer *char_string,
36 std::stack<int32_t> *argument_stack, 36 std::stack<int32_t> *argument_stack,
37 bool *out_found_endchar, 37 bool *out_found_endchar,
38 bool *out_found_width, 38 bool *out_found_width,
39 size_t *in_out_num_stems); 39 size_t *in_out_num_stems);
40 40
41 // Converts |op| to a string and returns it.
42 const char *Type2CharStringOperatorToString(ots::Type2CharStringOperator op) {
43 switch (op) {
44 case ots::kHStem:
45 return "HStem";
46 case ots::kVStem:
47 return "VStem";
48 case ots::kVMoveTo:
49 return "VMoveTo";
50 case ots::kRLineTo:
51 return "RLineTo";
52 case ots::kHLineTo:
53 return "HLineTo";
54 case ots::kVLineTo:
55 return "VLineTo";
56 case ots::kRRCurveTo:
57 return "RRCurveTo";
58 case ots::kCallSubr:
59 return "CallSubr";
60 case ots::kReturn:
61 return "Return";
62 case ots::kEndChar:
63 return "EndChar";
64 case ots::kHStemHm:
65 return "HStemHm";
66 case ots::kHintMask:
67 return "HintMask";
68 case ots::kCntrMask:
69 return "CntrMask";
70 case ots::kRMoveTo:
71 return "RMoveTo";
72 case ots::kHMoveTo:
73 return "HMoveTo";
74 case ots::kVStemHm:
75 return "VStemHm";
76 case ots::kRCurveLine:
77 return "RCurveLine";
78 case ots::kRLineCurve:
79 return "RLineCurve";
80 case ots::kVVCurveTo:
81 return "VVCurveTo";
82 case ots::kHHCurveTo:
83 return "HHCurveTo";
84 case ots::kCallGSubr:
85 return "CallGSubr";
86 case ots::kVHCurveTo:
87 return "VHCurveTo";
88 case ots::kHVCurveTo:
89 return "HVCurveTo";
90 case ots::kAnd:
91 return "And";
92 case ots::kOr:
93 return "Or";
94 case ots::kNot:
95 return "Not";
96 case ots::kAbs:
97 return "Abs";
98 case ots::kAdd:
99 return "Add";
100 case ots::kSub:
101 return "Sub";
102 case ots::kDiv:
103 return "Div";
104 case ots::kNeg:
105 return "Neg";
106 case ots::kEq:
107 return "Eq";
108 case ots::kDrop:
109 return "Drop";
110 case ots::kPut:
111 return "Put";
112 case ots::kGet:
113 return "Get";
114 case ots::kIfElse:
115 return "IfElse";
116 case ots::kRandom:
117 return "Random";
118 case ots::kMul:
119 return "Mul";
120 case ots::kSqrt:
121 return "Sqrt";
122 case ots::kDup:
123 return "Dup";
124 case ots::kExch:
125 return "Exch";
126 case ots::kIndex:
127 return "Index";
128 case ots::kRoll:
129 return "Roll";
130 case ots::kHFlex:
131 return "HFlex";
132 case ots::kFlex:
133 return "Flex";
134 case ots::kHFlex1:
135 return "HFlex1";
136 case ots::kFlex1:
137 return "Flex1";
138 }
139
140 return "UNKNOWN";
141 }
142
143 // Read one or more bytes from the |char_string| buffer and stores the number 41 // Read one or more bytes from the |char_string| buffer and stores the number
144 // read on |out_number|. If the number read is an operator (ex 'vstem'), sets 42 // read on |out_number|. If the number read is an operator (ex 'vstem'), sets
145 // true on |out_is_operator|. Returns true if the function read a number. 43 // true on |out_is_operator|. Returns true if the function read a number.
146 bool ReadNextNumberFromType2CharString(ots::Buffer *char_string, 44 bool ReadNextNumberFromType2CharString(ots::Buffer *char_string,
147 int32_t *out_number, 45 int32_t *out_number,
148 bool *out_is_operator) { 46 bool *out_is_operator) {
149 uint8_t v = 0; 47 uint8_t v = 0;
150 if (!char_string->ReadU8(&v)) { 48 if (!char_string->ReadU8(&v)) {
151 return OTS_FAILURE(); 49 return OTS_FAILURE();
152 } 50 }
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 return OTS_FAILURE(); 778 return OTS_FAILURE();
881 } 779 }
882 if (!found_endchar) { 780 if (!found_endchar) {
883 return OTS_FAILURE(); 781 return OTS_FAILURE();
884 } 782 }
885 } 783 }
886 return true; 784 return true;
887 } 785 }
888 786
889 } // namespace ots 787 } // namespace ots
OLDNEW
« no previous file with comments | « no previous file | test/idempotent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698