frosch
25005cff16
Codefix: std::string_view::data() is not necessarily null terminated. ( #13891 )
2025-03-25 20:32:19 +01:00
Rubidium
2000cea235
Codechange: initialise instance members
2025-03-09 20:41:03 +01:00
Rubidium
02f040b22a
Codechange: remove unused alloc_func.hpp includes
2025-02-24 20:00:19 +01:00
Jonathan G Rennison
d06b371254
Cleanup: Fix various spelling errors
2025-02-12 22:44:51 +01:00
Jonathan G Rennison
23dc393822
Codechange: Compile fmt internals in a separate translation unit ( #13527 )
...
Instead of defining FMT_HEADER_ONLY to include fmt internals
in the headers included by all fmt-using translation units.
2025-02-11 20:11:50 +01:00
Patric Stout
86841ba1f0
Codechange: no longer add "src" to the include-path ( #13511 )
2025-02-09 19:43:15 +00:00
Peter Nelson
ba20ea5d18
Codechange: Use EnumBitSet for SpriteComponent. ( #13509 )
2025-02-09 18:37:01 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Loïc Guilloux
ef826a048a
Codechange: [WIN32] Use language isocode for fallback font detection ( #13310 )
2025-01-21 15:57:09 +01:00
Loïc Guilloux
4670a62342
Fix: [Win32] Font detection didn't work for locales not supporting code pages ( #13306 )
2025-01-12 17:23:41 +01:00
Peter Nelson
59680867c3
Codechange: Use structured bindings when iterating font_mapping.
2024-12-20 19:05:08 +00:00
Peter Nelson
c78e309b16
Codefix: Use snake_case instead of camelCase in layouters.
2024-12-20 19:05:08 +00:00
Valeri
5d8e98207d
Codechange: Use lowercase name for winnls.h ( #13170 )
...
Fixes cross-compilation under MXE.
2024-12-13 19:55:53 +01:00
Peter Nelson
fe0afef36f
Codechange: Use unique_ptr instead of raw pointer for string layouts. ( #13128 )
2024-11-27 23:38:57 +00:00
Peter Nelson
23e252ad40
Codechange: Replace FontMap's std::map with std::vector. ( #13126 )
2024-11-27 12:36:56 +00:00
Peter Nelson
876d53282e
Codechange: Use std::ranges::count(_if).
2024-11-24 10:36:03 +00:00
Peter Nelson
e98407973f
Fix #12993 : Replace known-bugs text with markdown version.
...
This allows a little bit better formatting/display in game.
(No attempt to check if these are still valid known-bugs...)
2024-10-22 00:34:16 +01:00
Jonathan G Rennison
6ca9ddcffa
Codefix: [Win32] String handling in OTTDStringCompare, Win32StringContains
...
Avoid truncation if CompareStringEx is missing
Fix handling of zero length inputs
2024-10-21 17:34:30 +02:00
Jonathan G Rennison
d7a2efd623
Codefix: [Win32] Truncated stack trace symbols were not null-terminated
...
SymGetSymFromAddr64/IMAGEHLP_SYMBOL64 do not null-terminate
symbols with lengths >= the name buffer size
2024-10-21 17:34:03 +02:00
Peter Nelson
e2a796dbcd
Codefix: Potential unterminated string returned from convert_to_fs.
...
Converting from UTF-8 to UTF-16 could have resulted in a buffer overflow if the buffer size was exactly the length of the converted string.
Pass string_view/span to convert_from/to_fs instead, and ensure the buffer is terminated. This replaces passing a pointer to the buffer and the buffer size as separate parameters, allowing the compiler to pass both in one parameter.
Removes use of `lengthof()`.
2024-07-10 20:57:02 +01:00
Peter Nelson
b37954722b
Codefix: Don't copy path string to itself.
...
When determining base paths on Windows the path is converted to UCS-16, and then copied into the same buffer.
2024-07-10 20:57:02 +01:00
Peter Nelson
6120165433
Fix #12839 : Truncated help text dialog on Windows. ( #12844 )
...
Replace fixed-length buffer message conversion with std::string.
2024-07-07 18:05:53 +01:00
glx22
b52f778f20
Codefix: [Win32] Use correct range for version in rc file
2024-06-26 23:02:27 +02:00
Peter Nelson
209b0320d5
Fix #12735 : Default fonts should use default font size as-is. ( #12814 )
...
Minimum readable font size should only apply to fallback and configured fonts.
2024-06-26 12:45:39 +01:00
Peter Nelson
b56775f576
Codechange: Avoid making copies of intermediate layout runs. ( #12796 )
...
The vector of runs is not used after it is passed to the ParagraphLayout class, so pass with std::move to avoid an unnecessary copy.
2024-06-17 22:58:52 +01:00
Peter Nelson
f9f07e9001
Fix #12775 : Text truncated incorrectly on Windows. ( #12782 )
...
Caused by a -1 in the wrong place, which moved glyphs left one pixel.
2024-06-14 16:32:31 +01:00
Peter Nelson
5cd81a980e
Codechange: Store both left and right glyph positions in a run.
...
This also allows the end of a run to be known without using an extra position entry.
2024-06-09 09:57:20 +01:00
Peter Nelson
bbbf2b5282
Codechange: Return read-only span instead of vector from layout run functions.
2024-06-09 09:57:20 +01:00
Peter Nelson
48539992e8
Codechange: Use std::unordered_map for storing TrueTypeFontCache's GlyphEntry.
2024-05-30 20:16:28 +01:00
Peter Nelson
7b717fcccb
Codechange: Replace AllocatorProc with SpriteAllocator class.
...
This allows for state to be passed to or maintained by the allocator.
2024-05-30 20:16:28 +01:00
Peter Nelson
3c42f701d7
Fix: Allow changing size of default OpenTTD font. ( #12641 )
...
* Fix: Allow changing size of default OpenTTD font.
Size configuration for default font was ignored as a different code path to load the font was followed.
Resolved by removing this additional path and conditionally selecting the default font.
2024-05-26 15:59:25 +01:00
Peter Nelson
f87c6990b0
Fix: Memory leak in CoreTextFontCache. ( #12662 )
...
Temporary buffer for rendering glyphs was not freed after use. Instead let CGBitmapContextCreate() handle the buffer.
> data may be a pointer to pixels. If you pass NULL, the context will create its own buffer and free that buffer itself later. If you pass your own buffer, the context will not free it; it remains your buffer that you must free after you release the context, hopefully for the last time.
2024-05-23 21:07:11 +01:00
Peter Nelson
3f5a354f37
Codechange: Use emplace with ICURun and UniscribeRun. ( #12693 )
2024-05-18 09:17:38 +01:00
Peter Nelson
c85481564f
Codechange: Use reusable temporary buffer in Win32FontCache. ( #12666 )
...
This avoids allocating and deleting a temporary buffer for every glyph that is rendered into a sprite.
2024-05-17 08:50:59 +01:00
Peter Nelson
ca52da6c95
Fix: Unable to choose a font containing hyphen. ( #12684 )
...
FcNameParse may require some characters be escaped. Instead, pass name as FC_FAMILY.
2024-05-16 00:38:23 +01:00
Peter Nelson
980dcaac6e
Cleanup: Remove GetFontTable from FontCache. ( #12677 )
...
This interface is no longer used, so does not need to be implemented.
Removes manual memory management with malloc/free.
2024-05-14 21:13:26 +01:00
Peter Nelson
d78f39a9df
Cleanup: Remove GetUnitsPerEM and units_per_em. ( #12656 )
...
GetUnitsPerEM is never called.
2024-05-11 14:50:34 +01:00
Peter Nelson
ec61951512
Cleanup: Remove Windows 9x font locale workaround. ( #12644 )
2024-05-09 07:03:02 +01:00
Peter Nelson
a1a01e21cf
Change: Use std::make_unique instead of passing new() ( #12539 )
2024-04-20 11:20:49 +01:00
Peter Nelson
a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. ( #12455 )
...
* Codechange: Replace C-style casts to size_t with static_cast.
This touches only simple value-type casts.
* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX
Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Peter Nelson
63ce81570c
Remove: Custom opendir implementation for Windows no longer needed.
...
std::filesystem::directory_iterator is now used instead.
2024-04-18 01:41:14 +01:00
Peter Nelson
d7c547d0db
Codechange: Use directory_iterator to list directories in file list windows.
...
This replaces use of custom ttd_opendir. Files are listed separately using ScanPath as that handles downloaded content.
2024-04-18 01:41:14 +01:00
Rubidium
eda10abc8c
Codechange: pass command line arguments as std::span to openttd_main
2024-04-11 21:57:53 +02:00
rubidium42
442daf58da
Codechange: replace lengthof with std::size in Windows specific code
2024-04-10 23:17:13 +02:00
Peter Nelson
3c94e81665
Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
...
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Loïc Guilloux
11aa3694fa
Fix: [Win32] Force font mapper to only use TrueType fonts ( #12406 )
2024-04-01 22:59:13 +02:00
Rubidium
caa7c44052
Cleanup: remove checks for old MSVC versions
2024-03-24 10:09:15 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Peter Nelson
466e6bb524
Fix #12037 : Blurry OpenTTD font on Mac OS. ( #12047 )
2024-02-09 21:36:13 +01:00
frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00