Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp

Issue 879533003: Remove Mac native font type members from FontPlatformData (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Canvas text metrics test does not need rebaselining after improvement landed, toNSFont in WebSubstringUtil.mm Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/mac/FontCacheMac.mm ('k') | Source/platform/fonts/mac/FontPlatformDataMac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp
diff --git a/Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp b/Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp
deleted file mode 100644
index cf6530a590d1a7e86983e58a63bc589e94c9f092..0000000000000000000000000000000000000000
--- a/Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "platform/fonts/FontCustomPlatformData.h"
-
-#include "platform/SharedBuffer.h"
-#include "platform/fonts/FontPlatformData.h"
-#include "platform/fonts/opentype/OpenTypeSanitizer.h"
-#include "third_party/skia/include/core/SkStream.h"
-#include "third_party/skia/include/core/SkTypeface.h"
-#include "wtf/PassOwnPtr.h"
-
-#include <ApplicationServices/ApplicationServices.h>
-
-namespace blink {
-
-FontCustomPlatformData::FontCustomPlatformData(CGFontRef cgFont, PassRefPtr<SkTypeface> typeface)
- : m_cgFont(AdoptCF, cgFont)
- , m_typeface(typeface)
-{
-}
-
-FontCustomPlatformData::~FontCustomPlatformData()
-{
-}
-
-FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation)
-{
- return FontPlatformData(m_cgFont.get(), m_typeface, size, bold, italic, orientation);
-}
-
-PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer)
-{
- ASSERT_ARG(buffer, buffer);
-
- OpenTypeSanitizer sanitizer(buffer);
- RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize();
- if (!transcodeBuffer)
- return nullptr; // validation failed.
- buffer = transcodeBuffer.get();
-
- RetainPtr<CFDataRef> bufferData(AdoptCF, CFDataCreate(0, reinterpret_cast<const UInt8*>(buffer->data()), buffer->size()));
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
- RetainPtr<CGFontRef> cgFontRef(AdoptCF, CGFontCreateWithDataProvider(dataProvider.get()));
- if (!cgFontRef)
- return nullptr;
-
- RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(new SkMemoryStream(buffer->getAsSkData().get())));
- if (!typeface)
- return nullptr;
-
- return adoptPtr(new FontCustomPlatformData(cgFontRef.leakRef(), typeface.release()));
-}
-
-bool FontCustomPlatformData::supportsFormat(const String& format)
-{
- return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || OpenTypeSanitizer::supportsFormat(format);
-}
-
-} // namespace blink
« no previous file with comments | « Source/platform/fonts/mac/FontCacheMac.mm ('k') | Source/platform/fonts/mac/FontPlatformDataMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698