| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/fonts/linux/FontRenderStyle.h" | 5 #include "platform/fonts/linux/FontRenderStyle.h" |
| 6 | 6 |
| 7 #include "platform/LayoutTestSupport.h" | 7 #include "platform/LayoutTestSupport.h" |
| 8 #include "platform/fonts/FontDescription.h" | 8 #include "platform/fonts/FontDescription.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/linux/WebFontRenderStyle.h" | 10 #include "public/platform/linux/WebFontRenderStyle.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 FontRenderStyle FontRenderStyle::querySystem(const CString& family, | 51 FontRenderStyle FontRenderStyle::querySystem(const CString& family, |
| 52 float textSize, | 52 float textSize, |
| 53 SkTypeface::Style typefaceStyle) { | 53 SkTypeface::Style typefaceStyle) { |
| 54 WebFontRenderStyle style; | 54 WebFontRenderStyle style; |
| 55 #if OS(ANDROID) | 55 #if OS(ANDROID) |
| 56 style.setDefaults(); | 56 style.setDefaults(); |
| 57 #else | 57 #else |
| 58 // If the font name is missing (i.e. probably a web font) or the sandbox is di
sabled, use the system defaults. | 58 // If the font name is missing (i.e. probably a web font) or the sandbox is |
| 59 // disabled, use the system defaults. |
| 59 if (!family.length() || !Platform::current()->sandboxSupport()) { | 60 if (!family.length() || !Platform::current()->sandboxSupport()) { |
| 60 style.setDefaults(); | 61 style.setDefaults(); |
| 61 } else { | 62 } else { |
| 62 const int sizeAndStyle = (((int)textSize) << 2) | (typefaceStyle & 3); | 63 const int sizeAndStyle = (((int)textSize) << 2) | (typefaceStyle & 3); |
| 63 Platform::current()->sandboxSupport()->getWebFontRenderStyleForStrike( | 64 Platform::current()->sandboxSupport()->getWebFontRenderStyleForStrike( |
| 64 family.data(), sizeAndStyle, &style); | 65 family.data(), sizeAndStyle, &style); |
| 65 } | 66 } |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 FontRenderStyle result; | 69 FontRenderStyle result; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 deviceScaleFactor > 1.0f); | 109 deviceScaleFactor > 1.0f); |
| 109 | 110 |
| 110 // TestRunner specifically toggles the subpixel positioning flag. | 111 // TestRunner specifically toggles the subpixel positioning flag. |
| 111 if (useSubpixelText && !LayoutTestSupport::isRunningLayoutTest()) | 112 if (useSubpixelText && !LayoutTestSupport::isRunningLayoutTest()) |
| 112 paint.setSubpixelText(true); | 113 paint.setSubpixelText(true); |
| 113 else | 114 else |
| 114 paint.setSubpixelText(useSubpixelPositioning); | 115 paint.setSubpixelText(useSubpixelPositioning); |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace blink | 118 } // namespace blink |
| OLD | NEW |