[webkit-changes] [WebKit/WebKit] 8b1d31: Add optimization for monospace font's content meas...
Yusuke Suzuki
noreply at github.com
Mon Dec 4 19:09:44 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8b1d31668fbca9ba382333b287d5ed2c97f3212d
https://github.com/WebKit/WebKit/commit/8b1d31668fbca9ba382333b287d5ed2c97f3212d
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2023-12-04 (Mon, 04 Dec 2023)
Changed paths:
M Source/WTF/wtf/unicode/CharacterNames.h
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp
M Source/WebCore/platform/graphics/Font.h
M Source/WebCore/platform/graphics/FontCascade.cpp
M Source/WebCore/platform/graphics/FontCascade.h
M Source/WebCore/platform/graphics/FontCascadeFonts.cpp
M Source/WebCore/platform/graphics/FontCascadeFonts.h
M Source/WebCore/platform/graphics/WidthIterator.cpp
M Source/WebCore/platform/graphics/WidthIterator.h
M Source/WebCore/platform/graphics/coretext/FontCoreText.cpp
M Tools/TestWebKitAPI/CMakeLists.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp
Log Message:
-----------
Add optimization for monospace font's content measuring
https://bugs.webkit.org/show_bug.cgi?id=265787
rdar://119124314
Reviewed by Alan Baradlay.
This patch adds an optimization path for monospace fonts when measuring text width.
One of the problem is that a lot of monospace fonts are lying and we cannot simply believe that
this is actually monospace. Thus, our current approach is,
1. When they are monospace fonts from the system, we know that they are actually monospace (by ensuring
it in our tests). Thus, we can safely assume that their characters are monospace. Only exception is
"Courier New", which has many strange characters. For now, we disable this optimization for "Courier New".
2. We list up more format category unicode characters in characterCanUseSimplifiedTextMeasuring to avoid using
monospace fast path for these characters. They are kind of control characters and we do not expect that they
will appear in texts which should be rendered in a fast path.
* Source/WTF/wtf/unicode/CharacterNames.h:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::fixedPitchWidth):
(WebCore::Layout::TextUtil::width):
* Source/WebCore/platform/graphics/Font.h:
(WebCore::Font::canTakeFixedPitchFastContentMeasuring const):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::letterSpacing const): Deleted.
(WebCore::FontCascade::wordSpacing const): Deleted.
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::canTakeFixedPitchFastContentMeasuring const):
(WebCore::FontCascade::letterSpacing const):
(WebCore::FontCascade::wordSpacing const):
* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::determineCanTakeFixedPitchFastContentMeasuring):
* Source/WebCore/platform/graphics/FontCascadeFonts.h:
(WebCore::FontCascadeFonts::isFixedPitch):
(WebCore::FontCascadeFonts::canTakeFixedPitchFastContentMeasuring):
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::characterCanUseSimplifiedTextMeasuring):
* Source/WebCore/platform/graphics/WidthIterator.h:
* Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:
(WebCore::extractBoolean):
(WebCore::Font::determinePitch):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp: Added.
(TestWebKitAPI::TEST):
Canonical link: https://commits.webkit.org/271524@main
More information about the webkit-changes
mailing list