OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 new SkMemoryStream(*headerLen + *dataLen + *trailerLen); | 219 new SkMemoryStream(*headerLen + *dataLen + *trailerLen); |
220 memcpy((char*)result->getAtPos(), src, *headerLen); | 220 memcpy((char*)result->getAtPos(), src, *headerLen); |
221 result->seek(*headerLen); | 221 result->seek(*headerLen); |
222 | 222 |
223 const uint8_t* hexData = src + *headerLen; | 223 const uint8_t* hexData = src + *headerLen; |
224 const uint8_t* trailer = hexData + hexDataLen; | 224 const uint8_t* trailer = hexData + hexDataLen; |
225 size_t outputOffset = 0; | 225 size_t outputOffset = 0; |
226 uint8_t dataByte = 0; // To hush compiler. | 226 uint8_t dataByte = 0; // To hush compiler. |
227 bool highNibble = true; | 227 bool highNibble = true; |
228 for (; hexData < trailer; hexData++) { | 228 for (; hexData < trailer; hexData++) { |
229 char curNibble = hexToBin(*hexData); | 229 int8_t curNibble = hexToBin(*hexData); |
230 if (curNibble < 0) { | 230 if (curNibble < 0) { |
231 continue; | 231 continue; |
232 } | 232 } |
233 if (highNibble) { | 233 if (highNibble) { |
234 dataByte = curNibble << 4; | 234 dataByte = curNibble << 4; |
235 highNibble = false; | 235 highNibble = false; |
236 } else { | 236 } else { |
237 dataByte |= curNibble; | 237 dataByte |= curNibble; |
238 highNibble = true; | 238 highNibble = true; |
239 ((char *)result->getAtPos())[outputOffset++] = dataByte; | 239 ((char *)result->getAtPos())[outputOffset++] = dataByte; |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 | 1408 |
1409 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1409 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
1410 insertInt("FirstChar", firstGlyphID()); | 1410 insertInt("FirstChar", firstGlyphID()); |
1411 insertInt("LastChar", lastGlyphID()); | 1411 insertInt("LastChar", lastGlyphID()); |
1412 insert("Widths", widthArray.get()); | 1412 insert("Widths", widthArray.get()); |
1413 insertName("CIDToGIDMap", "Identity"); | 1413 insertName("CIDToGIDMap", "Identity"); |
1414 | 1414 |
1415 populateToUnicodeTable(NULL); | 1415 populateToUnicodeTable(NULL); |
1416 return true; | 1416 return true; |
1417 } | 1417 } |
OLD | NEW |