Commit Graph

173 Commits

Author SHA1 Message Date
PeterN eda3defcb5
Codechange: Pass language for font detection as std::string. (#10964) 2023-06-06 20:55:56 +00:00
Peter Nelson f454ec8d63 Fix: Don't rely on static initialization to set up sprite font caches.
The order of static initialization is undefined, so this can cause initalization
before relevant caches are initializations.
2023-05-18 12:18:30 +01:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
glx22 04ee86d3ac Add: 'font' console command to configure fonts 2022-12-23 23:23:03 +01:00
glx22 af3df959c2 Codechange: reduce code duplication 2022-12-23 23:23:03 +01:00
Peter Nelson 2cdd8b7429 Change: Separate fontcache implementations. 2022-09-25 18:34:24 +01:00
Peter Nelson f6ad8e1c9c Change: Rename some freetype things to fontcache.
The font cache supports more than just FreeType as a font provider, but still used freetype in some naming.

This now uses more suitable terms.
2022-09-25 18:34:24 +01:00
Rubidium 0d0375c019 Remove: logically dead code from font cache
The outer if statement checks for 'aa' being false, so within the inner
statements anything checking aa will have a known result and the other
branch from there will be dead code.
2021-07-10 11:27:09 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
rubidium42 77330d09fd Codechange: move font settings to std::string 2021-05-13 23:13:17 +02:00
Rubidium 7755f81bb8 Codechange: make explicit that virtual functions in a con/destructor are resolved statically
This as during construction the sub class has not been initialized yet, and
during destruction the sub class has already been destroyed, so the overriding
virtual function would be accessing uninitialized data.
2021-05-13 10:03:26 +02:00
Peter Nelson 9c6c0a0966 Codechange: Scale sprite font height once on init instead of every call to GetHeight().
Scaling is not expensive, but it does not change either, and this avoids the need for a virtual method call. This cascades back to all GetCharacterHeight(FS_xxx) and FONT_HEIGHT_xxx calls.
2021-05-01 10:41:39 +01:00
Peter Nelson ce55cd0ce7 Cleanup: Use GetDefaultFontHeight() call instead of direct access.
This makes this part of font size setup in FreeTypeFontCache consist with OSX and Windows variants.
2021-05-01 10:41:39 +01:00
Michael Lutz 46e13313e4 Fix #8731: Always use a 32bpp blitter if font anti-aliasing is enabled. 2021-02-23 22:15:03 +01:00
Michael Lutz 6776229047 Codechange: Make the simple Malloc sprite allocator globally usable. 2021-02-22 22:16:07 +01:00
Michael Lutz 70aa3b4011 Codechange: Give sprite encoders a hint which colour components of a sprite are filled with useful information. 2021-02-22 22:16:07 +01:00
Michael Lutz 6755ff63e1 Add: [OSX] Native font rendering without using FreeType. 2021-02-14 11:48:58 +01:00
Michael Lutz 21a2cd7bc3 Codechange: Replace magic numbers by constants. 2021-02-14 11:48:58 +01:00
Michael Lutz 63ed3f3575 Codechange: Move Fontconfig-specific code to a seperate file. 2021-02-13 20:09:14 +01:00
Michael Lutz c6af8f16f6 Codechange: [Win32] Move Win32-specific font code to a seperate file. 2021-02-13 20:09:14 +01:00
Michael Lutz 5ad1640984 Codechange: Make OS font handle of the FontCache read-only. 2021-02-13 20:09:14 +01:00
SamuXarick a4035af337
Codechange: Apply coding style (#8640)
* Fix: Missing or needed spaces

* Codechange: Remove space

* Codechange: Remove space

* Codechange: More missing spaces

* Codechange: Missing spaces

* Codechange: Remove space

* Codechange: Remove space
2021-02-05 11:00:36 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 8c24b2b6ce Fix: [OSX] Fonts loaded directly from a file have to be registered with CoreText for proper text layout. 2021-01-03 01:00:28 +01:00
Patric Stout 4bd3d18f34 Add: use our search-paths to find fonts based on relative filenames too
This allows "small_font = ./myfont.ttf", with "myfont.ttf" located
in "~/.openttd".
2021-01-02 23:44:37 +01:00
Patric Stout d15dc9f40f Add: support for emscripten (play-OpenTTD-in-the-browser)
Emscripten compiles to WASM, which can be loaded via
HTML / JavaScript. This allows you to play OpenTTD inside a
browser.

Co-authored-by: milek7 <me@milek7.pl>
2020-12-15 15:46:39 +01:00
Michael Lutz 808c8198d5 Codechange: Consistently use WChar when passing characters around, and also define it as char32_t. 2020-05-21 20:02:34 +02:00
Michael Lutz f2b40f40aa Codechange: Replace SmallPair with std::pair.
std::pair is already the smallest possible pair, and it already handles non-POD types correctly.
2020-05-21 20:02:34 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Michael Lutz eeccfa2570 Add: [Win32] Support for loading fonts from a file for the GDI font renderer. 2019-05-14 11:21:36 +01:00
Michael Lutz d2ed426077 Codechange: [Win32] Pass a native GDI font description around when we have one, instead of repeatedly guessing the font. 2019-05-14 11:21:36 +01:00
Michael Lutz 2675762ae9 Add: [Win32] GDI engine for font glyph rendering as a replacement for including FreeType.
Building with FreeType is still possible and will take precedence over the GDI renderer, but
the project files don't include FreeType anymore by default. Combining GDI rendering with ICU
text layout is untested.
2019-05-14 11:21:36 +01:00
Michael Lutz a8b6e9f23c Codechange: Refactor the Freetype font cache into a generic part that does not depend on Freetype and into one that does.
This makes it easier to add other TrueType font rendering engines.
2019-05-14 11:21:36 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
PeterN 195fd0dc60
Fix #7266: Reorder reinitialization of caches when changing font zoom level. (#7273) 2019-02-24 16:27:44 +00:00
PeterN eeae4512ae
Fix #7003: Freetype fonts were scaled by both GUI and Font zoom levels. (#7267) 2019-02-23 16:07:25 +00:00
Greg Carlin 00d28a500d Feature: Add option to adjust font size separately from GUI size. (#7003)
Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad.
2019-02-23 08:27:46 +00:00
glx 1623cb553b Fix #7032: use the same mode to load and render glyphs 2019-01-17 21:56:12 +00:00
Michael Lutz 32ce1ce347 Add: [OSX] Text layout using the native CoreText API.
By default, the native API will be used instead of ICU, but if ICU is
forced in using configure, it will take precedence.
2018-12-08 20:13:27 +01:00
Michael Lutz ae467ffc8a Fix: Scale default FreeType font size selection by UI zoom level. 2018-06-17 12:59:59 +02:00
Michael Lutz 768a31bfe3 Add: [Win32] Text layout using the native Windows Uniscribe library.
Uniscribe is sometimes producing different results compared to ICU, especially
when RTL and LTR content is mixed. Comparing the results to other programs
(like editors or web browsers) leads me to believe that the result are at least
not worse than ICU and possibly better.
2018-06-06 21:37:09 +02:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch 64c5f00429 (svn r27888) -Fix: Member access coding style (adf88) 2017-07-11 19:34:41 +00:00
peter1138 08fe8459c3 (svn r27859) -Revert (r27858): Committed too much :( 2017-04-23 09:20:53 +00:00
peter1138 c973f65acb (svn r27858) -Change [FS#6560]: Add missing game script event for ships arriving at a station. (juanjo) 2017-04-23 09:19:32 +00:00
frosch bed0370ad1 (svn r27187) -Fix: Code style. 2015-03-15 12:19:58 +00:00
frosch a8080b6256 (svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad(). 2015-02-01 20:54:24 +00:00
planetmaker 24fec6da12 (svn r27079) -Fix: Compilation with freetype2 version 2.5.4 and newer (AMDmi3) 2014-12-11 12:25:53 +00:00