mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
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.
38 lines
626 B
C++
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;
|
|
}
|
|
|
|
}
|