| 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 fDescriptor->insert("FontBBox", makeFontBBox(fFontInfo->fBBox, | 1020 fDescriptor->insert("FontBBox", makeFontBBox(fFontInfo->fBBox, |
| 1021 fFontInfo->fEmSize))->unref(); | 1021 fFontInfo->fEmSize))->unref(); |
| 1022 | 1022 |
| 1023 if (defaultWidth > 0) { | 1023 if (defaultWidth > 0) { |
| 1024 fDescriptor->insertScalar("MissingWidth", | 1024 fDescriptor->insertScalar("MissingWidth", |
| 1025 scaleFromFontUnits(defaultWidth, emSize)); | 1025 scaleFromFontUnits(defaultWidth, emSize)); |
| 1026 } | 1026 } |
| 1027 return true; | 1027 return true; |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 void SkPDFFont::adjustGlyphRangeForSingleByteEncoding(int16_t glyphID) { | 1030 void SkPDFFont::adjustGlyphRangeForSingleByteEncoding(uint16_t glyphID) { |
| 1031 // Single byte glyph encoding supports a max of 255 glyphs. | 1031 // Single byte glyph encoding supports a max of 255 glyphs. |
| 1032 fFirstGlyphID = glyphID - (glyphID - 1) % 255; | 1032 fFirstGlyphID = glyphID - (glyphID - 1) % 255; |
| 1033 if (fLastGlyphID > fFirstGlyphID + 255 - 1) { | 1033 if (fLastGlyphID > fFirstGlyphID + 255 - 1) { |
| 1034 fLastGlyphID = fFirstGlyphID + 255 - 1; | 1034 fLastGlyphID = fFirstGlyphID + 255 - 1; |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 bool SkPDFFont::FontRec::operator==(const SkPDFFont::FontRec& b) const { | 1038 bool SkPDFFont::FontRec::operator==(const SkPDFFont::FontRec& b) const { |
| 1039 if (fFontID != b.fFontID) { | 1039 if (fFontID != b.fFontID) { |
| 1040 return false; | 1040 return false; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 | 1417 |
| 1418 SkPDFType3Font::SkPDFType3Font(const SkAdvancedTypefaceMetrics* info, | 1418 SkPDFType3Font::SkPDFType3Font(const SkAdvancedTypefaceMetrics* info, |
| 1419 SkTypeface* typeface, | 1419 SkTypeface* typeface, |
| 1420 uint16_t glyphID) | 1420 uint16_t glyphID) |
| 1421 : SkPDFFont(info, typeface, NULL) { | 1421 : SkPDFFont(info, typeface, NULL) { |
| 1422 populate(glyphID); | 1422 populate(glyphID); |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 SkPDFType3Font::~SkPDFType3Font() {} | 1425 SkPDFType3Font::~SkPDFType3Font() {} |
| 1426 | 1426 |
| 1427 bool SkPDFType3Font::populate(int16_t glyphID) { | 1427 bool SkPDFType3Font::populate(uint16_t glyphID) { |
| 1428 SkPaint paint; | 1428 SkPaint paint; |
| 1429 paint.setTypeface(typeface()); | 1429 paint.setTypeface(typeface()); |
| 1430 paint.setTextSize(1000); | 1430 paint.setTextSize(1000); |
| 1431 SkAutoGlyphCache autoCache(paint, NULL, NULL); | 1431 SkAutoGlyphCache autoCache(paint, NULL, NULL); |
| 1432 SkGlyphCache* cache = autoCache.getCache(); | 1432 SkGlyphCache* cache = autoCache.getCache(); |
| 1433 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up. | 1433 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up. |
| 1434 if (lastGlyphID() == 0) { | 1434 if (lastGlyphID() == 0) { |
| 1435 setLastGlyphID(cache->getGlyphCount() - 1); | 1435 setLastGlyphID(cache->getGlyphCount() - 1); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 | 1489 |
| 1490 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1490 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
| 1491 insertInt("FirstChar", 1); | 1491 insertInt("FirstChar", 1); |
| 1492 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); | 1492 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); |
| 1493 insert("Widths", widthArray.get()); | 1493 insert("Widths", widthArray.get()); |
| 1494 insertName("CIDToGIDMap", "Identity"); | 1494 insertName("CIDToGIDMap", "Identity"); |
| 1495 | 1495 |
| 1496 populateToUnicodeTable(NULL); | 1496 populateToUnicodeTable(NULL); |
| 1497 return true; | 1497 return true; |
| 1498 } | 1498 } |
| OLD | NEW |