Commit Graph
1182 Commits
Author SHA1 Message Date
Eugene Sandulenko 4095eff93f GRAPHICS: MACGUI: Fix crash on Unicode font fallback
It is a regression from the recent Unicode font caching.
Do not store fonts that were not loaded (nullptr). Otherwise,
nullptr will be returned on a subsequent call.
2025-04-26 15:02:39 +02:00
Eugene Sandulenko 1cc5b7ea24 JANITORIAL: Formatting fixes 2025-04-26 15:02:39 +02:00
Łukasz Lenkiewicz 071dba2dc4 GRAPHICS: Restore missing condition for default unicode font 2025-04-25 19:53:22 +08:00
Łukasz Lenkiewicz 59289df98e GRAPHICS: Fix TTF font caching 2025-04-25 19:53:22 +08:00
dasbidyendu 3c8be58fbc JANITORIAL: Fix comment indentation 2025-04-25 18:32:49 +08:00
dasbidyendu 6b7e566818 JANITORIAL: Cleaned up mactext-canvas 2025-04-25 18:32:49 +08:00
dasbidyendu aec6e60066 JANITORIAL: Remove excessive vertical whitespaces
Remove unnecessary vertical whitespaces from code.
2025-04-25 18:32:49 +08:00
dasbidyendu da1b772ca9 MACGUI: Null pointer and empty chunks tests in mactext , change cursor restoration issue in getmaxwidth.
- Check for null pointer before handling any operations in getChunkNum function.
- Check for empty chunks to avoid extra operations.
- avoid signed/unsigned issue in chunk position.
- avoid possible overflow in cursor restoration logic
2025-04-25 18:32:49 +08:00
dasbidyendu 65d49792e4 MACGUI: Improve chunk handling and add inline documentation in mactext-canvas.cpp
Added some checks to make sure The line continuations are not empty before adding them to the current line's word continuation to ensure consistency.

Also added some comments on previous code.

Made sure to append the chunks if it is within bounds.

Added the newChunk as a pointer to the current chunk.
2025-04-25 18:32:49 +08:00
D G Turner c160631a5d GRAPHICS: MACGUI: Fix Signed vs. Unsigned Comparison GCC Compiler Warnings 2025-04-19 13:56:26 +01:00
Scott Percival 1f99b81cf2 GRAPHICS: MACGUI: Fix getMouseChar and getMouseWord 2025-04-19 18:22:48 +08:00
Scott Percival c79f84e787 GRAPHICS: MACGUI: Move scrollbar support into MacText 2025-04-19 18:22:48 +08:00
Miro Kropacek 24dcacfe69 JANITORIAL: Add missing references to const function parameters
Applied to all 'const Common::' and 'const Graphics::' instances.
2025-04-13 02:20:09 +03:00
Matthew Jimenez 77ee5a9007 IMAGE: Get palette class by reference on image decoders 2025-04-12 15:47:17 +03:00
Filippos Karapetis 4e7752b923 GRAPHICS: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
rinevard 1e763a8afe GRAPHICS: MACGUI: Adding getLineHeight() to MacTextWindow 2025-03-18 13:32:56 +08:00
Eugene Sandulenko 968f594531 GRAPHICS: MACGUI: Truly use cached fonts in MacFontManager
This fixes text in trektech
2025-03-15 11:11:59 +08:00
cmd05 00f2abf93b GRAPHICS: MACGUI: Fix color palette used in nine-patch bitmap for disabling border 2025-03-11 15:36:51 +01:00
Eugene Sandulenko 3000f88043 GRAPHICS: MACGUI: Take DPI into account when dealing with Windows fonts
The original patch courtecy of IRC user grib. The original comment:

Try to coordinate using windows bitmap fonts in the MacFontManager needs to consider
pixels, points, and DPI

Font sizes are usually described in terms of "point" sizes, and rendered
as a number of pixels.

Windows fonts and Macintosh fonts used different DPI (dots per inch).

Bitmap fonts on Mac mostly used 72 dpi, so 72-point font would be about 72 pixels high.

Windows bitmap fonts mostly assumed 96 dpi, so a 72-point font would be 96 pixels high.

