| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Computer, Inc. | 2 * Copyright (C) 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. | 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. |
| 4 * Copyright (C) 2010 Company 100, Inc. | 4 * Copyright (C) 2010 Company 100, Inc. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 { | 86 { |
| 87 ASSERT_ARG(buffer, buffer); | 87 ASSERT_ARG(buffer, buffer); |
| 88 | 88 |
| 89 OpenTypeSanitizer sanitizer(buffer); | 89 OpenTypeSanitizer sanitizer(buffer); |
| 90 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); | 90 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); |
| 91 if (!transcodeBuffer) | 91 if (!transcodeBuffer) |
| 92 return nullptr; // validation failed. | 92 return nullptr; // validation failed. |
| 93 buffer = transcodeBuffer.get(); | 93 buffer = transcodeBuffer.get(); |
| 94 | 94 |
| 95 RefPtr<SkMemoryStream> stream = adoptRef(new SkMemoryStream(buffer->getAsSkD
ata().get())); | 95 RefPtr<SkMemoryStream> stream = adoptRef(new SkMemoryStream(buffer->getAsSkD
ata().get())); |
| 96 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) | 96 #if OS(WIN) |
| 97 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()
->createFromStream(stream.get())); | 97 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()
->createFromStream(stream.get())); |
| 98 #else | 98 #else |
| 99 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.g
et())); | 99 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.g
et())); |
| 100 #endif | 100 #endif |
| 101 if (!typeface) | 101 if (!typeface) |
| 102 return nullptr; | 102 return nullptr; |
| 103 | 103 |
| 104 return adoptPtr(new FontCustomPlatformData(typeface.release())); | 104 return adoptPtr(new FontCustomPlatformData(typeface.release())); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool FontCustomPlatformData::supportsFormat(const String& format) | 107 bool FontCustomPlatformData::supportsFormat(const String& format) |
| 108 { | 108 { |
| 109 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); | 109 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } | 112 } |
| OLD | NEW |