font_fallback_linux.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifndef UI_GFX_FONT_FALLBACK_LINUX_H_
  5. #define UI_GFX_FONT_FALLBACK_LINUX_H_
  6. #include <string>
  7. #include "base/files/file_path.h"
  8. #include "third_party/icu/source/common/unicode/uchar.h"
  9. #include "ui/gfx/gfx_export.h"
  10. namespace gfx {
  11. // Exposed fallback font caches methods for testing.
  12. GFX_EXPORT size_t GetFallbackFontEntriesCacheSizeForTesting();
  13. GFX_EXPORT size_t GetFallbackFontListCacheSizeForTesting();
  14. GFX_EXPORT void ClearAllFontFallbackCachesForTesting();
  15. struct GFX_EXPORT FallbackFontData {
  16. std::string name;
  17. base::FilePath filepath;
  18. int fontconfig_interface_id = 0;
  19. int ttc_index = 0;
  20. bool is_bold = false;
  21. bool is_italic = false;
  22. FallbackFontData();
  23. FallbackFontData(const FallbackFontData& other);
  24. FallbackFontData& operator=(const FallbackFontData& other);
  25. };
  26. // Return a font family which provides a glyph for the Unicode code point
  27. // specified by character.
  28. // c: an UTF-32 code point
  29. // preferred_locale: preferred locale identifier for |c|
  30. // (e.g. "en", "ja", "zh-CN")
  31. //
  32. // Return whether the request was successful or not.
  33. GFX_EXPORT bool GetFallbackFontForChar(UChar32 c,
  34. const std::string& preferred_locale,
  35. FallbackFontData* fallback_font);
  36. } // namespace gfx
  37. #endif // UI_GFX_FONT_FALLBACK_LINUX_H_