This repository was archived by the owner on Dec 10, 2022. It is now read-only.
File tree 2 files changed +9
-23
lines changed
2 files changed +9
-23
lines changed Original file line number Diff line number Diff line change 10
10
11
11
using namespace ZenLoad ;
12
12
13
- zCFont::zCFont (const std::string& fileName, const VDFS::FileIndex& fileIndex)
13
+ zCFont::zCFont (const char * fileName, const VDFS::FileIndex& fileIndex)
14
14
{
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
-
23
15
std::vector<uint8_t > data;
24
16
fileIndex.getFileData (fileName, data);
25
17
Original file line number Diff line number Diff line change @@ -27,31 +27,25 @@ namespace ZenLoad
27
27
*/
28
28
struct FontInfo
29
29
{
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
41
35
};
42
36
43
- zCFont (const std::string& fileName, const VDFS::FileIndex& fileIndex);
37
+ zCFont (const char * fileName, const VDFS::FileIndex& fileIndex);
44
38
virtual ~zCFont ();
45
39
46
40
/* *
47
41
* @return Whether this font was correctly loaded
48
42
*/
49
- bool isValid () { return m_Info.fontHeight != 0 ; }
43
+ bool isValid () const { return m_Info.fontHeight != 0 ; }
50
44
51
45
/* *
52
46
* @return Information loaded from the font-file
53
47
*/
54
- const FontInfo& getFontInfo () { return m_Info; }
48
+ const FontInfo& getFontInfo () const { return m_Info; }
55
49
56
50
protected:
57
51
/* *
You can’t perform that action at this time.
0 commit comments