| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 syntheticItalic = false; | 79 syntheticItalic = false; |
| 80 return FontPlatformData(typeface.release(), "", size, syntheticBold,
syntheticItalic, orientation); | 80 return FontPlatformData(typeface.release(), "", size, syntheticBold,
syntheticItalic, orientation); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isB
old(), italic && !m_typeface->isItalic(), orientation); | 84 return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isB
old(), italic && !m_typeface->isItalic(), orientation); |
| 85 } | 85 } |
| 86 | 86 |
| 87 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer*
buffer, String& otsParseMessage) | 87 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer*
buffer, String& otsParseMessage) |
| 88 { | 88 { |
| 89 ASSERT_ARG(buffer, buffer); | 89 DCHECK(buffer); |
| 90 | 90 |
| 91 OpenTypeSanitizer sanitizer(buffer); | 91 OpenTypeSanitizer sanitizer(buffer); |
| 92 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); | 92 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); |
| 93 | 93 |
| 94 if (!transcodeBuffer) { | 94 if (!transcodeBuffer) { |
| 95 otsParseMessage = sanitizer.getErrorString(); | 95 otsParseMessage = sanitizer.getErrorString(); |
| 96 return nullptr; // validation failed. | 96 return nullptr; // validation failed. |
| 97 } | 97 } |
| 98 buffer = transcodeBuffer.get(); | 98 buffer = transcodeBuffer.get(); |
| 99 | 99 |
| 100 SkMemoryStream* stream = new SkMemoryStream(buffer->getAsSkData().get()); | 100 SkMemoryStream* stream = new SkMemoryStream(buffer->getAsSkData().get()); |
| 101 #if OS(WIN) | 101 #if OS(WIN) |
| 102 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()
->createFromStream(stream)); | 102 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()
->createFromStream(stream)); |
| 103 #else | 103 #else |
| 104 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream))
; | 104 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream))
; |
| 105 #endif | 105 #endif |
| 106 if (!typeface) | 106 if (!typeface) |
| 107 return nullptr; | 107 return nullptr; |
| 108 | 108 |
| 109 return adoptPtr(new FontCustomPlatformData(typeface.release())); | 109 return adoptPtr(new FontCustomPlatformData(typeface.release())); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool FontCustomPlatformData::supportsFormat(const String& format) | 112 bool FontCustomPlatformData::supportsFormat(const String& format) |
| 113 { | 113 { |
| 114 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); | 114 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace blink | 117 } // namespace blink |
| OLD | NEW |