jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 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> |
Etienne Bergeron | b27aab5 | 2019-09-30 16:51:42 | [diff] [blame^] | 9 | #include <vector> |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 10 | |
Etienne Bergeron | b27aab5 | 2019-09-30 16:51:42 | [diff] [blame^] | 11 | #include "base/containers/mru_cache.h" |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 12 | #include "third_party/icu/source/common/unicode/uchar.h" |
Etienne Bergeron | b27aab5 | 2019-09-30 16:51:42 | [diff] [blame^] | 13 | #include "ui/gfx/font.h" |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 14 | #include "ui/gfx/font_fallback.h" |
| 15 | #include "ui/gfx/gfx_export.h" |
| 16 | |
| 17 | namespace gfx { |
| 18 | |
Etienne Bergeron | b27aab5 | 2019-09-30 16:51:42 | [diff] [blame^] | 19 | // The fallback cache is a mapping from a font family name to its potential |
| 20 | // fallback fonts. |
| 21 | using FallbackFontsCache = base::MRUCache<std::string, std::vector<Font>>; |
| 22 | GFX_EXPORT FallbackFontsCache* GetFallbackFontsCacheInstance(); |
| 23 | |
jbroman | a48801c | 2016-04-06 17:48:17 | [diff] [blame] | 24 | // Return a font family which provides a glyph for the Unicode code point |
| 25 | // specified by character. |
| 26 | // c: a UTF-32 code point |
| 27 | // preferred_locale: preferred locale identifier for the |characters| |
| 28 | // (e.g. "en", "ja", "zh-CN") |
| 29 | // |
| 30 | // Returns: the font family instance. The instance has an empty font name if the |
| 31 | // request could not be satisfied. |
| 32 | // |
| 33 | // Previously blink::WebFontInfo::fallbackFontForChar. |
| 34 | struct FallbackFontData { |
| 35 | std::string name; |
| 36 | std::string filename; |
| 37 | int ttc_index = 0; |
| 38 | bool is_bold = false; |
| 39 | bool is_italic = false; |
| 40 | }; |
| 41 | GFX_EXPORT FallbackFontData |
| 42 | GetFallbackFontForChar(UChar32 c, const std::string& preferred_locale); |
| 43 | |
| 44 | } // namespace gfx |
| 45 | |
| 46 | #endif // UI_GFX_FONT_FALLBACK_LINUX_H_ |