blob: 7da0c91476e46a5fdf3e6c0f64450bb720396f1a [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2016 The Chromium Authors
jbromana48801c2016-04-06 17:48:172// 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 Lee7d17d5572024-11-10 13:52:4510#include "base/component_export.h"
Henrique Ferreirof6ba3bf2019-11-21 01:27:4311#include "base/files/file_path.h"
jbromana48801c2016-04-06 17:48:1712#include "third_party/icu/source/common/unicode/uchar.h"
jbromana48801c2016-04-06 17:48:1713
14namespace gfx {
15
Etienne Bergeronee1a5992019-10-08 16:01:2216// Exposed fallback font caches methods for testing.
Kalvin Lee7d17d5572024-11-10 13:52:4517COMPONENT_EXPORT(GFX) size_t GetFallbackFontEntriesCacheSizeForTesting();
18COMPONENT_EXPORT(GFX) size_t GetFallbackFontListCacheSizeForTesting();
19COMPONENT_EXPORT(GFX) void ClearAllFontFallbackCachesForTesting();
Etienne Bergeronb27aab52019-09-30 16:51:4220
Kalvin Lee7d17d5572024-11-10 13:52:4521struct COMPONENT_EXPORT(GFX) FallbackFontData {
jbromana48801c2016-04-06 17:48:1722 std::string name;
Henrique Ferreirof6ba3bf2019-11-21 01:27:4323 base::FilePath filepath;
Henrique Ferreiro33fab432019-11-21 10:58:3824 int fontconfig_interface_id = 0;
jbromana48801c2016-04-06 17:48:1725 int ttc_index = 0;
26 bool is_bold = false;
27 bool is_italic = false;
Henrique Ferreiro33fab432019-11-21 10:58:3828
29 FallbackFontData();
30 FallbackFontData(const FallbackFontData& other);
Peter Kastingb6e09f512021-07-08 05:33:5331 FallbackFontData& operator=(const FallbackFontData& other);
jbromana48801c2016-04-06 17:48:1732};
Henrique Ferreiro33fab432019-11-21 10:58:3833
Henrique Ferreirof55710802019-11-25 10:01:1634// 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 Lee7d17d5572024-11-10 13:52:4541COMPONENT_EXPORT(GFX)
42bool GetFallbackFontForChar(UChar32 c,
43 const std::string& preferred_locale,
44 FallbackFontData* fallback_font);
jbromana48801c2016-04-06 17:48:1745
46} // namespace gfx
47
48#endif // UI_GFX_FONT_FALLBACK_LINUX_H_