Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
|
abarth-chromium
2015/06/08 20:32:31
Where does this copyright block come from? We usu
Chinmay
2015/06/08 20:36:21
I used FontPlatformDataLinux as a template. Should
| |
| 30 | |
| 31 #include "base/logging.h" | |
| 32 #include "sky/engine/config.h" | |
|
abarth-chromium
2015/06/08 20:32:31
We always put config.h first, followed by the "pri
Chinmay
2015/06/08 20:36:20
Noted. Will fix.
| |
| 33 #include "sky/engine/platform/fonts/FontPlatformData.h" | |
| 34 #include "sky/engine/platform/fonts/FontCache.h" | |
| 35 | |
| 36 namespace blink { | |
| 37 | |
| 38 void FontPlatformData::setupPaint(SkPaint* paint, | |
| 39 GraphicsContext* context) const { | |
| 40 paint->setAntiAlias(m_style.useAntiAlias); | |
| 41 paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); | |
| 42 paint->setEmbeddedBitmapText(m_style.useBitmaps); | |
| 43 paint->setAutohinted(m_style.useAutoHint); | |
| 44 if (m_style.useAntiAlias) | |
| 45 paint->setLCDRenderText(m_style.useSubpixelRendering); | |
| 46 paint->setSubpixelText(m_style.useSubpixelPositioning); | |
| 47 const float ts = m_textSize >= 0 ? m_textSize : 12; | |
| 48 paint->setTextSize(SkFloatToScalar(ts)); | |
| 49 paint->setTypeface(m_typeface.get()); | |
| 50 paint->setFakeBoldText(m_syntheticBold); | |
| 51 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); | |
| 52 } | |
| 53 | |
| 54 void FontPlatformData::querySystemForRenderStyle( | |
| 55 bool useSkiaSubpixelPositioning) { | |
| 56 if (!m_style.useHinting) | |
| 57 m_style.hintStyle = SkPaint::kNo_Hinting; | |
| 58 else if (m_style.useHinting == FontRenderStyle::NoPreference) | |
| 59 m_style.hintStyle = SkPaint::kNormal_Hinting; | |
| 60 if (m_style.useBitmaps == FontRenderStyle::NoPreference) | |
| 61 m_style.useBitmaps = true; | |
| 62 if (m_style.useAutoHint == FontRenderStyle::NoPreference) | |
| 63 m_style.useAutoHint = true; | |
| 64 if (m_style.useAntiAlias == FontRenderStyle::NoPreference) | |
| 65 m_style.useAntiAlias = true; | |
| 66 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) | |
| 67 m_style.useSubpixelRendering = false; | |
| 68 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) | |
| 69 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; | |
| 70 } | |
| 71 | |
| 72 bool FontPlatformData::defaultUseSubpixelPositioning() { | |
| 73 return false; | |
| 74 } | |
| 75 | |
| 76 void FontCache::getFontForCharacter( | |
| 77 UChar32 c, | |
| 78 const char* preferredLocale, | |
| 79 FontCache::PlatformFallbackFont* fallbackFont) { | |
| 80 DCHECK(false); | |
| 81 } | |
| 82 | |
| 83 } // namespace blink | |
| OLD | NEW |