| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 return NULL; // Default: no support. | 885 return NULL; // Default: no support. |
| 886 } | 886 } |
| 887 | 887 |
| 888 // static | 888 // static |
| 889 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() { | 889 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() { |
| 890 SkPDFFont::CanonicalFontsMutex().assertHeld(); | 890 SkPDFFont::CanonicalFontsMutex().assertHeld(); |
| 891 static SkTDArray<FontRec> gCanonicalFonts; | 891 static SkTDArray<FontRec> gCanonicalFonts; |
| 892 return gCanonicalFonts; | 892 return gCanonicalFonts; |
| 893 } | 893 } |
| 894 | 894 |
| 895 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex); |
| 895 // static | 896 // static |
| 896 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() { | 897 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() { |
| 897 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex); | |
| 898 return gCanonicalFontsMutex; | 898 return gCanonicalFontsMutex; |
| 899 } | 899 } |
| 900 | 900 |
| 901 // static | 901 // static |
| 902 bool SkPDFFont::Find(uint32_t fontID, uint16_t glyphID, int* index) { | 902 bool SkPDFFont::Find(uint32_t fontID, uint16_t glyphID, int* index) { |
| 903 // TODO(vandebo): Optimize this, do only one search? | 903 // TODO(vandebo): Optimize this, do only one search? |
| 904 FontRec search(NULL, fontID, glyphID); | 904 FontRec search(NULL, fontID, glyphID); |
| 905 *index = CanonicalFonts().find(search); | 905 *index = CanonicalFonts().find(search); |
| 906 if (*index >= 0) { | 906 if (*index >= 0) { |
| 907 return true; | 907 return true; |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 | 1490 |
| 1491 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1491 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
| 1492 insertInt("FirstChar", 1); | 1492 insertInt("FirstChar", 1); |
| 1493 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); | 1493 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); |
| 1494 insert("Widths", widthArray.get()); | 1494 insert("Widths", widthArray.get()); |
| 1495 insertName("CIDToGIDMap", "Identity"); | 1495 insertName("CIDToGIDMap", "Identity"); |
| 1496 | 1496 |
| 1497 populateToUnicodeTable(NULL); | 1497 populateToUnicodeTable(NULL); |
| 1498 return true; | 1498 return true; |
| 1499 } | 1499 } |
| OLD | NEW |