Commit Graph
49 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 4c7dd44351 TextDrawer: Remove the current font and scale
Drawing now takes the style and scale too, like measuring, so the text
drawers have no font state left. UIContext keeps its current style and
passes it, and fills it in from the theme if nothing has set one yet.
PPGe passes its one font.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:54:10 +01:00
Henrik RydgårdandClaude Opus 5.5 dc1e9e50fc TextDrawer: Measure in a given style without switching fonts
Measuring took the current font and scale, so UIContext switched to the
style being measured and back. On first draw the font to switch back to
could be an empty one, which the UWP drawer asserts on.

MeasureString and MeasureStringRect now take the style and scale, and the
backends' MeasureStringInternal measures in the style it's given.
SetOrCreateFont, which sets the font drawing uses, is shared, and the
backends only implement EnsureFont, which creates a font if needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:45:04 +01:00
Henrik RydgårdandClaude Opus 5.5 4a8d130631 SDL text: Reorder mixed-direction text with FriBidi
SDL3_ttf shapes a whole string in one direction, guessed from its first
character, so a Latin run inside Hebrew text (or a Hebrew run inside
English) came out reversed - "PPSSPP Gold" rendered as "PPSSPP dloG".
When a string mixes directions, reorder each line into visual order with
FriBidi and render it left-to-right. Strings in a single direction are
left to SDL3_ttf, which already handles pure Hebrew and shapes Arabic
better than FriBidi's presentation forms.

FriBidi is optional; without it, mixed strings render as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 17:01:11 +02:00
Kevin Reinholz 75e89175ee Explicitly include <clocale> in draw_text_sdl.cpp. Fixes build with clang21.1.8 on FreeBSD amd64 (and potentially other systems using newer clang) 2026-10-15 17:13:20 -07:00
Henrik Rydgård abb57c620f Adjust some log levels 2026-08-09 22:10:54 +02:00
Henrik Rydgård d101abd35f Have AI fix its own bugs 2026-06-16 11:39:24 +02:00
Henrik Rydgård 2b821037d7 SDL3_ttf work 2026-06-16 11:39:24 +02:00
Henrik Rydgård a5b110b47e Fix problem with fallback fonts looking too bold 2026-05-16 10:25:04 +02:00
Henrik Rydgård 2b946094a9 Warning fixes 2026-03-10 12:19:27 +01:00
myzhan af7384e8e4 Fix font rendering after window resizing on SDL(linux) 2026-03-05 13:34:38 +08:00
Henrik Rydgård c77f68d005 Some additional fixes in TextDrawerSDL 2026-01-27 20:10:40 +01:00
Henrik Rydgård 24283d3e7f Fix memory leak in TextDrawerSDL (sigh, variable shadowing) 2026-01-27 20:05:24 +01:00
Henrik Rydgård 6478f0dcad SDL: Fix measuring of multi-line strings.
Also, a small related optimization on Windows.
2026-01-21 13:57:51 +01:00
Henrik Rydgård acd8cf70d0 SDL: Load font from VFS instead of using a file path.
Hopefully helps #21014
2025-11-24 00:55:12 +01:00
Henrik Rydgård 666808fb8c SDL: Correct font size handling 2025-11-23 22:26:32 +01:00
Henrik Rydgård bc17b7c822 iOS buildfix, SDL buildfix 2025-11-23 11:42:43 +01:00
Henrik Rydgård 1ae6d0f9f6 Installer script fix 2025-11-23 11:11:18 +01:00
Henrik Rydgård bf5e524243 Add multi-font support to the final text-rendering backend (SDL_ttf) 2025-11-09 08:52:21 +01:00
Henrik Rydgård 6d1973edfb Add banners on the top of settings pages, if editing game-specific settings show the icon. 2025-11-09 08:51:41 +01:00
Henrik Rydgård f44e0505ea Fix SDL font rendering
Fixes #20933
2025-10-30 09:40:48 +01:00
Henrik Rydgård b082e94edb Initial work on using premultiplied alpha in the UI 2025-10-16 11:07:05 +02:00
Henrik Rydgård f2d35d204b SDL text renderer: Add some sanity checks. 2025-04-11 10:58:21 +02:00
Henrik Rydgård e49d94ad11 Unify the MeasureString caching code 2024-10-16 14:39:21 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård 28cf69f67e Remove duplicate code from the text rendering backends 2024-06-01 09:58:58 +02:00
Henrik Rydgård d6b6d087c0 Make the font lifecycle more similar between the backends. 2024-06-01 09:43:11 +02:00
Henrik Rydgård 4051f34758 Implement MeasureStringRect generically based on MeasureString 2024-05-31 21:11:48 +02:00
Henrik Rydgård 5b0007f391 Remove unused and broken text rotation code 2024-05-31 20:58:53 +02:00
Henrik Rydgård 2061f04885 Also remove DrawString in the SDL text backend 2024-05-31 19:08:25 +02:00
Henrik Rydgård 533f8f06be Unify DrawString between Windows, UWP and Android. More to come. 2024-05-31 17:27:59 +02:00
Henrik Rydgård 5999690af5 i18n: Remove our awkward ampersand-escape support, except in [DesktopUI] 2024-05-31 09:45:59 +02:00
Henrik Rydgård 0bbaaef787 Seems to be working now, though need to figure out which font face we can use. 2024-05-29 18:52:39 +02:00
Henrik Rydgård ccbcf1369b Convert DrawString* functions to use std::string_view 2024-05-24 22:52:51 +02:00
Henrik Rydgård 804f31f424 Convert MeasureString* functions to use std::string_view 2024-05-24 14:16:40 +02:00
Henrik Rydgård 4de4dc1433 Remove some logspam on SDL builds 2024-01-29 12:34:44 +01:00
Henrik Rydgård 1553931163 SDL: Add more fallback font names, greatly speed up fallback font handling 2024-01-20 11:22:05 +01:00
Henrik Rydgård 2007621ec3 Add "Droid Sans Fallback" to the list of fallback fonts.
This can be easily installed on apt based distros using:

