Changeset 206597 in webkit
- Timestamp:
- Sep 29, 2016 11:45:08 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206593 r206597 1 2016-09-29 Brent Fulgham <bfulgham@apple.com> 2 3 [Win][Direct2D] Add D2D Font handling code 4 https://bugs.webkit.org/show_bug.cgi?id=162712 5 6 Reviewed by Brent Fulgham. 7 8 This patch lands a set of new files that implement 9 10 No new tests until complete backend lands. 11 12 * platform/graphics/Font.h: 13 * platform/graphics/FontCascade.h: 14 (WebCore::FontCascade::syntheticObliqueAngle): Added helper function. 15 * platform/graphics/FontPlatformData.h: 16 (WebCore::FontPlatformData::dwFont): Added. 17 (WebCore::FontPlatformData::dwFontFace): Ditto. 18 * platform/graphics/GlyphBuffer.h: 19 * platform/graphics/cocoa/FontCascadeCocoa.mm: 20 (WebCore::FontCascade::drawGlyphs): Use helper function. 21 * platform/graphics/win/FontCGWin.cpp: 22 (WebCore::FontCascade::drawGlyphs): Ditto. 23 * platform/graphics/win/FontCacheWin.cpp: 24 (WebCore::FontCache::createFontPlatformData): Add case for Direct2D. 25 * platform/graphics/win/FontCascadeDirect2D.cpp: Added. 26 * platform/graphics/win/FontCustomPlatformData.cpp: 27 (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Fix whitespace. 28 (WebCore::FontCustomPlatformData::fontPlatformData): Add Direct2D case. 29 * platform/graphics/win/FontPlatformDataCGWin.cpp: 30 (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers. 31 * platform/graphics/win/FontPlatformDataCairoWin.cpp: 32 (WebCore::FontPlatformData::FontPlatformData): Ditto. 33 * platform/graphics/win/FontPlatformDataDirect2D.cpp: Added. 34 * platform/graphics/win/FontPlatformDataWin.cpp: 35 (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers. 36 * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: Added. 37 * platform/graphics/win/SimpleFontDataDirect2D.cpp: Added. 38 * platform/graphics/win/TextAnalyzerHelper.cpp: Added. 39 * platform/graphics/win/TextAnalyzerHelper.h: Added. 40 1 41 2016-09-29 Alex Christensen <achristensen@webkit.org> 2 42 -
trunk/Source/WebCore/platform/graphics/Font.h
r205703 r206597 2 2 * This file is part of the internal font implementation. 3 3 * 4 * Copyright (C) 2006, 2008, 2010, 2015 Apple Inc. All rights reserved.4 * Copyright (C) 2006, 2008, 2010, 2015-2016 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2007-2008 Torch Mobile, Inc. 6 6 * … … 56 56 #if USE(CG) 57 57 #include "CoreGraphicsSPI.h" 58 #endif 59 60 #if USE(DIRECT2D) 61 interface IDWriteFactory; 62 interface IDWriteGdiInterop; 58 63 #endif 59 64 … … 144 149 } 145 150 146 #if USE(CG) || USE( CAIRO)151 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO) 147 152 float syntheticBoldOffset() const { return m_syntheticBoldOffset; } 148 153 #endif … … 197 202 static bool shouldApplyMacAscentHack(); 198 203 static float ascentConsideringMacAscentHack(const WCHAR*, float ascent, float descent); 204 #endif 205 206 #if USE(DIRECT2D) 207 WEBCORE_EXPORT static IDWriteFactory* systemDWriteFactory(); 208 WEBCORE_EXPORT static IDWriteGdiInterop* systemDWriteGdiInterop(); 199 209 #endif 200 210 … … 268 278 mutable std::unique_ptr<DerivedFonts> m_derivedFontData; 269 279 270 #if USE(CG) || USE( CAIRO)280 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO) 271 281 float m_syntheticBoldOffset; 272 282 #endif … … 339 349 #if ENABLE(OPENTYPE_VERTICAL) 340 350 if (m_verticalData) { 341 #if USE(CG) || USE( CAIRO)351 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO) 342 352 width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffset; 343 353 #else -
trunk/Source/WebCore/platform/graphics/FontCascade.h
r206395 r206597 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2006, 2007, 2010, 2011-2016 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2008 Holger Hans Peter Freyther 7 7 * … … 321 321 } 322 322 323 static int syntheticObliqueAngle() { return 14; } 324 323 325 FontCascadeDescription m_fontDescription; 324 326 mutable RefPtr<FontCascadeFonts> m_fonts; -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r205883 r206597 1 1 /* 2 * Copyright (C) 2006, 2007, 2008, 2010, 2013 Apple Inc.2 * Copyright (C) 2006, 2007, 2008, 2010, 2013-2016 Apple Inc. 3 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 4 4 * Copyright (C) 2007 Holger Hans Peter Freyther … … 29 29 30 30 #if PLATFORM(WIN) 31 #include "COMPtr.h" 31 32 #include "SharedGDIObject.h" 32 33 #endif … … 66 67 #include <wtf/win/GDIObject.h> 67 68 typedef struct HFONT__* HFONT; 69 interface IDWriteFont; 70 interface IDWriteFontFace; 68 71 #endif 69 72 … … 104 107 #if USE(CG) 105 108 FontPlatformData(GDIObject<HFONT>, CGFontRef, float size, bool syntheticBold, bool syntheticOblique, bool useGDI); 109 #elif USE(DIRECT2D) 110 FontPlatformData(GDIObject<HFONT>, IDWriteFont*, float size, bool syntheticBold, bool syntheticOblique, bool useGDI); 106 111 #elif USE(CAIRO) 107 112 FontPlatformData(GDIObject<HFONT>, cairo_font_face_t*, float size, bool bold, bool italic); … … 136 141 #if USE(CG) && (PLATFORM(WIN) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 100000)) 137 142 CGFontRef cgFont() const { return m_cgFont.get(); } 143 #endif 144 145 #if USE(DIRECT2D) 146 IDWriteFont* dwFont() const { return m_dwFont.get(); } 147 IDWriteFontFace* dwFontFace() const { return m_dwFontFace.get(); } 138 148 #endif 139 149 … … 242 252 RetainPtr<CGFontRef> m_cgFont; 243 253 #endif 254 #if USE(DIRECT2D) 255 COMPtr<IDWriteFont> m_dwFont; 256 COMPtr<IDWriteFontFace> m_dwFontFace; 257 #endif 244 258 #if USE(CAIRO) 245 259 RefPtr<cairo_scaled_font_t> m_scaledFont; -
trunk/Source/WebCore/platform/graphics/GlyphBuffer.h
r205775 r206597 1 1 /* 2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2009, 2011, 2016 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007-2008 Torch Mobile Inc. 4 4 * … … 97 97 const GlyphBufferGlyph* glyphs(unsigned from) const { return m_glyphs.data() + from; } 98 98 const GlyphBufferAdvance* advances(unsigned from) const { return m_advances.data() + from; } 99 size_t advancesCount() const { return m_advances.size(); } 99 100 100 101 const Font* fontAt(unsigned index) const { return m_font[index]; } -
trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
r206422 r206597 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2006 , 2007, 2008, 2009, 2010, 2011Apple Inc.5 * Copyright (C) 2003, 2006-2011, 2016 Apple Inc. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 51 51 #endif 52 52 53 #define SYNTHETIC_OBLIQUE_ANGLE 1454 55 53 #ifdef __LP64__ 56 54 #define URefCon void* … … 245 243 matrix.d = -matrix.d; 246 244 if (platformData.syntheticOblique()) { 247 static float obliqueSkew = tanf( SYNTHETIC_OBLIQUE_ANGLE* piFloat / 180);245 static float obliqueSkew = tanf(syntheticObliqueAngle() * piFloat / 180); 248 246 if (platformData.orientation() == Vertical) 249 247 matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0)); -
trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp
r204858 r206597 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008, 2009, 2013Apple Inc. All rights reserved.2 * Copyright (C) 2006-2009, 2013, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 namespace WebCore { 42 42 43 const int syntheticObliqueAngle = 14;44 45 43 static inline CGFloat toCGFloat(FIXED f) 46 44 { … … 169 167 170 168 if (platformData.syntheticOblique()) { 171 static float skew = -tanf(syntheticObliqueAngle * piFloat / 180.0f);169 static float skew = -tanf(syntheticObliqueAngle() * piFloat / 180.0f); 172 170 matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, skew, 1, 0, 0)); 173 171 } -
trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp
r204558 r206597 1 1 /* 2 * Copyright (C) 2006 , 2007,2008, 2013-2014 Apple Inc. All rights reserved.2 * Copyright (C) 2006-2008, 2013-2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 #include <ApplicationServices/ApplicationServices.h> 47 47 #include <WebKitSystemInterface/WebKitSystemInterface.h> 48 #endif 49 50 #if USE(DIRECT2D) 51 #include <dwrite.h> 48 52 #endif 49 53 … … 550 554 return 1; 551 555 } 556 552 557 Vector<FontTraitsMask> FontCache::getTraitsInFamily(const AtomicString& familyName) 553 558 { … … 600 605 #if USE(CG) 601 606 bool fontCreationFailed = !result->cgFont(); 607 #elif USE(DIRECT2D) 608 bool fontCreationFailed = !result->dwFont(); 602 609 #elif USE(CAIRO) 603 610 bool fontCreationFailed = !result->scaledFont(); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
r195743 r206597 1 1 /* 2 * Copyright (C) 2007 , 2008, 2009, 2010, 2013Apple Inc. All rights reserved.2 * Copyright (C) 2007-2010, 2013, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 26 26 #include "OpenTypeUtilities.h" 27 27 #include "SharedBuffer.h" 28 #include <ApplicationServices/ApplicationServices.h>29 #include <WebKitSystemInterface/WebKitSystemInterface.h>30 28 #include <wtf/RetainPtr.h> 31 29 #include <wtf/text/Base64.h> 32 30 #include <wtf/win/GDIObject.h> 33 31 32 #if USE(CG) 33 #include <ApplicationServices/ApplicationServices.h> 34 #include <WebKitSystemInterface/WebKitSystemInterface.h> 35 #endif 36 37 #if USE(DIRECT2D) 38 #include "Font.h" 39 #include <dwrite.h> 40 #endif 41 34 42 namespace WebCore { 35 36 using namespace std;37 43 38 44 FontCustomPlatformData::~FontCustomPlatformData() 39 45 { 40 46 if (m_fontReference) 41 47 RemoveFontMemResourceEx(m_fontReference); 42 48 } 43 49 … … 69 75 auto hfont = adoptGDIObject(::CreateFontIndirect(&logFont)); 70 76 77 #if USE(CG) 71 78 RetainPtr<CGFontRef> cgFont = adoptCF(CGFontCreateWithPlatformFont(&logFont)); 72 79 return FontPlatformData(WTFMove(hfont), cgFont.get(), size, bold, italic, renderingMode == FontRenderingMode::Alternate); 80 #else 81 COMPtr<IDWriteFont> dwFont; 82 HRESULT hr = Font::systemDWriteGdiInterop()->CreateFontFromLOGFONT(&logFont, &dwFont); 83 RELEASE_ASSERT(SUCCEEDED(hr)); 84 return FontPlatformData(WTFMove(hfont), dwFont.get(), size, bold, italic, renderingMode == FontRenderingMode::Alternate); 85 #endif 73 86 } 74 87 -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
r188130 r206597 1 1 /* 2 * Copyright (C) 2007 , 2008Apple Inc. All rights reserved.2 * Copyright (C) 2007-2008, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
r195743 r206597 1 1 /* 2 * Copyright (C) 2007 , 2008, 2013Apple Inc.2 * Copyright (C) 2007-2008, 2013, 2016 Apple Inc. 3 3 * 4 4 * This library is free software; you can redistribute it and/or -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
r200104 r206597 3 3 * FontMac.cpp, FontWin.cpp and Font.cpp. 4 4 * 5 * Copyright (C) 2006 , 2007, 2008, 2009Apple Inc.5 * Copyright (C) 2006-2009, 2016 Apple Inc. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 121 121 : m_syntheticBold(bold) 122 122 , m_syntheticOblique(oblique) 123 , m_orientation(Horizontal)124 123 , m_size(size) 125 , m_widthVariant(RegularWidth)126 124 , m_font(SharedGDIObject<HFONT>::create(WTFMove(hfont))) 127 125 , m_cgFont(font) 128 , m_isColorBitmapFont(false)129 126 , m_useGDI(useGDI) 130 127 { -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
r200104 r206597 3 3 * FontMac.cpp, FontWin.cpp and Font.cpp. 4 4 * 5 * Copyright (C) 2006 , 2007, 2008Apple Inc.5 * Copyright (C) 2006-2008, 2016 Apple Inc. 6 6 * Copyright (C) 2007 Alp Toker 7 7 * Copyright (C) 2008, 2010, 2011 Brent Fulgham … … 63 63 : m_font(SharedGDIObject<HFONT>::create(WTFMove(font))) 64 64 , m_size(size) 65 , m_orientation(Horizontal)66 , m_widthVariant(RegularWidth)67 , m_isColorBitmapFont(false)68 , m_syntheticBold(bold)69 65 , m_syntheticOblique(oblique) 70 , m_useGDI(false)71 66 { 72 67 cairo_matrix_t fontMatrix; -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
r200104 r206597 3 3 * FontMac.cpp, FontWin.cpp and Font.cpp. 4 4 * 5 * Copyright (C) 2006 , 2007, 2008Apple Inc.5 * Copyright (C) 2006-2008, 2016 Apple Inc. 6 6 * Copyright (C) 2008 Brent Fulgham 7 7 * … … 41 41 : m_font(SharedGDIObject<HFONT>::create(WTFMove(font))) 42 42 , m_size(size) 43 , m_orientation(Horizontal)44 , m_widthVariant(RegularWidth)45 , m_isColorBitmapFont(false)46 43 , m_syntheticBold(bold) 47 44 , m_syntheticOblique(oblique) -
trunk/Source/WebCore/platform/graphics/win/FontWin.cpp
r204400 r206597 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008Apple Inc. All rights reserved.2 * Copyright (C) 2006-2008, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without
Note: See TracChangeset
for help on using the changeset viewer.