director:trektech loads a Windows bitmap font file that is nominally 12 point at 96 dpi. It is 14 pixels high.
2025-03-02 00:25:33 +01:00
Eugene Sandulenko 80b6699485 GRAPHICS: MACGUI: Moved windows cached fonts earlier in MacFontManager
Since we cache windows an mac fonts, this ensures that we check both caches
before attempting to generate substitutes, whuch affects greatly
performance in Windows Director games
2025-02-26 00:02:22 +01:00
Scott Percival 2d58f99fd6 DIRECTOR: Overhaul TextCastMember
Include new properties/aliases introduced in D5, fixes crashes related
to incorrect casting to MacText.
2025-02-04 15:24:17 +01:00
Cameron Cawley 80804c06c4 GRAPHICS: MACGUI: Use LiberationSans instead of FreeSans as a fallback 2025-01-26 15:44:10 +02:00
Le Philousophe 2a37e2b808 GRAPHICS: MACGUI: Implement drawing primitives
This makes the code comply with the latest API changes.
The drawing calls now need to be optimized for the complex shapes.
2025-01-24 12:11:17 +01:00
Le Philousophe ec06b9db8d GRAPHICS: MACGUI: Don't check if top menu is enabled in popup menus
Popup menus don't have a top menu and _activeItem is always -1.
2025-01-11 13:02:00 +01:00
Le Philousophe 6be1a9a890 GRAPHICS: MACGUI: Initialize the active menu callback 2025-01-11 12:43:41 +01:00
Torbjörn Andersson c64c763fd2 GRAPHICS: MACGUI: Don't expand disabled submenus 2025-01-08 20:00:45 +02:00
Torbjörn Andersson f489b45282 GRAPHICS: MACGUI: Draw submenu arrow correctly on disabled menu items 2025-01-08 20:00:45 +02:00
Torbjörn Andersson 67da94f031 GRAPHICS: MACGUI: Disable keyboard shortcuts for disabled menus 2025-01-08 20:00:45 +02:00
Torbjörn Andersson 796719cd05 GRAPHICS: MACGUI: Allow menus in the menu bar to be drawn disabled
Disabled menus can still be opened. Menu items in disabled menus will
look and act as if they were individually disabled. Enabling the menu
will restore it to its pre-disabled state.
2025-01-08 20:00:45 +02:00
Cameron Cawley 027c9bddca GRAPHICS: Add drawRoundRect to Graphics::Surface 2025-01-06 01:35:05 +02:00
Torbjörn Andersson c4c1d64d9f GRAPHICS: MACGUI: Allow menus to grow a bit wider
It's needed to avoid the Apple menu in the Day of the Tentacle Demo from
becoming truncated.
2025-01-02 18:00:50 +01:00
Torbjörn Andersson 92e7d9400f GRAPHICS: MACGUI: Add callback for when the menu is activated
The LucasArts SCUMM games need to know when this happens so that they
can turn the screen black. Polling the window manager for the menu
status probably wasn't good enough, because it seemed there were cases
where the menu was both activated and opened too quickly for the game to
have a chance to register it happening.

There is no callback for when the menu is deactivated. I could be wrong,
but I don't think this is quite as sensitive?
2025-01-01 14:41:20 +02:00
Cameron Cawley 8d9614ccd5 GRAPHICS: MACGUI: Extend the font ID enum 2024-12-09 23:24:23 +02:00
Cameron Cawley 58a9aa6a2c COMMON: Deprecate U32String constructors that accept a uint32 array 2024-11-29 01:14:36 +02:00
Cameron Cawley 35138892c2 GRAPHICS: MACGUI: Use a const pointer for MacPatterns arrays 2024-11-26 00:32:00 +01:00
Torbjörn Andersson 97ced3166c SCUMM: MACGUI: Optimize Mac palette handling (bug #15492)
Previously, every palette change in a game get passed on to the Mac
Window Manager, which would then have to look up new colors for drawing
Mac GUI stuff. This was fine for some games, but later ones do a lot of
palette animations, which could slow things down.

Now the Mac Window Manager gets the new palette only when it's about to
draw the Mac menu, or when it's about to draw a dialog (since those can
be triggered outside of the menu).

Additionally, the Mac Window Manager now triggers the auto-opening of
the menu in the event handler, not in the drawing code. Otherwise the
menu would be drawn once before the SCUMM Mac GUI could notice that the
menu was visible, causing an ugly color glitch.
2024-11-20 11:39:25 +02:00
Scott Percival a205480946 MACGUI: Fix getBorderFlags for titleless window types
Fixes rendering of game viewport in Zeddas: Servant of Sheol.
2024-11-11 20:40:06 +01:00
Niv Baehr 2a5602f34d GRAPHICS: MACGUI: Fix blank characters on forced Win95 mode 2024-11-05 20:18:50 +01:00
AndywinXp 90b5a73825 GRAPHICS: MACGUI: Add kWMModeForceMacFonts flag
This flag prevents Mac fonts substitutions with equivalent TTF fonts.
Of course, being this a flag, it will not impact any previous game using
this. It will only impact whichever engine will decide to set it to active
(in our case, SCUMM).
2024-10-28 08:24:59 +01:00
Eugene Sandulenko 56565c65e7 GRAPHICS: MACGUI: Fix regression after ManagedSurface usage changes 2024-10-25 23:12:53 +02:00
Eugene Sandulenko c191ea24fa GRAPHICS: MACGUI: Fix usage of deprecated ManagedSurface methods 2024-10-24 15:07:01 +02:00
Cameron Cawley 7e0dfe0081 GRAPHICS: Use custom stream callbacks for loading TTF fonts 2024-07-23 15:33:43 +01:00
Cameron Cawley ff530edcb1 GRAPHICS: Deprecate ManagedSurface methods that implicitly copy pixel data 2024-07-02 13:31:18 +01:00
Scott Percival e1f2418c17 GRAPHICS: MACGUI: Fix MacMenu to support 32-bit graphics 2024-06-18 18:24:08 +08:00
Krish 1c1ed2e61e GRAPHICS: MACGUI: Fix compilation with DEBUG enabled 2024-06-03 14:01:15 +02:00
Krish a51e33f1de GRAPHICS: MACGUl: Handle empty text in selection logic
Fixes crash in The Apartment version D4, movie "editableText"
./scummvm --start-movie=editableText theapartment4
2024-06-03 14:01:15 +02:00
Hubert Maier 9139412157 JANITORIAL: Fix refering typo in mactext.cpp 2024-05-18 13:52:31 +02:00
Hubert Maier a545fa7539 JANITORIAL: Fix extention typos in mactext-canvas.cpp 2024-05-18 13:52:31 +02:00
Eugene Sandulenko 5bd7b57282 GRAPHICS: MACGUI: Switch TTFMap to saner data structure not requiring global constructor 2024-05-12 15:23:30 +02:00
Cameron Cawley 248ab4ca15 GRAPHICS: MACGUI: Improve image quality in markdown documents 2024-05-09 15:19:17 +02:00