提交 ac4f0beb 编写于 作者: C Chinmay Garde

sky/engine updates for iOS targets

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1163323003.
上级 b3949716
......@@ -163,7 +163,7 @@ void Logger_PrintString(Dart_NativeArguments args) {
String message(chars, length);
// TODO(dart): Hook up to developer console (if/when that's a thing).
#if OS(ANDROID)
#if OS(ANDROID) || OS(IOS)
LOG(INFO) << "CONSOLE: " << message.utf8().data();
#else
printf("CONSOLE: %s\n", message.utf8().data());
......
......@@ -53,6 +53,16 @@
/* Always OS(POSIX) */
#define WTF_OS_POSIX 1
#ifdef __APPLE__
/* OS(MACOSX) - Mac and iOS */
#define WTF_OS_MACOSX 1
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
/* OS(IOS) - iOS */
#define WTF_OS_IOS 1
#endif
#endif /* __APPLE__ */
/* Operating environments */
#if OS(ANDROID)
......
......@@ -41,7 +41,7 @@ static const unsigned CtrlKey = 1 << 0;
static const unsigned AltKey = 1 << 1;
static const unsigned ShiftKey = 1 << 2;
static const unsigned MetaKey = 1 << 3;
#if OS(MACOSX)
#if OS(MACOSX) && !OS(IOS)
// Aliases for the generic key defintions to make kbd shortcuts definitions more
// readable on OS X.
static const unsigned OptionKey = AltKey;
......
......@@ -42,11 +42,13 @@
namespace blink {
#if ENABLE(DART_STRICT)
static const char* kCheckedModeArgs[] = {
"--enable_asserts",
"--enable_type_checks",
"--error_on_bad_type",
"--error_on_bad_override",
static const char* kCheckedModeArgs[] = {"--enable_asserts",
"--enable_type_checks",
"--error_on_bad_type",
"--error_on_bad_override",
#if WTF_OS_IOS
"--no-profile"
#endif
};
#endif
......
......@@ -633,6 +633,10 @@ source_set("platform") {
set_sources_assignment_filter(sources_assignment_filter)
}
if (is_ios) {
sources += [ "fonts/ios/FontPlatformDataIOS.cpp" ]
}
if (is_linux) {
direct_dependent_configs = [ "//build/config/linux:fontconfig" ]
}
......
/*
* Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
* OWNER OR 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 "base/logging.h"
#include "sky/engine/config.h"
#include "sky/engine/platform/fonts/FontPlatformData.h"
#include "sky/engine/platform/fonts/FontCache.h"
namespace blink {
void FontPlatformData::setupPaint(SkPaint* paint,
GraphicsContext* context) const {
paint->setAntiAlias(m_style.useAntiAlias);
paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle));
paint->setEmbeddedBitmapText(m_style.useBitmaps);
paint->setAutohinted(m_style.useAutoHint);
if (m_style.useAntiAlias)
paint->setLCDRenderText(m_style.useSubpixelRendering);
paint->setSubpixelText(m_style.useSubpixelPositioning);
const float ts = m_textSize >= 0 ? m_textSize : 12;
paint->setTextSize(SkFloatToScalar(ts));
paint->setTypeface(m_typeface.get());
paint->setFakeBoldText(m_syntheticBold);
paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0);
}
void FontPlatformData::querySystemForRenderStyle(
bool useSkiaSubpixelPositioning) {
if (!m_style.useHinting)
m_style.hintStyle = SkPaint::kNo_Hinting;
else if (m_style.useHinting == FontRenderStyle::NoPreference)
m_style.hintStyle = SkPaint::kNormal_Hinting;
if (m_style.useBitmaps == FontRenderStyle::NoPreference)
m_style.useBitmaps = true;
if (m_style.useAutoHint == FontRenderStyle::NoPreference)
m_style.useAutoHint = true;
if (m_style.useAntiAlias == FontRenderStyle::NoPreference)
m_style.useAntiAlias = true;
if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference)
m_style.useSubpixelRendering = false;
if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference)
m_style.useSubpixelPositioning = useSkiaSubpixelPositioning;
}
bool FontPlatformData::defaultUseSubpixelPositioning() {
return false;
}
void FontCache::getFontForCharacter(
UChar32 c,
const char* preferredLocale,
FontCache::PlatformFallbackFont* fallbackFont) {
DCHECK(false);
}
} // namespace blink
......@@ -49,7 +49,7 @@
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/ports/SkFontMgr.h"
#if !OS(WIN) && !OS(ANDROID)
#if !OS(WIN) && !OS(ANDROID) && !OS(IOS)
// TODO(bungeman) remove this temporary code ASAP.
// This namespace exists to ease transition of SkTypeface from using SkStream to SkStreamAsset.
namespace tmp {
......@@ -215,7 +215,7 @@ PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri
PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, CString& name)
{
#if !OS(WIN) && !OS(ANDROID)
#if !OS(WIN) && !OS(ANDROID) && !OS(IOS)
if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) {
// TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after
// https://code.google.com/p/skia/issues/detail?id=1186 gets fixed.
......
......@@ -37,7 +37,6 @@
namespace blink {
#if !OS(MACOSX)
unsigned FontPlatformData::hash() const
{
unsigned h = SkTypeface::UniqueID(m_typeface.get());
......@@ -64,8 +63,6 @@ bool FontPlatformData::fontContainsCharacter(UChar32 character)
return glyph;
}
#endif
#if ENABLE(OPENTYPE_VERTICAL)
PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
{
......
......@@ -68,7 +68,7 @@ void SimpleFontData::platformInit()
int vdmxAscent = 0, vdmxDescent = 0;
bool isVDMXValid = false;
#if OS(LINUX) || OS(ANDROID)
#if OS(LINUX) || OS(ANDROID) || OS(IOS)
// Manually digging up VDMX metrics is only applicable when bytecode hinting using FreeType.
// With GDI, the metrics will already have taken this into account (as needed).
// With DirectWrite or CoreText, no bytecode hinting is ever done.
......@@ -102,7 +102,7 @@ void SimpleFontData::platformInit()
} else {
ascent = SkScalarRoundToInt(-metrics.fAscent);
descent = SkScalarRoundToInt(metrics.fDescent);
#if OS(LINUX) || OS(ANDROID)
#if OS(LINUX) || OS(ANDROID) || OS(IOS)
// When subpixel positioning is enabled, if the descent is rounded down, the descent part
// of the glyph may be truncated when displayed in a 'overflow: hidden' container.
// To avoid that, borrow 1 unit from the ascent when possible.
......
......@@ -1097,7 +1097,7 @@ TEST(PartitionAllocTest, LostFreePagesBug)
TestShutdown();
}
#if !OS(ANDROID)
#if !OS(ANDROID) && !OS(IOS)
// Make sure that malloc(-1) dies.
// In the past, we had an integer overflow that would alias malloc(-1) to
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册