From 3df3a8523526470d982a6ffcb4fc0f6eccc951ad Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 16 Jan 2024 14:53:44 +0000 Subject: [PATCH] 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. --- .../Tools/CodeGenerators/GMLCompiler/main.cpp | 1 + .../FileManager/PropertiesWindow.cpp | 2 +- .../Applications/PixelPaint/Filters/Bloom.cpp | 2 +- Userland/Applications/Presenter/SlideObject.h | 4 +++- Userland/Libraries/LibGfx/Font/FontDatabase.h | 16 +------------ Userland/Libraries/LibGfx/Font/FontWeight.h | 24 +++++++++++++++++++ Userland/Libraries/LibWeb/CSS/StyleValue.cpp | 2 +- 7 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 Userland/Libraries/LibGfx/Font/FontWeight.h diff --git a/Meta/Lagom/Tools/CodeGenerators/GMLCompiler/main.cpp b/Meta/Lagom/Tools/CodeGenerators/GMLCompiler/main.cpp index 4e522e0636..4d82f027a6 100644 --- a/Meta/Lagom/Tools/CodeGenerators/GMLCompiler/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/GMLCompiler/main.cpp @@ -354,6 +354,7 @@ static ErrorOr generate_cpp(NonnullRefPtr gml, Lexica TRY(String::from_utf8(""sv)), TRY(String::from_utf8(""sv)), TRY(String::from_utf8(""sv)), + TRY(String::from_utf8(""sv)), // For Gfx::ColorRole TRY(String::from_utf8(""sv)), TRY(String::from_utf8(""sv)), diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 91db076fc6..51ae96fec5 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -34,8 +34,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/Userland/Applications/PixelPaint/Filters/Bloom.cpp b/Userland/Applications/PixelPaint/Filters/Bloom.cpp index fd66b0623a..0186049437 100644 --- a/Userland/Applications/PixelPaint/Filters/Bloom.cpp +++ b/Userland/Applications/PixelPaint/Filters/Bloom.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace PixelPaint::Filters { diff --git a/Userland/Applications/Presenter/SlideObject.h b/Userland/Applications/Presenter/SlideObject.h index cd12416e41..cc5c152bea 100644 --- a/Userland/Applications/Presenter/SlideObject.h +++ b/Userland/Applications/Presenter/SlideObject.h @@ -6,8 +6,10 @@ #pragma once +#include +#include #include -#include +#include #include class Presentation; diff --git a/Userland/Libraries/LibGfx/Font/FontDatabase.h b/Userland/Libraries/LibGfx/Font/FontDatabase.h index 50780de60e..4c4fc8f2b1 100644 --- a/Userland/Libraries/LibGfx/Font/FontDatabase.h +++ b/Userland/Libraries/LibGfx/Font/FontDatabase.h @@ -11,26 +11,12 @@ #include #include #include +#include #include #include 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(); diff --git a/Userland/Libraries/LibGfx/Font/FontWeight.h b/Userland/Libraries/LibGfx/Font/FontWeight.h new file mode 100644 index 0000000000..52839a6219 --- /dev/null +++ b/Userland/Libraries/LibGfx/Font/FontWeight.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2018-2020, Andreas Kling + * + * 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 +}; + +} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index 6e96b723f6..8ff0ce9f87 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -7,8 +7,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include +#include #include #include #include