// 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_FONTS_SHAPING_HAN_KERNING_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_HAN_KERNING_H_ #include "base/gtest_prod_util.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/text/han_kerning_char_type.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { class FontDescription; class FontFeatures; class LayoutLocale; class SimpleFontData; // // This class implements the behavior necessary for the CSS `text-spacing-trim` // property[1]. // // In short, it's similar to kerning to be applied to Han-derived scripts such // as Chinese or Japanese. In OpenType, this behavior is defined as the // `chws`[2] feature. // // It's different from the regular kerning that the kerning pairs and amounts // are computable. There are tools to add the features to existing fonts[3][4]. // // This class complements the OpenType feature in that: // 1. Handles the desired beahvior at the font boundaries. OpenType features // can't handle kerning at font boundaries by design. // 2. Emulates the behavior when the font doesn't have the `chws` feature. // // [1]: https://drafts.csswg.org/css-text-4/#text-spacing-trim-property // [2]: // https://learn.microsoft.com/en-us/typography/opentype/spec/features_ae#tag-chws // [3]: https://github.com/googlefonts/chws_tool // [4]: https://github.com/kojiishi/east_asian_spacing // class PLATFORM_EXPORT HanKerning { … }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_HAN_KERNING_H_