#include "ui/gfx/linux/fontconfig_util.h"
#include <fontconfig/fontconfig.h>
#include "base/check_op.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "build/chromeos_buildflags.h"
#include "ui/gfx/font_render_params.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "base/check_deref.h"
#include "base/containers/flat_set.h"
#endif
namespace gfx {
namespace {
#if BUILDFLAG(IS_CHROMEOS)
constexpr base::FilePath::CharType kGoogleSansVariablePath[] =
FILE_PATH_LITERAL("/usr/share/fonts/google-sans/variable");
constexpr base::FilePath::CharType kGoogleSansStaticPath[] =
FILE_PATH_LITERAL("/usr/share/fonts/google-sans/static");
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr base::FilePath::CharType kImageloaderMountBase[] =
FILE_PATH_LITERAL("/run/imageloader/");
#endif
class GFX_EXPORT GlobalFontConfig { … };
FontRenderParams::Hinting ConvertFontconfigHintStyle(int hint_style) { … }
FontRenderParams::SubpixelRendering ConvertFontconfigRgba(int rgba) { … }
std::string GetFontConfigPropertyAsString(FcPattern* pattern,
const char* property) { … }
int GetFontConfigPropertyAsInt(FcPattern* pattern,
const char* property,
int default_value) { … }
bool GetFontConfigPropertyAsBool(FcPattern* pattern, const char* property) { … }
}
void InitializeGlobalFontConfigAsync() { … }
FcConfig* GetGlobalFontConfig() { … }
void OverrideGlobalFontConfigForTesting(FcConfig* config) { … }
std::string GetFontName(FcPattern* pattern) { … }
std::string GetFilename(FcPattern* pattern) { … }
base::FilePath GetFontPath(FcPattern* pattern) { … }
int GetFontTtcIndex(FcPattern* pattern) { … }
bool IsFontBold(FcPattern* pattern) { … }
bool IsFontItalic(FcPattern* pattern) { … }
bool IsFontScalable(FcPattern* pattern) { … }
std::string GetFontFormat(FcPattern* pattern) { … }
void GetFontRenderParamsFromFcPattern(FcPattern* pattern,
FontRenderParams* param_out) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
bool AddAppFontDir(const base::FilePath& dir) {
return CHECK_DEREF(GlobalFontConfig::GetInstance()).AddAppFontDir(dir);
}
#endif
}