Skip to content

Commit eb6ddc0

Browse files
committed
add FontResource
1 parent d8c4a4d commit eb6ddc0

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

include/gf2/core/FontResource.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: Zlib
2+
// Copyright (c) 2023-2025 Julien Bernard
3+
#ifndef GF_FONT_RESOURCE_H
4+
#define GF_FONT_RESOURCE_H
5+
6+
#include <filesystem>
7+
8+
#include "CoreApi.h"
9+
#include "TypeTraits.h"
10+
11+
namespace gf {
12+
13+
struct GF_CORE_API FontResource {
14+
std::filesystem::path path;
15+
};
16+
17+
template<typename Archive>
18+
inline Archive& operator|(Archive& ar, MaybeConst<FontResource, Archive>& resource)
19+
{
20+
return ar | resource.path;
21+
}
22+
23+
}
24+
25+
#endif // GF_FONT_RESOURCE_H

include/gf2/framework/BundleBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace gf {
2020
struct AudioSourceResource;
2121
struct ConsoleResource;
2222
struct ConsoleData;
23+
struct FontResource;
2324
struct NinePatchResource;
2425
struct RichMapResource;
2526
struct RichTextResource;
@@ -41,6 +42,7 @@ namespace gf {
4142
void add_in_bundle(const TextResource& resource);
4243

4344
void add_in_bundle(const ConsoleResource& resource);
45+
void add_in_bundle(const FontResource& resource);
4446

4547
void add_raw_texture(const std::filesystem::path& path);
4648
void add_raw_font(const std::filesystem::path& path);

library/core/FontResource.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// SPDX-License-Identifier: Zlib
2+
// Copyright (c) 2023-2025 Julien Bernard
3+
4+
#include <gf2/core/FontResource.h>

library/framework/BundleBuilder.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <gf2/core/AudioSourceData.h>
88
#include <gf2/core/ConsoleData.h>
99
#include <gf2/core/FontFace.h>
10+
#include <gf2/core/FontResource.h>
1011
#include <gf2/core/NinePatchData.h>
1112
#include <gf2/core/RichMapResource.h>
1213
#include <gf2/core/SpriteData.h>
@@ -64,6 +65,11 @@ namespace gf {
6465
add_raw_console_font(resource.console_font, resource.data);
6566
}
6667

68+
void BundleBuilder::add_in_bundle(const FontResource& resource)
69+
{
70+
add_raw_font(resource.path);
71+
}
72+
6773
void BundleBuilder::add_in_bundle(const NinePatchResource& resource)
6874
{
6975
add_raw_texture(resource.texture);

0 commit comments

Comments
 (0)