Diff
Modified: trunk/LayoutTests/ChangeLog (267072 => 267073)
--- trunk/LayoutTests/ChangeLog 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/LayoutTests/ChangeLog 2020-09-15 04:19:22 UTC (rev 267073)
@@ -1,3 +1,15 @@
+2020-09-14 Myles C. Maxfield <[email protected]>
+
+ [Apple Win] Migrate from FontPlatformDataWin.cpp to FontPlatformDataCoreText.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=216448
+
+ Reviewed by Darin Adler.
+
+ These two tests are progressions.
+
+ * platform/win/mathml/opentype/opentype-stretchy-expected.txt:
+ * platform/win/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt:
+
2020-09-14 Hector Lopez <[email protected]>
Added test and test expectation for constant crashes ar r267002
Modified: trunk/LayoutTests/platform/win/mathml/opentype/opentype-stretchy-expected.txt (267072 => 267073)
--- trunk/LayoutTests/platform/win/mathml/opentype/opentype-stretchy-expected.txt 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/LayoutTests/platform/win/mathml/opentype/opentype-stretchy-expected.txt 2020-09-15 04:19:22 UTC (rev 267073)
@@ -1,45 +1,45 @@
-layer at (0,0) size 785x33554431
- RenderView at (0,0) size 785x600
-layer at (0,0) size 785x33554431
- RenderBlock {HTML} at (0,0) size 785x33554431
- RenderBody {BODY} at (8,16) size 769x33554415
- RenderBlock {P} at (0,0) size 769x34
- RenderMathMLMath {math} at (0,20) size 8x10
- RenderMathMLRow {mrow} at (0,0) size 8x10
- RenderMathMLOperator {mo} at (0,0) size 8x10
- RenderBlock (anonymous) at (0,0) size 2x10
- RenderText {#text} at (0,0) size 2x0
- text run at (0,0) width 2: "\x{219F}"
- RenderText {#text} at (7,16) size 5x18
- text run at (7,16) width 5: " "
- RenderMathMLMath {math} at (11,15) size 27x15
- RenderMathMLRow {mrow} at (0,0) size 26x15
- RenderMathMLOperator {mo} at (0,0) size 26x10
- RenderBlock (anonymous) at (0,0) size 2x10
- RenderText {#text} at (0,0) size 2x0
- text run at (0,0) width 2: "\x{219F}"
- RenderText {#text} at (37,16) size 5x18
- text run at (37,16) width 5: " "
- RenderMathMLMath {math} at (41,0) size 47x30
- RenderMathMLRow {mrow} at (0,0) size 47x30
- RenderMathMLOperator {mo} at (0,0) size 47x30
- RenderBlock (anonymous) at (0,0) size 2x10
- RenderText {#text} at (0,0) size 2x0
- text run at (0,0) width 2: "\x{219F}"
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x338
+ RenderBlock {HTML} at (0,0) size 800x338
+ RenderBody {BODY} at (8,16) size 784x306
+ RenderBlock {P} at (0,0) size 784x34
+ RenderMathMLMath {math} at (0,20) size 26x11
+ RenderMathMLRow {mrow} at (0,0) size 26x11
+ RenderMathMLOperator {mo} at (0,0) size 26x11
+ RenderBlock (anonymous) at (0,0) size 2x3
+ RenderText {#text} at (0,-3) size 2x0
+ text run at (0,-3) width 2: "\x{219F}"
+ RenderText {#text} at (25,16) size 5x18
+ text run at (25,16) width 5: " "
+ RenderMathMLMath {math} at (29,10) size 27x21
+ RenderMathMLRow {mrow} at (0,0) size 26x21
+ RenderMathMLOperator {mo} at (0,0) size 26x21
+ RenderBlock (anonymous) at (0,0) size 2x3
+ RenderText {#text} at (0,-3) size 2x0
+ text run at (0,-3) width 2: "\x{219F}"
+ RenderText {#text} at (55,16) size 5x18
+ text run at (55,16) width 5: " "
+ RenderMathMLMath {math} at (59,0) size 26x31
+ RenderMathMLRow {mrow} at (0,0) size 26x31
+ RenderMathMLOperator {mo} at (0,0) size 26x31
+ RenderBlock (anonymous) at (0,0) size 2x3
+ RenderText {#text} at (0,-3) size 2x0
+ text run at (0,-3) width 2: "\x{219F}"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {P} at (0,50) size 769x154
+ RenderBlock {P} at (0,50) size 784x154
RenderMathMLMath {math} at (0,0) size 47x150
RenderMathMLRow {mrow} at (0,0) size 47x150
RenderMathMLOperator {mo} at (0,0) size 47x150
- RenderBlock (anonymous) at (0,0) size 2x10
- RenderText {#text} at (0,0) size 2x0
- text run at (0,0) width 2: "\x{219F}"
+ RenderBlock (anonymous) at (0,0) size 2x3
+ RenderText {#text} at (0,-3) size 2x0
+ text run at (0,-3) width 2: "\x{219F}"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {P} at (0,220) size 769x33554211
- RenderMathMLMath {math} at (0,14) size 94x33554417
- RenderMathMLRow {mrow} at (0,0) size 94x33554431
- RenderMathMLOperator {mo} at (0,33554431) size 94x0
- RenderBlock (anonymous) at (0,0) size 10x10
- RenderText {#text} at (0,0) size 10x0
- text run at (0,0) width 10: "\x{2A1B}"
+ RenderBlock {P} at (0,220) size 784x86
+ RenderMathMLMath {math} at (0,0) size 84x82
+ RenderMathMLRow {mrow} at (0,0) size 84x82
+ RenderMathMLOperator {mo} at (0,0) size 84x82
+ RenderBlock (anonymous) at (0,0) size 10x12
+ RenderText {#text} at (0,6) size 10x0
+ text run at (0,6) width 10: "\x{2A1B}"
RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt (267072 => 267073)
--- trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt 2020-09-15 04:19:22 UTC (rev 267073)
@@ -39,8 +39,8 @@
RenderSVGText {text} at (230,69) size 164x14 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 164x14
chunk 1 text run 1 at (230.00,80.00) startOffset 0 endOffset 30 width 164.00: "Relative to font x-height (ex)"
- RenderSVGContainer {g} at (20,140) size 320x1
- RenderSVGRect {rect} at (20,140) size 320x1 [fill={[type=SOLID] [color=#000000]}] [x=20.00] [y=80.00] [width=320.00] [height=1.00]
+ RenderSVGContainer {g} at (20,140) size 210x1
+ RenderSVGRect {rect} at (20,140) size 210x1 [fill={[type=SOLID] [color=#000000]}] [x=20.00] [y=80.00] [width=240.00] [height=1.00]
RenderSVGText {text} at (20,87) size 99x14 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 99x14
chunk 1 text run 1 at (20.00,98.00) startOffset 0 endOffset 15 width 99.00: "41.67% = 200 px"
Modified: trunk/Source/WebCore/ChangeLog (267072 => 267073)
--- trunk/Source/WebCore/ChangeLog 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/ChangeLog 2020-09-15 04:19:22 UTC (rev 267073)
@@ -1,3 +1,52 @@
+2020-09-14 Myles C. Maxfield <[email protected]>
+
+ [Apple Win] Migrate from FontPlatformDataWin.cpp to FontPlatformDataCoreText.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=216448
+
+ Reviewed by Darin Adler.
+
+ This is one of the steps toward migrating the Apple Win port off of CGFont and on to
+ CTFont. This patch removes the #if !PLATFORM(WIN) guard in FontPlatformDataCoreText.cpp
+ and deletes the old functions it used to be using. It fixes up the Core Text functions to
+ use ctFont() instead of font(), because font() returns the HFONT on Windows.
+
+ It also adds a new helper, platformOpenTypeTable(), because it looks like
+ CTFontCopyTable() sometimes fails, so we can use this function to fall back to using the
+ HFONT and the win32 API instead.
+
+ Covered by existing tests.
+
+ * platform/graphics/FontPlatformData.cpp:
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::ctFont const):
+ (WebCore::FontPlatformData::font const):
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::platformOpenTypeTable const):
+ * platform/graphics/coretext/FontPlatformDataCoreText.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+ (WebCore::FontPlatformData::registeredFont const):
+ (WebCore::FontPlatformData::ctFont const):
+ (WebCore::FontPlatformData::openTypeTable const):
+ (WebCore::FontPlatformData::description const):
+ (WebCore::FontPlatformData::familyName const):
+ * platform/graphics/win/FontCustomPlatformData.cpp:
+ (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
+ (WebCore::FontCustomPlatformData::fontPlatformData):
+ (WebCore::createFontCustomPlatformData):
+ * platform/graphics/win/FontCustomPlatformData.h:
+ (WebCore::FontCustomPlatformData::FontCustomPlatformData):
+ * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
+ (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
+ (WebCore::FontCustomPlatformData::fontPlatformData):
+ * platform/graphics/win/FontPlatformDataCGWin.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+ * platform/graphics/win/FontPlatformDataCairoWin.cpp:
+ (WebCore::FontPlatformData::openTypeTable const):
+ * platform/graphics/win/FontPlatformDataWin.cpp:
+ (WebCore::FontPlatformData::platformOpenTypeTable const):
+ (WebCore::FontPlatformData::openTypeTable const): Deleted.
+ (WebCore::FontPlatformData::description const): Deleted.
+
2020-09-14 Chris Dumez <[email protected]>
Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float
Modified: trunk/Source/WebCore/PAL/ChangeLog (267072 => 267073)
--- trunk/Source/WebCore/PAL/ChangeLog 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/PAL/ChangeLog 2020-09-15 04:19:22 UTC (rev 267073)
@@ -1,3 +1,12 @@
+2020-09-14 Myles C. Maxfield <[email protected]>
+
+ [Apple Win] Migrate from FontPlatformDataWin.cpp to FontPlatformDataCoreText.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=216448
+
+ Reviewed by Darin Adler.
+
+ * pal/spi/win/CoreTextSPIWin.h:
+
2020-09-14 Peng Liu <[email protected]>
Clean up AVKitSPI.h
Modified: trunk/Source/WebCore/PAL/pal/spi/win/CoreTextSPIWin.h (267072 => 267073)
--- trunk/Source/WebCore/PAL/pal/spi/win/CoreTextSPIWin.h 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/PAL/pal/spi/win/CoreTextSPIWin.h 2020-09-15 04:19:22 UTC (rev 267073)
@@ -129,6 +129,7 @@
CGFloat CTFontGetSize(CTFontRef);
CTFontSymbolicTraits CTFontGetSymbolicTraits(CTFontRef);
CFCharacterSetRef CTFontCopyCharacterSet(CTFontRef);
+CGFontRef CTFontCopyGraphicsFont(CTFontRef, CTFontDescriptorRef* attributes);
CFStringRef CTFontCopyFamilyName(CTFontRef);
CFStringRef CTFontCopyFullName(CTFontRef);
CTFontRef CTFontCreateCopyWithAttributes(CTFontRef, CGFloat size, const CGAffineTransform* matrix, CTFontDescriptorRef attributes);
@@ -154,6 +155,8 @@
CFDataRef CTFontCopyTable(CTFontRef, CTFontTableTag, CTFontTableOptions);
bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar[], CGGlyph[], CFIndex count);
+CTFontDescriptorRef CTFontManagerCreateFontDescriptorFromData(CFDataRef);
+
CTFontDescriptorRef CTFontDescriptorCreateWithAttributes(CFDictionaryRef);
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
CTFontDescriptorRef CTFontDescriptorCreateWithNameAndSize(CFStringRef, CGFloat);
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -79,7 +79,7 @@
}
#endif
-#if !USE(CORE_TEXT) || PLATFORM(WIN)
+#if !USE(CORE_TEXT)
String FontPlatformData::familyName() const
{
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2020-09-15 04:19:22 UTC (rev 267073)
@@ -88,9 +88,8 @@
#if PLATFORM(WIN)
FontPlatformData(GDIObject<HFONT>, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
-#if USE(CG)
- FontPlatformData(GDIObject<HFONT>, CGFontRef, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
- FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant, TextRenderingMode);
+#if USE(CORE_TEXT)
+ FontPlatformData(GDIObject<HFONT>, CTFontRef, CGFontRef, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
#endif
#if USE(DIRECT2D)
FontPlatformData(GDIObject<HFONT>&&, COMPtr<IDWriteFont>&&, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
@@ -114,19 +113,21 @@
#if USE(CG)
CGFontRef cgFont() const { return m_cgFont.get(); }
#endif
+#endif
+
#if USE(CORE_TEXT)
- CTFontRef ctFont() const { return m_ctFont.get(); }
-#endif
-#elif USE(CORE_TEXT)
- CTFontRef font() const { return m_font.get(); }
WEBCORE_EXPORT CTFontRef registeredFont() const; // Returns nullptr iff the font is not registered, such as web fonts (otherwise returns font()).
-
- CTFontRef ctFont() const;
static RetainPtr<CFTypeRef> objectForEqualityCheck(CTFontRef);
RetainPtr<CFTypeRef> objectForEqualityCheck() const;
+ bool hasCustomTracking() const { return isSystemFont(); }
- bool hasCustomTracking() const { return isSystemFont(); }
+#if PLATFORM(WIN)
+ CTFontRef ctFont() const { return m_ctFont.get(); }
+#else
+ CTFontRef font() const { return m_font.get(); }
+ CTFontRef ctFont() const;
#endif
+#endif
#if PLATFORM(WIN) || PLATFORM(COCOA)
bool isSystemFont() const { return m_isSystemFont; }
@@ -194,6 +195,7 @@
}
RefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
+ RefPtr<SharedBuffer> platformOpenTypeTable(uint32_t table) const;
String description() const;
@@ -214,10 +216,8 @@
#if PLATFORM(WIN)
RefPtr<SharedGDIObject<HFONT>> m_font; // FIXME: Delete this in favor of m_ctFont or m_dwFont or m_scaledFont.
-#if USE(CG)
+#if USE(CORE_TEXT)
RetainPtr<CGFontRef> m_cgFont; // FIXME: Delete this in favor of m_ctFont.
-#endif
-#if USE(CORE_TEXT)
RetainPtr<CTFontRef> m_ctFont;
#endif
#elif USE(CORE_TEXT)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2020-09-15 04:19:22 UTC (rev 267073)
@@ -56,4 +56,9 @@
return CFEqual(m_font.get(), other.m_font.get());
}
+RefPtr<SharedBuffer> FontPlatformData::platformOpenTypeTable(uint32_t) const
+{
+ return nullptr;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -35,15 +35,17 @@
namespace WebCore {
-#if !PLATFORM(WIN)
-
FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode)
: FontPlatformData(size, syntheticBold, syntheticOblique, orientation, widthVariant, textRenderingMode)
{
ASSERT_ARG(font, font);
+#if PLATFORM(WIN)
+ m_ctFont = font;
+#else
m_font = font;
+#endif
m_isColorBitmapFont = CTFontGetSymbolicTraits(font) & kCTFontColorGlyphsTrait;
- m_isSystemFont = WebCore::isSystemFont(m_font.get());
+ m_isSystemFont = WebCore::isSystemFont(font);
auto variations = adoptCF(static_cast<CFDictionaryRef>(CTFontCopyAttribute(font, kCTFontVariationAttribute)));
m_hasVariations = variations && CFDictionaryGetCount(variations.get());
@@ -63,7 +65,7 @@
CTFontRef FontPlatformData::registeredFont() const
{
- CTFontRef platformFont = font();
+ CTFontRef platformFont = ctFont();
ASSERT(platformFont);
if (platformFont && adoptCF(CTFontCopyAttribute(platformFont, kCTFontURLAttribute)))
return platformFont;
@@ -132,11 +134,6 @@
return m_ctFont.get();
}
-#else
-CTFontRef FontPlatformData::ctFont() const
-{
- return font();
-}
#endif
RetainPtr<CFTypeRef> FontPlatformData::objectForEqualityCheck(CTFontRef ctFont)
@@ -156,10 +153,10 @@
RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
{
- if (RetainPtr<CFDataRef> data = "" table, kCTFontTableOptionNoOptions)))
+ if (RetainPtr<CFDataRef> data = "" table, kCTFontTableOptionNoOptions)))
return SharedBuffer::create(data.get());
- return nullptr;
+ return platformOpenTypeTable(table);
}
#if !LOG_DISABLED
@@ -166,7 +163,7 @@
String FontPlatformData::description() const
{
- String fontDescription { adoptCF(CFCopyDescription(font())).get() };
+ String fontDescription { adoptCF(CFCopyDescription(ctFont())).get() };
return makeString(fontDescription, ' ', m_size,
(m_syntheticBold ? " synthetic bold" : ""),
(m_syntheticOblique ? " synthetic oblique" : ""),
@@ -177,11 +174,9 @@
String FontPlatformData::familyName() const
{
- if (auto platformFont = font())
+ if (auto platformFont = ctFont())
return adoptCF(CTFontCopyFamilyName(platformFont)).get();
return { };
}
-#endif
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -42,8 +42,8 @@
FontCustomPlatformData::~FontCustomPlatformData()
{
- if (m_fontReference)
- RemoveFontMemResourceEx(m_fontReference);
+ if (fontReference)
+ RemoveFontMemResourceEx(fontReference);
}
FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings&, FontSelectionSpecifiedCapabilities)
@@ -51,9 +51,9 @@
int size = fontDescription.computedPixelSize();
FontRenderingMode renderingMode = fontDescription.renderingMode();
- ASSERT(m_fontReference);
+ ASSERT(fontReference);
- auto faceName = m_name.charactersWithNullTermination();
+ auto faceName = name.charactersWithNullTermination();
if (faceName.size() > LF_FACESIZE) {
faceName.resize(LF_FACESIZE);
faceName.last() = 0;
@@ -60,7 +60,7 @@
}
LOGFONT logFont { };
- memcpy(logFont.lfFaceName, faceName.data(), sizeof(logFont.lfFaceName[0]) * std::min<size_t>(static_cast<size_t>(LF_FACESIZE), 1 + m_name.length()));
+ memcpy(logFont.lfFaceName, faceName.data(), sizeof(logFont.lfFaceName[0]) * std::min<size_t>(static_cast<size_t>(LF_FACESIZE), 1 + name.length()));
logFont.lfHeight = -size;
if (renderingMode == FontRenderingMode::Normal)
@@ -82,9 +82,10 @@
logFont.lfWeight = bold ? 700 : 400;
auto hfont = adoptGDIObject(::CreateFontIndirect(&logFont));
-#if USE(CG)
- RetainPtr<CGFontRef> cgFont = adoptCF(CGFontCreateWithPlatformFont(&logFont));
- return FontPlatformData(WTFMove(hfont), cgFont.get(), size, bold, italic, renderingMode == FontRenderingMode::Alternate);
+#if USE(CORE_TEXT)
+ auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
+ auto cgFont = adoptCF(CTFontCopyGraphicsFont(ctFont.get(), nullptr));
+ return FontPlatformData(WTFMove(hfont), ctFont.get(), cgFont.get(), size, bold, italic, renderingMode == FontRenderingMode::Alternate);
#else
auto font = DirectWrite::createWithPlatformFont(logFont);
return FontPlatformData(WTFMove(hfont), WTFMove(font), size, bold, italic, renderingMode == FontRenderingMode::Alternate);
@@ -110,7 +111,11 @@
fontReference = renameAndActivateFont(buffer, fontName);
if (!fontReference)
return nullptr;
- return makeUnique<FontCustomPlatformData>(fontReference, fontName);
+ auto result = makeUnique<FontCustomPlatformData>(fontReference, fontName);
+#if USE(CORE_TEXT)
+ result->fontDescriptor = adoptCF(CTFontManagerCreateFontDescriptorFromData(buffer.createCFData().get()));
+#endif
+ return result;
}
bool FontCustomPlatformData::supportsFormat(const String& format)
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2020-09-15 04:19:22 UTC (rev 267073)
@@ -27,6 +27,10 @@
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
+#if USE(CORE_TEXT)
+#include <pal/spi/win/CoreTextSPIWin.h>
+#endif
+
typedef struct CGFont* CGFontRef;
namespace WebCore {
@@ -45,8 +49,8 @@
WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
FontCustomPlatformData(HANDLE fontReference, const String& name)
- : m_fontReference(fontReference)
- , m_name(name)
+ : fontReference(fontReference)
+ , name(name)
{
}
@@ -56,8 +60,11 @@
static bool supportsFormat(const String&);
- HANDLE m_fontReference;
- String m_name;
+ HANDLE fontReference;
+ String name;
+#if USE(CORE_TEXT)
+ RetainPtr<CTFontDescriptorRef> fontDescriptor;
+#endif
};
std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&, const String&);
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -34,8 +34,8 @@
FontCustomPlatformData::~FontCustomPlatformData()
{
- if (m_fontReference)
- RemoveFontMemResourceEx(m_fontReference);
+ if (fontReference)
+ RemoveFontMemResourceEx(fontReference);
}
FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings&, FontSelectionSpecifiedCapabilities)
@@ -45,7 +45,7 @@
LOGFONT logFont;
memset(&logFont, 0, sizeof(LOGFONT));
- wcsncpy(logFont.lfFaceName, m_name.wideCharacters().data(), LF_FACESIZE - 1);
+ wcsncpy(logFont.lfFaceName, name.wideCharacters().data(), LF_FACESIZE - 1);
logFont.lfHeight = -size;
if (renderingMode == FontRenderingMode::Normal)
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -120,25 +120,17 @@
m_isSystemFont = !wcscmp(faceName, L"Lucida Grande");
}
-FontPlatformData::FontPlatformData(GDIObject<HFONT> hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI)
+FontPlatformData::FontPlatformData(GDIObject<HFONT> hfont, CTFontRef ctFont, CGFontRef cgFont, float size, bool bold, bool oblique, bool useGDI)
: m_syntheticBold(bold)
, m_syntheticOblique(oblique)
, m_size(size)
, m_font(SharedGDIObject<HFONT>::create(WTFMove(hfont)))
- , m_cgFont(font)
- , m_ctFont(adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), size, nullptr, nullptr)))
+ , m_cgFont(cgFont)
+ , m_ctFont(ctFont)
, m_useGDI(useGDI)
{
}
-FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode)
- : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, widthVariant, textRenderingMode)
-{
- m_cgFont = cgFont;
- ASSERT(m_cgFont);
- m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), size, nullptr, nullptr));
-}
-
unsigned FontPlatformData::hash() const
{
unsigned fontHash = m_font ? m_font->hash() : 0;
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -26,6 +26,7 @@
#include "config.h"
#include "FontPlatformData.h"
+#include "SharedBuffer.h"
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
@@ -34,7 +35,6 @@
#include <cairo-win32.h>
-
namespace WebCore {
void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* faceName)
@@ -96,4 +96,9 @@
&& m_useGDI == other.m_useGDI;
}
+RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+{
+ return platformOpenTypeTable(table);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp (267072 => 267073)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2020-09-15 03:42:58 UTC (rev 267072)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2020-09-15 04:19:22 UTC (rev 267073)
@@ -60,7 +60,7 @@
RestoreDC(hdc, -1);
}
-RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+RefPtr<SharedBuffer> FontPlatformData::platformOpenTypeTable(uint32_t table) const
{
HWndDC hdc(0);
HGDIOBJ oldFont = SelectObject(hdc, hfont());
@@ -78,11 +78,4 @@
return buffer;
}
-#if !LOG_DISABLED
-String FontPlatformData::description() const
-{
- return String();
}
-#endif
-
-}