2 * This file is part of the internal font implementation. It should not be included by anyone other than
3 * FontMac.cpp, FontWin.cpp and Font.cpp.
5 * Copyright (C) 2006, 2007, 2008 Apple Inc.
6 * Copyright (C) 2008 Brent Fulgham
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
26 #include "FontPlatformData.h"
28 #include "PlatformString.h"
29 #include <wtf/HashMap.h>
30 #include <wtf/RetainPtr.h>
31 #include <wtf/Vector.h>
32 #include <wtf/text/StringHash.h>
38 FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI)
39 : m_font(RefCountedGDIHandle<HFONT>::create(font))
41 , m_orientation(Horizontal)
42 , m_textOrientation(TextOrientationVerticalRight)
43 , m_widthVariant(RegularWidth)
49 , m_isColorBitmapFont(false)
50 , m_syntheticBold(bold)
51 , m_syntheticOblique(oblique)
57 SelectObject(hdc, font);
58 UINT bufferSize = GetOutlineTextMetrics(hdc, 0, NULL);
60 ASSERT_WITH_MESSAGE(bufferSize, "Bitmap fonts not supported with CoreGraphics.");
63 OUTLINETEXTMETRICW* metrics = (OUTLINETEXTMETRICW*)malloc(bufferSize);
65 GetOutlineTextMetricsW(hdc, bufferSize, metrics);
66 WCHAR* faceName = (WCHAR*)((uintptr_t)metrics + (uintptr_t)metrics->otmpFaceName);
68 platformDataInit(font, size, hdc, faceName);
78 String FontPlatformData::description() const