sudo apt install fonts-droid-fallback

And provides all the characters we need.
2024-01-19 22:53:16 +01:00
Hoe Hao Cheng 28edae016e SDL: fallback to atlas if SDL2_ttf is <2.0.18 2023-09-25 10:07:30 +08:00
Henrik Rydgård 3aed81d51b Merge pull request #18170 from hch12907/sdl-ttf
ci: use pkgconfig as a fallback for finding SDL2_ttf
2023-09-21 13:45:52 +02:00
Hoe Hao Cheng b768210797 ci: use pkgconfig as a fallback for finding SDL2_ttf 2023-09-19 00:51:19 +08:00
Henrik Rydgård 8f88442343 SDL ttf rendering: Try two 4444 tex formats to find one that works. 2023-09-18 11:48:28 +02:00
Hoe Hao Cheng 0a5937051a SDL: let's not remove the candidate fallback fonts 2023-08-23 13:39:16 +08:00
Unknown W. Brackets 2aa4592330 SDL: Skip FcFini() call, causes crashes.
Apparently this is a relatively well known problem and various people have
commented this out, including in Chromium for the last 10 years...
2023-08-13 19:36:17 -07:00
Hoe Hao Cheng 4d7e949f23 SDL: text alignment fix 2023-08-03 20:54:21 +08:00
Hoe Hao Cheng c56f302e51 SDL: address comments on #17780 2023-07-30 16:25:36 +08:00
Hoe Hao Cheng aaa7e90174 SDL: fix a curious crash 2023-07-29 03:10:00 +08:00
Hoe Hao Cheng 1c890be702 Use common UTF8 infrastructure instead of rewriting one 2023-07-29 03:10:00 +08:00
Hoe Hao Cheng f88d1a287e SDL: implement font fallback for TextDrawerSDL 2023-07-29 03:09:57 +08:00
Hoe Hao Cheng 2b826b5614 SDL: implement TextDrawer using SDL2_ttf 2023-07-25 13:05:32 +08:00