summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp')
-rw-r--r--WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp180
1 files changed, 0 insertions, 180 deletions
diff --git a/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp b/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
deleted file mode 100644
index 27a021e..0000000
--- a/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2007-2009 Torch Mobile, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include "config.h"
-#include "SimpleFontData.h"
-
-#include "FloatRect.h"
-#include "Font.h"
-#include "FontCache.h"
-#include "FontDescription.h"
-#include <wtf/MathExtras.h>
-#include <mlang.h>
-#include <tchar.h>
-
-namespace WebCore {
-
-extern HDC g_screenDC;
-
-void SimpleFontData::platformInit()
-{
- if (!m_platformData.isValid())
- return;
-
- const TEXTMETRIC& tm = m_platformData.metrics();
- m_isSystemFont = m_platformData.isSystemFont();
-
- m_ascent = (tm.tmAscent * m_platformData.size() + 36) / 72;
- m_descent = (tm.tmDescent * m_platformData.size() + 36) / 72;
- m_lineGap = (tm.tmExternalLeading * m_platformData.size() + 36) / 72;
- m_lineSpacing = m_ascent + m_descent + m_lineGap;
- m_xHeight = m_ascent * 0.56f;
-}
-
-void SimpleFontData::platformDestroy()
-{
-}
-
-SimpleFontData* SimpleFontData::scaledFontData(const FontDescription& fontDescription, float scaleFactor) const
-{
- FontDescription fontDesc(fontDescription);
- fontDesc.setComputedSize(lroundf(scaleFactor * fontDesc.computedSize()));
- fontDesc.setSpecifiedSize(lroundf(scaleFactor * fontDesc.specifiedSize()));
- fontDesc.setKeywordSize(lroundf(scaleFactor * fontDesc.keywordSize()));
- FontPlatformData* result = fontCache()->getCachedFontPlatformData(fontDesc, m_platformData.family());
- return result ? new SimpleFontData(*result) : 0;
-}
-
-SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
-{
- if (!m_derivedFontData)
- m_derivedFontData = DerivedFontData::create(isCustomFont());
- if (!m_derivedFontData->smallCaps)
- m_derivedFontData->smallCaps = scaledFontData(fontDescription, .7);
-
- return m_derivedFontData->smallCaps.get();
-}
-
-SimpleFontData* SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const
-{
- if (!m_derivedFontData)
- m_derivedFontData = DerivedFontData::create(isCustomFont());
- if (!m_derivedFontData->emphasisMark)
- m_derivedFontData->emphasisMark = scaledFontData(fontDescription, .5);
-
- return m_derivedFontData->emphasisMark.get();
-}
-
-DWORD getKnownFontCodePages(const wchar_t* family);
-
-bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
-{
- if (m_platformData.isDisabled())
- return true;
-
- // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC
- // merely by testing code page intersection. This seems suspect though. Can't a font only partially
- // cover a given code page?
-
- // FIXME: in the case that we failed to get the interface, still use the font.
-#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
- IMLangFontLink2* langFontLink = fontCache()->getFontLinkInterface();
-#else
- IMLangFontLink* langFontLink = fontCache()->getFontLinkInterface();
-#endif
- if (!langFontLink)
- return true;
-
- DWORD fontCodePages = m_platformData.codePages();
- if (!fontCodePages)
- return false;
-
- DWORD acpCodePages = 0;
- langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
-
- DWORD actualCodePages;
- long numCharactersProcessed;
- while (length) {
- langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &numCharactersProcessed);
- if (actualCodePages && !(actualCodePages & fontCodePages))
- return false;
-
- length -= numCharactersProcessed;
- characters += numCharactersProcessed;
- }
-
- return true;
-}
-
-void SimpleFontData::determinePitch()
-{
- if (!m_platformData.isValid())
- return;
-
- const TEXTMETRIC& tm = m_platformData.metrics();
-
- // Yes, this looks backwards, but the fixed pitch bit is actually set if the font
- // is *not* fixed pitch. Unbelievable but true.
- m_treatAsFixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
-}
-
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
-{
- return FloatRect();
-}
-
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
-{
- if (m_platformData.isDisabled())
- return 0;
-
- HGDIOBJ hOldFont = SelectObject(g_screenDC, m_platformData.hfont());
-
- SIZE fontSize;
- wchar_t c = glyph;
- GetTextExtentPoint32(g_screenDC, &c, 1, &fontSize);
-
- SelectObject(g_screenDC, hOldFont);
-
- return (float)fontSize.cx * (float)m_platformData.size() / 72.f;
-}
-
-
-void SimpleFontData::platformCharWidthInit()
-{
- if (!m_platformData.isValid())
- return;
-
- const TEXTMETRIC& tm = m_platformData.metrics();
- m_avgCharWidth = (tm.tmAveCharWidth * m_platformData.size() + 36) / 72;
- m_maxCharWidth = (tm.tmMaxCharWidth * m_platformData.size() + 36) / 72;
-}
-
-} // namespace WebCore