OpenTTD Source
1.11.0-beta2
|
#include "../../stdafx.h"
#include "../../debug.h"
#include "font_win32.h"
#include "../../blitter/factory.hpp"
#include "../../core/alloc_func.hpp"
#include "../../core/math_func.hpp"
#include "../../fileio_func.h"
#include "../../fontdetection.h"
#include "../../fontcache.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include "../../zoom_func.h"
#include "../../table/control_codes.h"
#include <windows.h>
#include <shlobj.h>
#include "os/windows/win32.h"
#include "safeguards.h"
#include <ft2build.h>
#include <FT_FREETYPE_H>
Go to the source code of this file.
Data Structures | |
class | FontList |
struct | EFCParam |
Macros | |
#define | ANTIALIASED_QUALITY 4 |
Functions | |
static const char * | GetShortPath (const wchar_t *long_path) |
Get the short DOS 8.3 format for paths. More... | |
FT_Error | GetFontByFaceName (const char *font_name, FT_Face *face) |
Load a freetype font face with the given font name. More... | |
static const char * | GetEnglishFontName (const ENUMLOGFONTEX *logfont) |
Fonts can have localised names and when the system locale is the same as one of those localised names Windows will always return that localised name instead of allowing to get the non-localised (English US) name of the font. More... | |
static int CALLBACK | EnumFontCallback (const ENUMLOGFONTEX *logfont, const NEWTEXTMETRICEX *metric, DWORD type, LPARAM lParam) |
bool | SetFallbackFont (FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) |
We would like to have a fallback font as the current one doesn't contain all characters we need. More... | |
void | LoadWin32Font (FontSize fs) |
Loads the GDI font. More... | |
Variables | |
FT_Library | _library |
static const wchar_t * | FONT_DIR_NT = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" |
Functions related to font handling on Win32.
Definition in file font_win32.cpp.
|
static |
Fonts can have localised names and when the system locale is the same as one of those localised names Windows will always return that localised name instead of allowing to get the non-localised (English US) name of the font.
This will later on give problems as freetype uses the non-localised name of the font and we need to compare based on that name. Windows furthermore DOES NOT have an API to get the non-localised name nor can we override the system locale. This means that we have to actually read the font itself to gather the font name we want. Based on: http://blogs.msdn.com/michkap/archive/2006/02/13/530814.aspx
logfont | the font information to get the english name of. |
Definition at line 164 of file font_win32.cpp.
FT_Error GetFontByFaceName | ( | const char * | font_name, |
FT_Face * | face | ||
) |
Load a freetype font face with the given font name.
font_name | The name of the font to load. |
face | The face that has been found. |
Definition at line 67 of file font_win32.cpp.
|
static |
Get the short DOS 8.3 format for paths.
FreeType doesn't support Unicode filenames and Windows' fopen (as used by FreeType) doesn't support UTF-8 filenames. So we have to convert the filename into something that isn't UTF-8 but represents the Unicode file name. This is the short DOS 8.3 format. This does not contain any characters that fopen doesn't support.
long_path | the path in system encoding. |
Definition at line 49 of file font_win32.cpp.
void LoadWin32Font | ( | FontSize | fs | ) |
Loads the GDI font.
If a GDI font description is present, e.g. from the automatic font fallback search, use it. Otherwise, try to resolve it by font name.
fs | The font size to load. |
Definition at line 577 of file font_win32.cpp.
bool SetFallbackFont | ( | struct FreeTypeSettings * | settings, |
const char * | language_isocode, | ||
int | winlangid, | ||
class MissingGlyphSearcher * | callback | ||
) |
We would like to have a fallback font as the current one doesn't contain all characters we need.
This function must set all fonts of settings.
settings | the settings to overwrite the fontname of. |
language_isocode | the language, e.g. en_GB. |
winlangid | the language ID windows style. |
callback | The function to call to check for missing glyphs. |
Definition at line 341 of file font_win32.cpp.