| 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 "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkGlyphCache.h" | 9 #include "SkGlyphCache.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 if (type == SkAdvancedTypefaceMetrics::kType1CID_Font) { | 419 if (type == SkAdvancedTypefaceMetrics::kType1CID_Font) { |
| 420 newCIDFont->insertName("Subtype", "CIDFontType0"); | 420 newCIDFont->insertName("Subtype", "CIDFontType0"); |
| 421 } else if (type == SkAdvancedTypefaceMetrics::kTrueType_Font) { | 421 } else if (type == SkAdvancedTypefaceMetrics::kTrueType_Font) { |
| 422 newCIDFont->insertName("Subtype", "CIDFontType2"); | 422 newCIDFont->insertName("Subtype", "CIDFontType2"); |
| 423 newCIDFont->insertName("CIDToGIDMap", "Identity"); | 423 newCIDFont->insertName("CIDToGIDMap", "Identity"); |
| 424 } else { | 424 } else { |
| 425 SkASSERT(false); | 425 SkASSERT(false); |
| 426 } | 426 } |
| 427 | 427 |
| 428 auto sysInfo = sk_make_sp<SkPDFDict>(); | 428 auto sysInfo = sk_make_sp<SkPDFDict>(); |
| 429 sysInfo->insertString("Registry", "Skia"); | 429 sysInfo->insertString("Registry", "Adobe"); |
| 430 // TODO: Registry+Ordering should be globally unique! | 430 sysInfo->insertString("Ordering", "Identity"); |
| 431 sysInfo->insertString("Ordering", "SkiaOrdering"); | |
| 432 sysInfo->insertInt("Supplement", 0); | 431 sysInfo->insertInt("Supplement", 0); |
| 433 newCIDFont->insertObject("CIDSystemInfo", std::move(sysInfo)); | 432 newCIDFont->insertObject("CIDSystemInfo", std::move(sysInfo)); |
| 434 | 433 |
| 435 uint16_t emSize = metrics.fEmSize; | 434 uint16_t emSize = metrics.fEmSize; |
| 436 int16_t defaultWidth = 0; | 435 int16_t defaultWidth = 0; |
| 437 { | 436 { |
| 438 SkAutoGlyphCache glyphCache = vector_cache(face); | 437 SkAutoGlyphCache glyphCache = vector_cache(face); |
| 439 sk_sp<SkPDFArray> widths = SkPDFMakeCIDGlyphWidthsArray( | 438 sk_sp<SkPDFArray> widths = SkPDFMakeCIDGlyphWidthsArray( |
| 440 glyphCache.get(), &this->glyphUsage(), emSize, &defaultWidth); | 439 glyphCache.get(), &this->glyphUsage(), emSize, &defaultWidth); |
| 441 if (widths && widths->size() > 0) { | 440 if (widths && widths->size() > 0) { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 | 726 |
| 728 bool SkPDFFont::CanEmbedTypeface(SkTypeface* typeface, SkPDFCanon* canon) { | 727 bool SkPDFFont::CanEmbedTypeface(SkTypeface* typeface, SkPDFCanon* canon) { |
| 729 const SkAdvancedTypefaceMetrics* metrics = SkPDFFont::GetMetrics(typeface, c
anon); | 728 const SkAdvancedTypefaceMetrics* metrics = SkPDFFont::GetMetrics(typeface, c
anon); |
| 730 return metrics && can_embed(*metrics); | 729 return metrics && can_embed(*metrics); |
| 731 } | 730 } |
| 732 | 731 |
| 733 void SkPDFFont::drop() { | 732 void SkPDFFont::drop() { |
| 734 fTypeface = nullptr; | 733 fTypeface = nullptr; |
| 735 this->SkPDFDict::drop(); | 734 this->SkPDFDict::drop(); |
| 736 } | 735 } |
| OLD | NEW |