-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[text-spacing-trim] Use a Trie for
HanKerning::GetCharType
Last a few rules of "Fullwidth Punctuation Collapsing"[1] require characters in ASCII, such as U+0028[2]. This makes optimizing `HanKerning::GetCharType` by early return more difficult. This patch moves the logic to the ICU Trie data structure, built on the build time. The time needed should be almost the same as getting one Unicode property. This patch has no behavior changes. [1] https://drafts.csswg.org/css-text-4/#fullwidth-collapsing [2] https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3Agc%3DPs%3A%5D%5B%3Agc%3DPe%3A%5D&g=&i= Bug: 1463891 Change-Id: I3b43ce33942e617839d0f2a1a05103a5cf4bf6c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4950310 Commit-Queue: Koji Ishii <kojii@chromium.org> Auto-Submit: Koji Ishii <kojii@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1211379}
- Loading branch information
Showing
9 changed files
with
179 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
third_party/blink/renderer/platform/text/han_kerning_char_type.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_HAN_KERNING_CHAR_TYPE_H_ | ||
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_HAN_KERNING_CHAR_TYPE_H_ | ||
|
||
#include <stdint.h> | ||
|
||
namespace blink { | ||
|
||
// | ||
// Character types for the `HanKerning` class. | ||
// | ||
// https://drafts.csswg.org/css-text-4/#text-spacing-classes | ||
// | ||
enum class HanKerningCharType : uint8_t { | ||
kOther, | ||
kOpen, | ||
kClose, | ||
kMiddle, | ||
|
||
// Following types depend on fonts. `HanKerning::GetCharType()` can resolve | ||
// them to types above. | ||
kDot, | ||
kColon, | ||
kSemicolon, | ||
|
||
// When adding values, ensure `CharacterProperty` has enough storage. | ||
}; | ||
|
||
} // namespace blink | ||
|
||
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_HAN_KERNING_CHAR_TYPE_H_ |