Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit ae63015

Browse files
committed
fixup for zCFont
1 parent 707ff75 commit ae63015

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

zenload/zCFont.cpp

+1-9
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,8 @@
1010

1111
using namespace ZenLoad;
1212

13-
zCFont::zCFont(const std::string& fileName, const VDFS::FileIndex& fileIndex)
13+
zCFont::zCFont(const char *fileName, const VDFS::FileIndex& fileIndex)
1414
{
15-
std::string fntFile = fileName;
16-
std::transform(fntFile.begin(), fntFile.end(), fntFile.begin(), ::tolower);
17-
18-
if (fntFile.find(".tga") != std::string::npos)
19-
fntFile = fntFile.substr(0, fntFile.size() - 4) + ".FNT";
20-
else if (fntFile.find(".fnt") == std::string::npos)
21-
fntFile += ".FNT";
22-
2315
std::vector<uint8_t> data;
2416
fileIndex.getFileData(fileName, data);
2517

zenload/zCFont.h

+8-14
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,25 @@ namespace ZenLoad
2727
*/
2828
struct FontInfo
2929
{
30-
FontInfo()
31-
{
32-
fontHeight = 0;
33-
memset(glyphWidth, 0, sizeof(glyphWidth));
34-
}
35-
36-
std::string fontName; // Name of the font-file?
37-
uint32_t fontHeight; // Height of the glyphs
38-
uint8_t glyphWidth[FONT_NUM_MAX_LETTERS]; // Widths of the single glyphs
39-
ZMath::float2 fontUV1[FONT_NUM_MAX_LETTERS]; // Top-left corner
40-
ZMath::float2 fontUV2[FONT_NUM_MAX_LETTERS]; // Bottom-right corner
30+
std::string fontName; // Name of the font-file?
31+
uint32_t fontHeight=0; // Height of the glyphs
32+
uint8_t glyphWidth[FONT_NUM_MAX_LETTERS]={}; // Widths of the single glyphs
33+
ZMath::float2 fontUV1[FONT_NUM_MAX_LETTERS]={}; // Top-left corner
34+
ZMath::float2 fontUV2[FONT_NUM_MAX_LETTERS]={}; // Bottom-right corner
4135
};
4236

43-
zCFont(const std::string& fileName, const VDFS::FileIndex& fileIndex);
37+
zCFont(const char* fileName, const VDFS::FileIndex& fileIndex);
4438
virtual ~zCFont();
4539

4640
/**
4741
* @return Whether this font was correctly loaded
4842
*/
49-
bool isValid() { return m_Info.fontHeight != 0; }
43+
bool isValid() const { return m_Info.fontHeight != 0; }
5044

5145
/**
5246
* @return Information loaded from the font-file
5347
*/
54-
const FontInfo& getFontInfo() { return m_Info; }
48+
const FontInfo& getFontInfo() const { return m_Info; }
5549

5650
protected:
5751
/**

0 commit comments

Comments
 (0)