1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 13:37:10 +09:00
ladybird/Libraries/LibGfx/Font/GlobalFontConfig.cpp
blukai e356a4bd01 LibGfx: Rely on fontconfig(if enabled) for font directory resolution
this commit also introduces GlobalFontConfig class that is now
responsible for fontconfig initialization. it seems sane, even thought
FcInit's docs state that if the default configuration has already been
loaded, this routine does nothing.
2025-05-26 12:14:29 -06:00

38 lines
626 B
C++

/*
* Copyright (c) 2025, blukai <init1@protonmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Assertions.h>
#include <LibGfx/Font/GlobalFontConfig.h>
#include <fontconfig/fontconfig.h>
namespace Gfx {
GlobalFontConfig::GlobalFontConfig()
{
FcBool inited = FcInit();
VERIFY(inited);
m_config = FcConfigGetCurrent();
FcConfigReference(m_config);
}
GlobalFontConfig::~GlobalFontConfig()
{
FcConfigDestroy(m_config);
}
GlobalFontConfig& GlobalFontConfig::the()
{
static GlobalFontConfig s_the;
return s_the;
}
FcConfig* GlobalFontConfig::get()
{
return m_config;
}
}