Fix #10490: Allow ships to exit depots if another is not moving at the exit point...
[openttd-github.git] / src / os / windows / font_win32.h
blobbdb2cc9a9bd55b231cf3b4182e4204d6059f65ef
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * 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/>.
6 */
8 /** @file font_win32.h Functions related to font handling on Win32. */
10 #ifndef FONT_WIN32_H
11 #define FONT_WIN32_H
13 #include "../../fontcache/truetypefontcache.h"
14 #include "win32.h"
16 #include <windows.h>
18 /** Font cache for fonts that are based on a Win32 font. */
19 class Win32FontCache : public TrueTypeFontCache {
20 private:
21 LOGFONT logfont; ///< Logical font information for selecting the font face.
22 HFONT font = nullptr; ///< The font face associated with this font.
23 HDC dc = nullptr; ///< Cached GDI device context.
24 HGDIOBJ old_font; ///< Old font selected into the GDI context.
25 SIZE glyph_size; ///< Maximum size of regular glyphs.
26 std::string fontname; ///< Cached copy of loaded font facename
28 void SetFontSize(int pixels);
30 protected:
31 const void *InternalGetFontTable(uint32_t tag, size_t &length) override;
32 const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
34 public:
35 Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels);
36 ~Win32FontCache();
37 void ClearFontCache() override;
38 GlyphID MapCharToGlyph(char32_t key, bool allow_fallback = true) override;
39 std::string GetFontName() override { return this->fontname; }
40 const void *GetOSHandle() override { return &this->logfont; }
43 void LoadWin32Font(FontSize fs);
44 void LoadWin32Font(FontSize fs, const std::string &file_name, uint size);
46 #endif /* FONT_WIN32_H */