LibGfx+Userland: Move FontWeight enum into its own file

FontDatabase.h with its includes add up to quite a lot of code. In the
next commit, compiled GML files are going to need to access the
FontWeight enum, so let's allow them to do that without pulling in lots
of other things.

Also, change users to include FontWeight.h instead of FontDatabase.h
where appropriate.
This commit is contained in:
Sam Atkins 2024-01-16 14:53:44 +00:00 committed by Tim Flynn
parent 9b3f9c46b9
commit 3df3a85235
7 changed files with 32 additions and 19 deletions

View file

@ -354,6 +354,7 @@ static ErrorOr<String> generate_cpp(NonnullRefPtr<GUI::GML::GMLFile> gml, Lexica
TRY(String::from_utf8("<AK/JsonValue.h>"sv)),
TRY(String::from_utf8("<AK/NonnullRefPtr.h>"sv)),
TRY(String::from_utf8("<AK/RefPtr.h>"sv)),
TRY(String::from_utf8("<LibGfx/Font/FontWeight.h>"sv)),
// For Gfx::ColorRole
TRY(String::from_utf8("<LibGfx/SystemTheme.h>"sv)),
TRY(String::from_utf8("<LibGUI/Widget.h>"sv)),

View file

@ -34,8 +34,8 @@
#include <LibGUI/SeparatorWidget.h>
#include <LibGUI/TabWidget.h>
#include <LibGfx/Font/BitmapFont.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/FontStyleMapping.h>
#include <LibGfx/Font/FontWeight.h>
#include <LibGfx/Font/OpenType/Font.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/Font/WOFF/Font.h>

View file

@ -12,7 +12,7 @@
#include <LibGfx/BitmapMixer.h>
#include <LibGfx/Filters/FastBoxBlurFilter.h>
#include <LibGfx/Filters/LumaFilter.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/FontWeight.h>
namespace PixelPaint::Filters {

View file

@ -6,8 +6,10 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/HashMap.h>
#include <LibGfx/Color.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/FontWeight.h>
#include <LibGfx/Rect.h>
class Presentation;

View file

@ -11,26 +11,12 @@
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <LibGfx/Font/FontWeight.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/Forward.h>
namespace Gfx {
namespace FontWeight {
enum {
Thin = 100,
ExtraLight = 200,
Light = 300,
Regular = 400,
Medium = 500,
SemiBold = 600,
Bold = 700,
ExtraBold = 800,
Black = 900,
ExtraBlack = 950
};
}
class FontDatabase {
public:
static FontDatabase& the();

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace Gfx::FontWeight {
enum {
Thin = 100,
ExtraLight = 200,
Light = 300,
Regular = 400,
Medium = 500,
SemiBold = 600,
Bold = 700,
ExtraBold = 800,
Black = 900,
ExtraBlack = 950
};
}

View file

@ -7,8 +7,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/FontStyleMapping.h>
#include <LibGfx/Font/FontWeight.h>
#include <LibWeb/CSS/StyleValue.h>
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>