blob: 9ac56eebdca37e425c1e24b5f1ce9e867a3b60c8 [file] [log] [blame]
jbromana48801c2016-04-06 17:48:171// 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 Bergeronb27aab52019-09-30 16:51:429#include <vector>
jbromana48801c2016-04-06 17:48:1710
Etienne Bergeronb27aab52019-09-30 16:51:4211#include "base/containers/mru_cache.h"
jbromana48801c2016-04-06 17:48:1712#include "third_party/icu/source/common/unicode/uchar.h"
Etienne Bergeronb27aab52019-09-30 16:51:4213#include "ui/gfx/font.h"
jbromana48801c2016-04-06 17:48:1714#include "ui/gfx/font_fallback.h"
15#include "ui/gfx/gfx_export.h"
16
17namespace gfx {
18
Etienne Bergeronb27aab52019-09-30 16:51:4219// The fallback cache is a mapping from a font family name to its potential
20// fallback fonts.
21using FallbackFontsCache = base::MRUCache<std::string, std::vector<Font>>;
22GFX_EXPORT FallbackFontsCache* GetFallbackFontsCacheInstance();
23
jbromana48801c2016-04-06 17:48:1724// 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.
34struct 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};
41GFX_EXPORT FallbackFontData
42GetFallbackFontForChar(UChar32 c, const std::string& preferred_locale);
43
44} // namespace gfx
45
46#endif // UI_GFX_FONT_FALLBACK_LINUX_H_