Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_GFX_FONT_FALLBACK_LINUX_H_ |
| 6 | #define UI_GFX_FONT_FALLBACK_LINUX_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
Kalvin Lee | 7d17d557 | 2024-11-10 13:52:45 | [diff] [blame] | 10 | #include "base/component_export.h" |
Henrique Ferreiro | f6ba3bf | 2019-11-21 01:27:43 | [diff] [blame] | 11 | #include "base/files/file_path.h" |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 12 | #include "third_party/icu/source/common/unicode/uchar.h" |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 13 | |
| 14 | namespace gfx { |
| 15 | |
Etienne Bergeron | ee1a599 | 2019-10-08 16:01:22 | [diff] [blame] | 16 | // Exposed fallback font caches methods for testing. |
Kalvin Lee | 7d17d557 | 2024-11-10 13:52:45 | [diff] [blame] | 17 | COMPONENT_EXPORT(GFX) size_t GetFallbackFontEntriesCacheSizeForTesting(); |
| 18 | COMPONENT_EXPORT(GFX) size_t GetFallbackFontListCacheSizeForTesting(); |
| 19 | COMPONENT_EXPORT(GFX) void ClearAllFontFallbackCachesForTesting(); |
Etienne Bergeron | b27aab5 | 2019-09-30 16:51:42 | [diff] [blame] | 20 | |
Kalvin Lee | 7d17d557 | 2024-11-10 13:52:45 | [diff] [blame] | 21 | struct COMPONENT_EXPORT(GFX) FallbackFontData { |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 22 | std::string name; |
Henrique Ferreiro | f6ba3bf | 2019-11-21 01:27:43 | [diff] [blame] | 23 | base::FilePath filepath; |
Henrique Ferreiro | 33fab43 | 2019-11-21 10:58:38 | [diff] [blame] | 24 | int fontconfig_interface_id = 0; |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 25 | int ttc_index = 0; |
| 26 | bool is_bold = false; |
| 27 | bool is_italic = false; |
Henrique Ferreiro | 33fab43 | 2019-11-21 10:58:38 | [diff] [blame] | 28 | |
| 29 | FallbackFontData(); |
| 30 | FallbackFontData(const FallbackFontData& other); |
Peter Kasting | b6e09f51 | 2021-07-08 05:33:53 | [diff] [blame] | 31 | FallbackFontData& operator=(const FallbackFontData& other); |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 32 | }; |
Henrique Ferreiro | 33fab43 | 2019-11-21 10:58:38 | [diff] [blame] | 33 | |
Henrique Ferreiro | f5571080 | 2019-11-25 10:01:16 | [diff] [blame] | 34 | // Return a font family which provides a glyph for the Unicode code point |
| 35 | // specified by character. |
| 36 | // c: an UTF-32 code point |
| 37 | // preferred_locale: preferred locale identifier for |c| |
| 38 | // (e.g. "en", "ja", "zh-CN") |
| 39 | // |
| 40 | // Return whether the request was successful or not. |
Kalvin Lee | 7d17d557 | 2024-11-10 13:52:45 | [diff] [blame] | 41 | COMPONENT_EXPORT(GFX) |
| 42 | bool GetFallbackFontForChar(UChar32 c, |
| 43 | const std::string& preferred_locale, |
| 44 | FallbackFontData* fallback_font); |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 45 | |
| 46 | } // namespace gfx |
| 47 | |
| 48 | #endif // UI_GFX_FONT_FALLBACK_LINUX_H_ |