From f4541464102d23c16fe0a15981f8463aaf6d8425 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Fri, 10 Jan 2025 03:11:25 +0100 Subject: [PATCH] stuff --- src/irrlicht_changes/CGUITTFont.cpp | 20 +++++++++++--------- src/irrlicht_changes/CGUITTFont.h | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/irrlicht_changes/CGUITTFont.cpp b/src/irrlicht_changes/CGUITTFont.cpp index d224656202839..e5ff6d5f04a15 100644 --- a/src/irrlicht_changes/CGUITTFont.cpp +++ b/src/irrlicht_changes/CGUITTFont.cpp @@ -31,18 +31,19 @@ john@suckerfreegames.com */ -#include -#include -#include +#include "CGUITTFont.h" + #include "irr_ptr.h" #include "log.h" #include "filesys.h" #include "debug.h" - -#include "CGUITTFont.h" #include "IFileSystem.h" #include "IGUIEnvironment.h" +#include +#include +#include + namespace irr { namespace gui @@ -52,13 +53,14 @@ std::map SGUITTFace::faces; std::optional SGUITTFace::freetype_library; std::size_t SGUITTFace::n_faces; -std::optional SGUITTFace::getFreeTypeLibrary() +FT_Library SGUITTFace::getFreeTypeLibrary() { if (freetype_library) return *freetype_library; FT_Library ft; if (FT_Init_FreeType(&ft)) - return std::nullopt; - return freetype_library = ft; + FATAL_ERROR("initializing freetype failed"); + freetype_library = ft; + return *freetype_library; } SGUITTFace::SGUITTFace(std::string &&buffer) : face_buffer(std::move(buffer)) @@ -84,7 +86,7 @@ SGUITTFace* SGUITTFace::createFace(std::string &&buffer) irr_ptr face(new SGUITTFace(std::move(buffer))); auto ft = getFreeTypeLibrary(); if (!ft) return nullptr; - return (FT_New_Memory_Face(*ft, + return (FT_New_Memory_Face(ft, reinterpret_cast(face->face_buffer.data()), face->face_buffer.size(), 0, &face->face)) ? nullptr : face.release(); diff --git a/src/irrlicht_changes/CGUITTFont.h b/src/irrlicht_changes/CGUITTFont.h index 7e525895c9f40..671bc38e0ae12 100644 --- a/src/irrlicht_changes/CGUITTFont.h +++ b/src/irrlicht_changes/CGUITTFont.h @@ -34,7 +34,7 @@ #pragma once #include -#include FT_FREETYPE_H +#include #include "IGUIEnvironment.h" #include "IGUIFont.h" @@ -59,7 +59,7 @@ namespace gui static std::optional freetype_library; static std::size_t n_faces; - static std::optional getFreeTypeLibrary(); + static FT_Library getFreeTypeLibrary(); public: