| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!transcodeBuffer) | 56 if (!transcodeBuffer) |
| 57 return nullptr; // validation failed. | 57 return nullptr; // validation failed. |
| 58 buffer = transcodeBuffer.get(); | 58 buffer = transcodeBuffer.get(); |
| 59 | 59 |
| 60 RetainPtr<CFDataRef> bufferData(AdoptCF, CFDataCreate(0, reinterpret_cast<co
nst UInt8*>(buffer->data()), buffer->size())); | 60 RetainPtr<CFDataRef> bufferData(AdoptCF, CFDataCreate(0, reinterpret_cast<co
nst UInt8*>(buffer->data()), buffer->size())); |
| 61 RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithC
FData(bufferData.get())); | 61 RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithC
FData(bufferData.get())); |
| 62 RetainPtr<CGFontRef> cgFontRef(AdoptCF, CGFontCreateWithDataProvider(dataPro
vider.get())); | 62 RetainPtr<CGFontRef> cgFontRef(AdoptCF, CGFontCreateWithDataProvider(dataPro
vider.get())); |
| 63 if (!cgFontRef) | 63 if (!cgFontRef) |
| 64 return nullptr; | 64 return nullptr; |
| 65 | 65 |
| 66 SkAutoTUnref<SkMemoryStream> stream(new SkMemoryStream(buffer->getAsSkData()
.get())); | 66 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(new SkMe
moryStream(buffer->getAsSkData().get()))); |
| 67 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.g
et())); | |
| 68 if (!typeface) | 67 if (!typeface) |
| 69 return nullptr; | 68 return nullptr; |
| 70 | 69 |
| 71 return adoptPtr(new FontCustomPlatformData(cgFontRef.leakRef(), typeface.rel
ease())); | 70 return adoptPtr(new FontCustomPlatformData(cgFontRef.leakRef(), typeface.rel
ease())); |
| 72 } | 71 } |
| 73 | 72 |
| 74 bool FontCustomPlatformData::supportsFormat(const String& format) | 73 bool FontCustomPlatformData::supportsFormat(const String& format) |
| 75 { | 74 { |
| 76 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); | 75 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace blink | 78 } // namespace blink |
| OLD | NEW |