mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move Fontconfig-specific code to a seperate file.
parent
f2294851e6
commit
63ed3f3575
|
@ -156,7 +156,6 @@ add_files(
|
||||||
fontcache.cpp
|
fontcache.cpp
|
||||||
fontcache.h
|
fontcache.h
|
||||||
fontcache_internal.h
|
fontcache_internal.h
|
||||||
fontdetection.cpp
|
|
||||||
fontdetection.h
|
fontdetection.h
|
||||||
framerate_gui.cpp
|
framerate_gui.cpp
|
||||||
framerate_type.h
|
framerate_type.h
|
||||||
|
|
|
@ -205,7 +205,6 @@ bool SpriteFontCache::GetDrawGlyphShadow()
|
||||||
|
|
||||||
/* static */ FontCache *FontCache::caches[FS_END] = { new SpriteFontCache(FS_NORMAL), new SpriteFontCache(FS_SMALL), new SpriteFontCache(FS_LARGE), new SpriteFontCache(FS_MONO) };
|
/* static */ FontCache *FontCache::caches[FS_END] = { new SpriteFontCache(FS_NORMAL), new SpriteFontCache(FS_SMALL), new SpriteFontCache(FS_LARGE), new SpriteFontCache(FS_MONO) };
|
||||||
|
|
||||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new TrueTypeFontCache.
|
* Create a new TrueTypeFontCache.
|
||||||
|
@ -678,13 +677,8 @@ const void *FreeTypeFontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* WITH_FREETYPE */
|
#endif /* WITH_FREETYPE */
|
||||||
|
|
||||||
#endif /* defined(WITH_FREETYPE) || defined(_WIN32) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Re)initialize the freetype related things, i.e. load the non-sprite fonts.
|
* (Re)initialize the freetype related things, i.e. load the non-sprite fonts.
|
||||||
|
@ -722,3 +716,12 @@ void UninitFreeType()
|
||||||
_library = nullptr;
|
_library = nullptr;
|
||||||
#endif /* WITH_FREETYPE */
|
#endif /* WITH_FREETYPE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG)
|
||||||
|
|
||||||
|
#ifdef WITH_FREETYPE
|
||||||
|
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) { return FT_Err_Cannot_Open_Resource; }
|
||||||
|
#endif /* WITH_FREETYPE */
|
||||||
|
|
||||||
|
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; }
|
||||||
|
#endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) */
|
||||||
|
|
|
@ -7,3 +7,8 @@ add_files(
|
||||||
unix.cpp
|
unix.cpp
|
||||||
CONDITION UNIX AND NOT OPTION_OS2
|
CONDITION UNIX AND NOT OPTION_OS2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_files(
|
||||||
|
font_unix.cpp
|
||||||
|
CONDITION Fontconfig_FOUND
|
||||||
|
)
|
||||||
|
|
|
@ -5,34 +5,26 @@
|
||||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file fontdetection.cpp Detection of the right font. */
|
/** @file font_unix.cpp Functions related to font handling on Unix/Fontconfig. */
|
||||||
|
|
||||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
#include "../../stdafx.h"
|
||||||
|
#include "../../debug.h"
|
||||||
#include "stdafx.h"
|
#include "../../fontdetection.h"
|
||||||
#include "debug.h"
|
#include "../../string_func.h"
|
||||||
#include "fontdetection.h"
|
#include "../../strings_func.h"
|
||||||
#include "string_func.h"
|
|
||||||
#include "strings_func.h"
|
|
||||||
|
|
||||||
#ifdef WITH_FREETYPE
|
|
||||||
extern FT_Library _library;
|
|
||||||
#endif /* WITH_FREETYPE */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the font loaded into a Freetype face by using a font-name.
|
|
||||||
* If no appropriate font is found, the function returns an error
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(WITH_FONTCONFIG) /* end ifdef __APPLE__ */
|
|
||||||
|
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/* ========================================================================================
|
#ifdef WITH_FREETYPE
|
||||||
* FontConfig (unix) support
|
|
||||||
* ======================================================================================== */
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
extern FT_Library _library;
|
||||||
|
|
||||||
|
|
||||||
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
||||||
{
|
{
|
||||||
FT_Error err = FT_Err_Cannot_Open_Resource;
|
FT_Error err = FT_Err_Cannot_Open_Resource;
|
||||||
|
@ -99,6 +91,9 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_FREETYPE */
|
||||||
|
|
||||||
|
|
||||||
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
|
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
|
||||||
{
|
{
|
||||||
if (!FcInit()) return false;
|
if (!FcInit()) return false;
|
||||||
|
@ -174,15 +169,3 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
||||||
FcFini();
|
FcFini();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* end ifdef WITH_FONTCONFIG */
|
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG)
|
|
||||||
|
|
||||||
#ifdef WITH_FREETYPE
|
|
||||||
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) {return FT_Err_Cannot_Open_Resource;}
|
|
||||||
#endif /* WITH_FREETYPE */
|
|
||||||
|
|
||||||
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; }
|
|
||||||
#endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) */
|
|
||||||
|
|
||||||
#endif /* WITH_FREETYPE */
|
|
Loading…
Reference in New Issue