Aaron van Geffen
c08541efc7
Remove gCommonStringFormatBuffer, CommonTextBufferSize
2024-07-13 13:25:55 +02:00
Aaron van Geffen
039d0ef1a7
Move CSChar and UnicodeChar namespaces to their own headers
2024-07-12 23:02:31 +02:00
Aaron van Geffen
b5ef2693b0
Remove common.h include from all units
2024-07-09 16:45:19 +02:00
Aaron van Geffen
51bcbe3710
Move UTF8 functions from localisation into core ( #22278 )
2024-07-12 19:21:15 +03:00
Gymnasiast
8a181b5513
Split colours and colour flags
2024-05-26 12:35:40 +02:00
Aaron van Geffen
a63d86c488
Introduce Config namespace and struct
2024-05-10 12:10:21 +02:00
Harry Hopkinson
98ac3a1bbc
Replace GfxDrawString() with DrawText()
2024-05-10 09:56:03 +00:00
Michał Janiszewski
7b12667ddb
Reduce <algorithm> include ( #21947 )
2024-05-01 13:47:27 +02:00
mrmbernardi
d48b75fb86
Refactor TTF drawing ( #21621 )
2024-03-28 23:28:54 +01:00
Harry Hopkinson
78d95fc0bd
Pass DrawPixelInfo by reference ( #21563 )
2024-03-10 12:00:08 -03:00
Ota
e9b214282d
Fix #21039 : Text rendering bleeds pixels through windows
...
Should fix [#21039 ](https://github.com/OpenRCT2/OpenRCT2/issues/21039 ).
As it is explained in the issue, the outline and inset code would not respect the DPI bounds in the drawing process by accessing e.g. `*(dst + 1)` to draw an outline, in this case to the right.
#### Approach
I approached this issue by creating a function `GetPixel()` in `TTFSurface` that would return a value if the given x and y coordinates is a part of a TTF text, else 0.
In the for loop, iterating through the TTF text, the if condition
```
if (surface->GetPixel(xx + srcX_start + 1, yy + srcY_start)
|| surface->GetPixel(xx + srcX_start - 1, yy + srcY_start)
|| surface->GetPixel(xx + srcX_start, yy + srcY_start + 1)
|| surface->GetPixel(xx + srcX_start, yy + srcY_start - 1))
```
checks if the coordinates **(xx, yy)** is an outline of a text. the writing bounds. Adding `srcX_start`, which is 0 or `-skipX` if `skipX < 0`, when calling `GetPixel()`, would shift the pixel access to the correct position, where the text begins on the surface. The same is done for the Y axis. (Not having this would lead to the outlines/insets not moving with the text when the window with the TTF text moves)
2024-02-17 23:31:07 +01:00
James103
1d8dc111f1
Replace 2023 with 2024 in copyright headers ( #21139 )
...
Replace all instances of the year 2023 with 2024 in all copyright headers
2024-01-01 12:52:28 +01:00
Michael Bernardi
8c7d1d149a
Added OpenGL TTF hinting
2023-12-08 01:13:17 +01:00
Michael Bernardi
f64706e1d9
Add insetting and outlining to OpenGL TTF rendering
2023-12-08 01:13:17 +01:00
ζeh Matt
39458a3df3
Refactor ShortenPath
2023-08-10 14:39:38 +03:00
Gymnasiast
9c2d5b9fef
Make GfxDrawSprite() take reference
2023-04-11 22:53:30 +01:00
Michał Janiszewski
470d02572d
Fix #17371 : GCC regression with -Wmaybe-uninitialized ( #19810 )
...
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937 was reported for
GCC12 and fixed in GCC13 (not yet released).
Leave the suppresions in place until we can get rid of GCC12
2023-04-03 16:09:41 +02:00
Gymnasiast
a15f72da87
Pass DPI by ref to string drawing
2023-02-24 22:05:07 +01:00
Silent
0763fd5a78
Fix GfxWrapString potentially corrupting the in/out buffer
...
Fixes a consistent assertion when displaying "Cannot start construction"
in Japanese, but it has potential fix countless other crashes
related to string wrapping/display.
2023-02-14 09:50:05 +01:00
Duncan
859b071ddc
Rename classes with snakes OpenRCT2/A*-F* ( #19215 )
...
* Rename classes with snakes OpenRCT2/A*-F*
* Clang format files
2023-01-19 08:16:44 +00:00
Hielke Morsink
0762fcb601
Rename snake_case functions in OpenRCT2/util folder
2023-01-18 22:44:13 +01:00
Michael Steenbeek
12874f2af7
Replace format_string(4) with OpenRCT2::FormatStringLegacy() ( #19190 )
...
Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk >
2023-01-17 21:56:30 +01:00
Michael Steenbeek
b4480b344e
Rename snake_case functions from localisation folder
2023-01-16 23:12:35 +00:00
Duncan
8504c8d05e
Finish Removing snake_case from Drawing Methods
2023-01-16 22:31:34 +00:00
Gymnasiast
5309c80e29
Remove snake_case in interface folder
2023-01-16 22:20:41 +01:00
Duncan
7f5934cc95
Remove snake_case from second chunk of Drawing ( #19166 )
2023-01-16 18:52:17 +00:00
James103
73738bbdc8
Replace 2022 with 2023 in copyright headers
...
Replace all instances of the year 2022 with 2023 in all copyright headers
2023-01-01 11:58:01 +01:00
Michael Steenbeek
96284123e7
Reduce usage of gCommonStringFormatBuffer
2022-11-14 23:48:34 +00:00
Gymnasiast
14f9a75e0a
Refactor FontSpriteBase and font size into FontStyle
2022-10-19 11:59:26 +02:00
Gymnasiast
9ca9412205
Refactor Dark/ExtraDark into its own structure
2022-10-19 11:57:33 +02:00
Hielke Morsink
0ca7bb058f
Rename public font config data members
2022-10-16 21:46:07 +02:00
Michael Steenbeek
6fe19878f6
More ImageId cleanup ( #18258 )
...
* Remove more usages of uint32 image indices
* Remove unused gfx_get_sprite_size()
* Remove uint32 images from text drawing
* Remove now-unused ImageId overload
* Default-initialise ttfRunIndex
* Suppress false-alarm GCC error
2022-10-10 19:42:40 +01:00
73
b9e677945d
Replace 20XX with 2022 ( #18158 )
...
* Replace 2020 with 2022
Replace all 2020 headers with 2022
* replace other years with 2022
add missing years
2022-10-01 08:42:14 +01:00
Gymnasiast
cedccf9b0e
Use const ImageId in drawing functions
2022-09-29 21:17:15 +02:00
Gymnasiast
d3fd31c611
Rename rct_string_id to StringId
2022-07-31 22:30:13 +02:00
Michał Janiszewski
575bae7ac4
Rename global variable text_palette -> gTextPalette ( #17647 )
2022-07-30 23:21:34 +02:00
Hielke Morsink
218030dcd9
Add missing emojis that have inline sprites
2022-05-02 22:07:10 +02:00
Ted John
561dd13330
Limit inline sprites to <= 32x32 ( #16991 )
...
This is to prevent abuse of the feature in the master server list.
2022-04-23 14:36:49 +01:00
Michael Steenbeek
5edc561715
Close #11437 : Migrate old platform methods
2022-02-18 21:57:00 +01:00
Michał Janiszewski
7b0e6ad0b6
Reformat with clang-format-12 from updated CI image
2021-12-12 17:48:52 +01:00
ζeh Matt
a0e7752f26
Pass rct_drawpixelinfo explicit to avoid races
2021-10-06 23:48:07 +03:00
Hielke Morsink
94144bcd89
Remove some dead code
...
Reported by clang
clang-analyzer-deadcode.DeadStores
2021-09-30 10:40:32 +02:00
Hielke Morsink
4b4b3333d6
Remove unnecessary else blocks
2021-09-16 18:31:12 +02:00
ζeh Matt
59a6c34db4
Make use of std::optional strict
2021-09-13 20:02:32 +03:00
Ted John
6e2b79a895
Get basic TTF support working in OpenGL
...
co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com >
2021-08-26 19:46:18 +03:00
ζeh Matt
8fc7e06116
Move gLastStringPos into rct_drawpixelinfo ( #14811 )
2021-06-03 22:10:09 -03:00
A.N
4d3328c7bb
Add preprocessor directives to stop unused variable/function warnings. ( #14422 )
2021-04-02 14:41:11 +02:00
Gymnasiast
50da55eaf3
Fix #14212 : Multiline news messages are shown incorrectly
2021-03-02 22:48:33 +01:00
Gymnasiast
7fd049c22e
Remove last remnants of gCurrentFontSpriteBase
2021-02-28 00:26:53 +01:00
Gymnasiast
c40701d997
Make gfx_draw_string() take a TextPaint argument
2021-02-28 00:26:20 +01:00