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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 CanonicalFonts().push(newEntry); | 865 CanonicalFonts().push(newEntry); |
866 return font; // Return the reference new SkPDFFont() created. | 866 return font; // Return the reference new SkPDFFont() created. |
867 } | 867 } |
868 | 868 |
869 SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) { | 869 SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) { |
870 return NULL; // Default: no support. | 870 return NULL; // Default: no support. |
871 } | 871 } |
872 | 872 |
873 // static | 873 // static |
874 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() { | 874 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() { |
875 // This initialization is only thread safe with gcc. | 875 SkPDFFont::CanonicalFontsMutex().assertHeld(); |
876 // This initialization is only thread safe with gcc, so hold the mutex. | |
mtklein
2014/06/20 17:40:54
It's not even safe in Chromium. They disable the
hal.canary
2014/06/20 17:49:06
Done.
| |
876 static SkTDArray<FontRec> gCanonicalFonts; | 877 static SkTDArray<FontRec> gCanonicalFonts; |
877 return gCanonicalFonts; | 878 return gCanonicalFonts; |
878 } | 879 } |
879 | 880 |
880 // static | 881 // static |
881 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() { | 882 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() { |
882 // This initialization is only thread safe with gcc, or when | 883 // This initialization is only thread safe with gcc, or when |
883 // POD-style mutex initialization is used. | 884 // POD-style mutex initialization is used. |
884 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex); | 885 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex); |
885 return gCanonicalFontsMutex; | 886 return gCanonicalFontsMutex; |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1475 | 1476 |
1476 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1477 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
1477 insertInt("FirstChar", 1); | 1478 insertInt("FirstChar", 1); |
1478 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); | 1479 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); |
1479 insert("Widths", widthArray.get()); | 1480 insert("Widths", widthArray.get()); |
1480 insertName("CIDToGIDMap", "Identity"); | 1481 insertName("CIDToGIDMap", "Identity"); |
1481 | 1482 |
1482 populateToUnicodeTable(NULL); | 1483 populateToUnicodeTable(NULL); |
1483 return true; | 1484 return true; |
1484 } | 1485 } |
OLD | NEW |