OpenTTD Source: src/os/windows/font_win32.cpp File Reference

OpenTTD Source 14.0-beta3

Data Structures | Macros | Functions
font_win32.cpp File Reference
`#include "../../stdafx.h"`
`#include "../../debug.h"`
`#include "../../blitter/factory.hpp"`
`#include "../../core/alloc_func.hpp"`
`#include "../../core/math_func.hpp"`
`#include "../../core/mem_func.hpp"`
`#include "../../error_func.h"`
`#include "../../fileio_func.h"`
`#include "../../fontcache.h"`
`#include "../../fontcache/truetypefontcache.h"`
`#include "../../fontdetection.h"`
`#include "../../library_loader.h"`
`#include "../../string_func.h"`
`#include "../../strings_func.h"`
`#include "../../zoom_func.h"`
`#include "font_win32.h"`
`#include "../../table/control_codes.h"`
`#include <windows.h>`
`#include <shlobj.h>`
`#include "os/windows/win32.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | EFCParam

## Macros
#define | ANTIALIASED_QUALITY 4

## Functions
static int CALLBACK | EnumFontCallback (const ENUMLOGFONTEX *logfont, const NEWTEXTMETRICEX *metric, DWORD type, LPARAM lParam)
bool | SetFallbackFont (FontCacheSettings *settings, const std::string &, int winlangid, MissingGlyphSearcher *callback)
| We would like to have a fallback font as the current one doesn't contain all characters we need. More...
static bool | TryLoadFontFromFile (const std::string &font_name, LOGFONT &logfont)
static void | LoadWin32Font (FontSize fs, const LOGFONT &logfont, uint size, const char *font_name)
void | LoadWin32Font (FontSize fs)
| Loads the GDI font. More...
void | LoadWin32Font (FontSize fs, const std::string &file_name, uint size)
| Load a TrueType font from a file. More...

## Detailed Description

Functions related to font handling on Win32.

Definition in file font_win32.cpp.

## Function Documentation

## ◆ LoadWin32Font() [1/2]

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.

Parameters

  fs | The font size to load.

Definition at line 386 of file font_win32.cpp.

References FS_MONO, GetFontCacheSubSetting(), MemSetT(), and settings.

## ◆ LoadWin32Font() [2/2]

void LoadWin32Font | ( | FontSize | fs,
|  | const std::string & | file_name,
|  | uint | size
| ) |  |

Load a TrueType font from a file.

Parameters

  fs | The font size to load.
  file_name | Path to the font file.
  size | Requested font size.

Definition at line 423 of file font_win32.cpp.

References FS_MONO, and MemSetT().

## ◆ SetFallbackFont()

bool SetFallbackFont | ( | struct FontCacheSettings * | settings,
|  | const std::string & | 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.

Parameters

  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.

Returns
  true if a font has been set, false otherwise.

Definition at line 93 of file font_win32.cpp.

References Debug, and settings.