OLD | NEW |
---|---|
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 Loading... | |
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 // TODO(ksakamoto): Remove the below function (looks like unused function). | |
Yusuke Sato
2013/04/03 07:40:32
#if 0 does not look good. Please just remove the f
Kunihiko Sakamoto
2013/04/03 08:18:04
Just removed it.
| |
42 #if 0 | |
41 // Converts |op| to a string and returns it. | 43 // Converts |op| to a string and returns it. |
42 const char *Type2CharStringOperatorToString(ots::Type2CharStringOperator op) { | 44 const char *Type2CharStringOperatorToString(ots::Type2CharStringOperator op) { |
43 switch (op) { | 45 switch (op) { |
44 case ots::kHStem: | 46 case ots::kHStem: |
45 return "HStem"; | 47 return "HStem"; |
46 case ots::kVStem: | 48 case ots::kVStem: |
47 return "VStem"; | 49 return "VStem"; |
48 case ots::kVMoveTo: | 50 case ots::kVMoveTo: |
49 return "VMoveTo"; | 51 return "VMoveTo"; |
50 case ots::kRLineTo: | 52 case ots::kRLineTo: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 case ots::kFlex: | 134 case ots::kFlex: |
133 return "Flex"; | 135 return "Flex"; |
134 case ots::kHFlex1: | 136 case ots::kHFlex1: |
135 return "HFlex1"; | 137 return "HFlex1"; |
136 case ots::kFlex1: | 138 case ots::kFlex1: |
137 return "Flex1"; | 139 return "Flex1"; |
138 } | 140 } |
139 | 141 |
140 return "UNKNOWN"; | 142 return "UNKNOWN"; |
141 } | 143 } |
144 #endif | |
142 | 145 |
143 // Read one or more bytes from the |char_string| buffer and stores the number | 146 // 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 | 147 // 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. | 148 // true on |out_is_operator|. Returns true if the function read a number. |
146 bool ReadNextNumberFromType2CharString(ots::Buffer *char_string, | 149 bool ReadNextNumberFromType2CharString(ots::Buffer *char_string, |
147 int32_t *out_number, | 150 int32_t *out_number, |
148 bool *out_is_operator) { | 151 bool *out_is_operator) { |
149 uint8_t v = 0; | 152 uint8_t v = 0; |
150 if (!char_string->ReadU8(&v)) { | 153 if (!char_string->ReadU8(&v)) { |
151 return OTS_FAILURE(); | 154 return OTS_FAILURE(); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 return OTS_FAILURE(); | 883 return OTS_FAILURE(); |
881 } | 884 } |
882 if (!found_endchar) { | 885 if (!found_endchar) { |
883 return OTS_FAILURE(); | 886 return OTS_FAILURE(); |
884 } | 887 } |
885 } | 888 } |
886 return true; | 889 return true; |
887 } | 890 } |
888 | 891 |
889 } // namespace ots | 892 } // namespace ots |
OLD | NEW |