1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "config.h" 6 #include "core/css/BinaryDataFontFaceSource.h" 7 8 #include "platform/SharedBuffer.h" 9 #include "platform/fonts/FontCustomPlatformData.h" 10 #include "platform/fonts/FontDescription.h" 11 #include "platform/fonts/SimpleFontData.h" 12 13 namespace WebCore { 14 15 BinaryDataFontFaceSource::BinaryDataFontFaceSource(SharedBuffer* data) 16 : m_customPlatformData(FontCustomPlatformData::create(data)) 17 { 18 } 19 20 BinaryDataFontFaceSource::~BinaryDataFontFaceSource() 21 { 22 } 23 24 bool BinaryDataFontFaceSource::isValid() const 25 { 26 return m_customPlatformData; 27 } 28 29 PassRefPtr<SimpleFontData> BinaryDataFontFaceSource::createFontData(const FontDescription& fontDescription) 30 { 31 return SimpleFontData::create( 32 m_customPlatformData->fontPlatformData(fontDescription.effectiveFontSize(), 33 fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic(), 34 fontDescription.orientation(), fontDescription.widthVariant()), CustomFontData::create()); 35 } 36 37 } // namespace WebCore 38