mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-09-09 07:27:05 +00:00
feat: T6 font_s dumper (#850)
* feat: T6 font dumper * feat: implement templated loader and writer for fonts in t6 --------- Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#options GAME (IW3, IW4, IW5, T4, T5)
|
||||
#options GAME (IW3, IW4, IW5, T4, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Font/FontDumper" + GAME + ".cpp"
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#define GAME_LOWER "t4"
|
||||
#elif GAME == "T5"
|
||||
#define GAME_LOWER "t5"
|
||||
#elif GAME == "T6"
|
||||
#define FEATURE_T6
|
||||
#define GAME_LOWER "t6"
|
||||
#endif
|
||||
|
||||
// This file was templated.
|
||||
@@ -57,9 +60,22 @@ namespace
|
||||
jGlyph.t1 = glyph.t1;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_T6
|
||||
void CreateJsonKerningPair(JsonKerningPair& jKerningPair, const KerningPairs& kerningPair)
|
||||
{
|
||||
jKerningPair.firstLetter = kerningPair.wFirst;
|
||||
jKerningPair.secondLetter = kerningPair.wSecond;
|
||||
jKerningPair.kernAmount = kerningPair.iKernAmount;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CreateJsonFont(JsonFont& jFont, const Font_s& font)
|
||||
{
|
||||
jFont.pixelHeight = font.pixelHeight;
|
||||
|
||||
#ifdef FEATURE_T6
|
||||
jFont.isScalingAllowed = font.isScalingAllowed;
|
||||
#endif
|
||||
|
||||
if (font.material && font.material->info.name)
|
||||
jFont.material = AssetName(font.material->info.name);
|
||||
@@ -73,6 +89,12 @@ namespace
|
||||
jFont.glyphs.resize(font.glyphCount);
|
||||
for (auto i = 0; i < font.glyphCount; i++)
|
||||
CreateJsonGlyph(jFont.glyphs[i], font.glyphs[i]);
|
||||
|
||||
#ifdef FEATURE_T6
|
||||
jFont.kerningPairs.resize(font.kerningPairsCount);
|
||||
for (auto i = 0; i < font.kerningPairsCount; i++)
|
||||
CreateJsonKerningPair(jFont.kerningPairs[i], font.kerningPairs[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
class Dumper
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#options GAME (IW3, IW4, IW5, T4, T5)
|
||||
#options GAME (IW3, IW4, IW5, T4, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Font/FontDumper" + GAME + ".h"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "ObjWriterT6.h"
|
||||
|
||||
#include "FontIcon/FontIconDumperT6.h"
|
||||
#include "Game/T6/Font/FontDumperT6.h"
|
||||
#include "Game/T6/Image/ImageDumperT6.h"
|
||||
#include "Game/T6/Material/MaterialJsonDumperT6.h"
|
||||
#include "Game/T6/Techset/TechsetDumperT6.h"
|
||||
@@ -55,7 +56,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
RegisterAssetDumper(std::make_unique<map_ents::DumperT6>());
|
||||
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
|
||||
RegisterAssetDumper(std::make_unique<light_def::DumperT6>());
|
||||
// REGISTER_DUMPER(AssetDumperFont, m_font)
|
||||
RegisterAssetDumper(std::make_unique<font::JsonDumperT6>());
|
||||
RegisterAssetDumper(font_icon::CreateDumperT6());
|
||||
// REGISTER_DUMPER(AssetDumperMenuList, m_menu_list)
|
||||
// REGISTER_DUMPER(AssetDumperMenuDef, m_menu_def)
|
||||
|
||||
Reference in New Issue
Block a user