OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the internal font implementation. | 2 * This file is part of the internal font implementation. |
3 * | 3 * |
4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
5 * Copyright (c) 2010 Google Inc. All rights reserved. | 5 * Copyright (c) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "platform/LayoutTestSupport.h" | 31 #include "platform/LayoutTestSupport.h" |
32 #include "platform/RuntimeEnabledFeatures.h" | 32 #include "platform/RuntimeEnabledFeatures.h" |
33 #include "platform/fonts/Font.h" | 33 #include "platform/fonts/Font.h" |
34 #import "platform/fonts/shaping/HarfBuzzFace.h" | 34 #import "platform/fonts/shaping/HarfBuzzFace.h" |
35 #include "third_party/skia/include/ports/SkTypeface_mac.h" | 35 #include "third_party/skia/include/ports/SkTypeface_mac.h" |
36 | 36 |
37 | 37 |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 unsigned FontPlatformData::hash() const | |
42 { | |
43 ASSERT(m_font || !m_cgFont); | |
44 uintptr_t hashCodes[2] = { (uintptr_t)m_font, static_cast<uintptr_t>(m_isHas
hTableDeletedValue << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheti
cItalic) }; | |
45 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); | |
46 } | |
47 | |
48 void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*, const Font*
font) const | 41 void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*, const Font*
font) const |
49 { | 42 { |
50 bool shouldSmoothFonts = true; | 43 bool shouldSmoothFonts = true; |
51 bool shouldAntialias = true; | 44 bool shouldAntialias = true; |
52 | 45 |
53 if (font) { | 46 if (font) { |
54 switch (font->fontDescription().fontSmoothing()) { | 47 switch (font->fontDescription().fontSmoothing()) { |
55 case Antialiased: | 48 case Antialiased: |
56 shouldSmoothFonts = false; | 49 shouldSmoothFonts = false; |
57 break; | 50 break; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 else | 265 else |
273 fontDescriptor = cascadeToLastResortFontDescriptor(); | 266 fontDescriptor = cascadeToLastResortFontDescriptor(); |
274 m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_textSi
ze, 0, fontDescriptor)); | 267 m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_textSi
ze, 0, fontDescriptor)); |
275 } else | 268 } else |
276 m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_textSize
, 0, cascadeToLastResortFontDescriptor())); | 269 m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_textSize
, 0, cascadeToLastResortFontDescriptor())); |
277 | 270 |
278 return m_CTFont.get(); | 271 return m_CTFont.get(); |
279 } | 272 } |
280 | 273 |
281 } // namespace blink | 274 } // namespace blink |
OLD | NEW |