Skip to content

Commit f454146

Browse files
committed
stuff
1 parent 4d08353 commit f454146

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/irrlicht_changes/CGUITTFont.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@
3131
john@suckerfreegames.com
3232
*/
3333

34-
#include <cstdlib>
35-
#include <iostream>
36-
#include <optional>
34+
#include "CGUITTFont.h"
35+
3736
#include "irr_ptr.h"
3837
#include "log.h"
3938
#include "filesys.h"
4039
#include "debug.h"
41-
42-
#include "CGUITTFont.h"
4340
#include "IFileSystem.h"
4441
#include "IGUIEnvironment.h"
4542

43+
#include <cstdlib>
44+
#include <iostream>
45+
#include <optional>
46+
4647
namespace irr
4748
{
4849
namespace gui
@@ -52,13 +53,14 @@ std::map<io::path, SGUITTFace*> SGUITTFace::faces;
5253
std::optional<FT_Library> SGUITTFace::freetype_library;
5354
std::size_t SGUITTFace::n_faces;
5455

55-
std::optional<FT_Library> SGUITTFace::getFreeTypeLibrary()
56+
FT_Library SGUITTFace::getFreeTypeLibrary()
5657
{
5758
if (freetype_library) return *freetype_library;
5859
FT_Library ft;
5960
if (FT_Init_FreeType(&ft))
60-
return std::nullopt;
61-
return freetype_library = ft;
61+
FATAL_ERROR("initializing freetype failed");
62+
freetype_library = ft;
63+
return *freetype_library;
6264
}
6365

6466
SGUITTFace::SGUITTFace(std::string &&buffer) : face_buffer(std::move(buffer))
@@ -84,7 +86,7 @@ SGUITTFace* SGUITTFace::createFace(std::string &&buffer)
8486
irr_ptr<SGUITTFace> face(new SGUITTFace(std::move(buffer)));
8587
auto ft = getFreeTypeLibrary();
8688
if (!ft) return nullptr;
87-
return (FT_New_Memory_Face(*ft,
89+
return (FT_New_Memory_Face(ft,
8890
reinterpret_cast<const FT_Byte*>(face->face_buffer.data()),
8991
face->face_buffer.size(), 0, &face->face))
9092
? nullptr : face.release();

src/irrlicht_changes/CGUITTFont.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#pragma once
3535

3636
#include <ft2build.h>
37-
#include FT_FREETYPE_H
37+
#include <freetype/freetype.h>
3838

3939
#include "IGUIEnvironment.h"
4040
#include "IGUIFont.h"
@@ -59,7 +59,7 @@ namespace gui
5959
static std::optional<FT_Library> freetype_library;
6060
static std::size_t n_faces;
6161

62-
static std::optional<FT_Library> getFreeTypeLibrary();
62+
static FT_Library getFreeTypeLibrary();
6363

6464
public:
6565

0 commit comments

Comments
 (0)