mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Rename _library to _ft_library.
parent
b0d678e375
commit
e89be12ebb
|
@ -46,7 +46,7 @@ public:
|
||||||
const void *GetOSHandle() override { return &face; }
|
const void *GetOSHandle() override { return &face; }
|
||||||
};
|
};
|
||||||
|
|
||||||
FT_Library _library = nullptr;
|
FT_Library _ft_library = nullptr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,8 +163,8 @@ void LoadFreeTypeFont(FontSize fs)
|
||||||
std::string font = GetFontCacheFontName(fs);
|
std::string font = GetFontCacheFontName(fs);
|
||||||
if (font.empty()) return;
|
if (font.empty()) return;
|
||||||
|
|
||||||
if (_library == nullptr) {
|
if (_ft_library == nullptr) {
|
||||||
if (FT_Init_FreeType(&_library) != FT_Err_Ok) {
|
if (FT_Init_FreeType(&_ft_library) != FT_Err_Ok) {
|
||||||
ShowInfo("Unable to initialize FreeType, using sprite fonts instead");
|
ShowInfo("Unable to initialize FreeType, using sprite fonts instead");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -178,13 +178,13 @@ void LoadFreeTypeFont(FontSize fs)
|
||||||
/* If font is an absolute path to a ttf, try loading that first. */
|
/* If font is an absolute path to a ttf, try loading that first. */
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
if (settings->os_handle != nullptr) index = *static_cast<const int32_t *>(settings->os_handle);
|
if (settings->os_handle != nullptr) index = *static_cast<const int32_t *>(settings->os_handle);
|
||||||
FT_Error error = FT_New_Face(_library, font_name, index, &face);
|
FT_Error error = FT_New_Face(_ft_library, font_name, index, &face);
|
||||||
|
|
||||||
if (error != FT_Err_Ok) {
|
if (error != FT_Err_Ok) {
|
||||||
/* Check if font is a relative filename in one of our search-paths. */
|
/* Check if font is a relative filename in one of our search-paths. */
|
||||||
std::string full_font = FioFindFullPath(BASE_DIR, font_name);
|
std::string full_font = FioFindFullPath(BASE_DIR, font_name);
|
||||||
if (!full_font.empty()) {
|
if (!full_font.empty()) {
|
||||||
error = FT_New_Face(_library, full_font.c_str(), 0, &face);
|
error = FT_New_Face(_ft_library, full_font.c_str(), 0, &face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ GlyphID FreeTypeFontCache::MapCharToGlyph(char32_t key, bool allow_fallback)
|
||||||
*/
|
*/
|
||||||
void UninitFreeType()
|
void UninitFreeType()
|
||||||
{
|
{
|
||||||
FT_Done_FreeType(_library);
|
FT_Done_FreeType(_ft_library);
|
||||||
_library = nullptr;
|
_ft_library = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WITH_FONTCONFIG)
|
#if !defined(WITH_FONTCONFIG)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
extern FT_Library _library;
|
extern FT_Library _ft_library;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split the font name into the font family and style. These fields are separated by a comma,
|
* Split the font name into the font family and style. These fields are separated by a comma,
|
||||||
|
@ -85,7 +85,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
||||||
* wrongly a 'random' font, so check whether the family name is the
|
* wrongly a 'random' font, so check whether the family name is the
|
||||||
* same as the supplied name */
|
* same as the supplied name */
|
||||||
if (StrEqualsIgnoreCase(font_family, (char *)family)) {
|
if (StrEqualsIgnoreCase(font_family, (char *)family)) {
|
||||||
err = FT_New_Face(_library, (char *)file, index, face);
|
err = FT_New_Face(_ft_library, (char *)file, index, face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue