Commit graph

115 commits

Author SHA1 Message Date
Filippos Karapetis
4e7752b923 GRAPHICS: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +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
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
Cameron Cawley
8d9614ccd5 GRAPHICS: MACGUI: Extend the font ID enum 2024-12-09 23:24:23 +02: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
Cameron Cawley
7e0dfe0081 GRAPHICS: Use custom stream callbacks for loading TTF fonts 2024-07-23 15:33:43 +01:00
Eugene Sandulenko
5bd7b57282
GRAPHICS: MACGUI: Switch TTFMap to saner data structure not requiring global constructor 2024-05-12 15:23:30 +02:00
InariInDream
cea8312c35 GUI: load ttf from archive in Unicode branch 2024-05-04 00:14:31 +02:00
InariInDream
bd867b109a GUI: Switch HelpDialog to TTF fonts 2024-05-04 00:14:31 +02:00
InariInDream
e70ea93149 GRAPHICS: MACGUI: Add support for TTF font maps 2024-05-04 00:14:31 +02:00
Torbjörn Andersson
5117adc24c GRAPHICS: MACGUI: Give loaded fonts their correct ID
When loading other fonts than the system ones, they would get ID -1, not
the one from their resource ID. Even if you later registered the font
name, the old font entries would still be wrong. Another possibility
would be to update _fontRegistry when registering fonts, but sev was ok
with this way so let's go with it for now.

It does not consider the possibility of ID collisions the way
registerFontName() does, but apparently there shouldn't be much risk of
that.
2024-03-03 19:49:00 +01:00
Cameron Cawley
f3fbd2477c GRAPHICS: Allow specifying separate xdpi and ydpi values in loadTTFFont 2024-01-08 23:41:50 +01:00
Eugene Sandulenko
df3ee65585
GRAPHICS: MACGUI: Added mre debug output 2023-12-30 22:17:18 +01:00
Eugene Sandulenko
3051af3732
GRAPHICS: MACGUI: Switched debug output to 'macgui' debug channel in MacFontManager 2023-12-30 01:05:26 +01:00
Eugene Sandulenko
b0a624df76
GRAPHICS: MACGUI: More debug output to MacFontManager 2023-12-26 21:28:28 +01:00
Cameron Cawley
5b1b14ad80 COMMON: Mark more symbols as const 2023-12-26 20:23:59 +01:00
Le Philousophe
226de788c8 GRAPHICS: Make API use the Path class 2023-12-24 13:19:25 +01:00
Harishankar Kumar
9b6d9b0c27 GRAPHICS: Fix WinFont scaling memory leak when scaling fonts.
Memory leak happened because the scaled generated fonts were not
being cached or saved anywhere, thus they were not being destructed
and freed. Added logic to cache generated font in _winFontRegistry
itself.

Leaks observed in `trektech-win` of director engine in first few frames itself.
2023-07-08 22:13:28 +03:00
elasota
229f711ccd GRAPHICS: MACGUI: Load MacFont TTF as monochrome 2023-06-30 10:40:43 +03:00
elasota
bb5ea049d5 GRAPHICS: MACGUI: Constness fixes 2023-06-30 10:40:43 +03:00
Harishankar Kumar
96008586c6 GRAPHICS: Add scaling for winfont
Allow scaling of window font, ie FON, FNT. Internally this uses
same implementation as BDFScaling and MacFontScaling. Uses function
scaleSingleGlyph to scale each glyph.

Fonts in `mcluhan-win` used some of these fonts where the sizes
were different than parsed.
2023-06-27 13:00:29 +03:00
Scott Percival
c94f2de321 DIRECTOR: Add font quirks for two Star Trek games 2023-06-08 09:16:30 +02:00
Scott Percival
585ec558b6 GRAPHICS: MACGUI: Move getFont() messages to a higher debug level 2023-03-06 21:26:28 +01:00
Eugene Sandulenko
39f1b97fb9
GRAPHICS: MACGUI: Clean up "-Regular" prefix from the loaded MacFonts
Usage is in mcluhan quirk where we load font named "McLuhan-Regular"
2023-02-10 23:51:14 +01:00
Eugene Sandulenko
980e927e57
GRAPHICS: MACGUI: Warn about incorrect winfont sizes used as a substitute
Used by mcluhan-win that has 3 fonts bundled with it.
2023-02-10 20:59:30 +01:00
Eugene Sandulenko
fb7095f5a4
COMMON: Move all compression-related files to a separate directory 2022-12-01 11:53:02 +01:00
sluicebox
2775987cba MACGUI: Expose font families in MacFontManager
MacFontManager didn't have a mechanism to report which fonts it loaded
from an external resource. It also requires that any fonts that aren't
built-in be explicitly registered by name by the client before they can
be used. This combination meant that a client couldn't load fonts from
an external file and use them by their properties (id / size / style).

SCI contains Mac fonts in its executable along with a table that maps
each SCI font id to a Mac font id and size. The font name isn't a part
of this since the Classic Mac Toolbox API took id / size / style as
input when drawing text.

Now MacFontManager exposes the font families it has loaded along with
their names. This allows a client to see which fonts were loaded,
register them by name, and proceed to use them with the existing API.
2022-11-06 23:05:20 -08:00
Scott Percival
095ae06405 COMMON: Refactor MacResManager::load* methods to accept a pointer
Previously the methods would pass by reference, then convert to a
pointer on success and take ownership. This isn't ideal, as a
reference suggests no transferral of ownership, and doesn't suggest
it needs to be a heap resource allocated by new.
2022-09-25 10:35:03 +02:00
Roland van Laar
034a5efe98 DIRECTOR: Fix memory leak in registered FONDs
References to FOND resource streams are stored in an array.

Font streams were registered by their family name in a hashmap.
When a second font with the same name was encoutered it would replace
the pointer to the previous font.
The only use case for the hashmap was to register the stream to be able
to later close them.
2022-09-24 16:37:27 +02:00
Le Philousophe
8ec9835358 GRAPHICS: Initialize _japaneseFontsLoaded before it's used 2022-09-18 16:15:56 +02:00
Le Philousophe
e020710d5d GRAPHICS: Free WinFont when erroring out 2022-09-18 16:15:56 +02:00
Pragyansh Chaturvedi
5c17fe70b8 JANITORIAL: Fix conventions and reimplement MacFontManager::rectifyId() 2022-07-17 13:04:14 +02:00
Pragyansh Chaturvedi
c4f6aa89b9 GRAPHICS: Implement assigning of windows font, check for wrong fontId while loading stxt, read name from FON files DIRECTOR 2022-07-17 13:04:14 +02:00
Pragyansh Chaturvedi
8cb2e1bb07 GRAPHICS: Add rectifyId to check for changed font IDs 2022-07-17 13:04:14 +02:00
Pragyansh Chaturvedi
94848be816 GRAPHICS: Set MacText->_defaultFormatting values after generating font 2022-07-17 13:04:14 +02:00
Pragyansh Chaturvedi (r41k0u)
f241bdefd3 DIRECTOR: LINGO: Implement kTheTextFont, kTheTextStyle, kTheTextHeight and kTheTextSize in Lingo::setField() 2022-06-06 18:32:14 +02:00
Donovan Watteau
5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +03:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
djsrv
40c8ab4724 GRAPHICS: MACGUI: Fix registering font to preferred ID 2021-08-06 08:56:32 -04:00
djsrv
ad780d761c GRAPHICS: MACGUI: Handle TTF fonts with slant 2021-07-30 16:43:57 -04:00
djsrv
29197c191c GRAPHICS: MACGUI: Fix font memory leaks 2021-07-30 16:43:57 -04:00
ysj1173886760
3d0b7d5130 GRAPHICS: MACGUI: modify the parameter of scaleFont in macFont 2021-07-23 17:06:38 +08:00
djsrv
ea7d098913 GRAPHICS: MACGUI: Clean up comments 2021-07-12 18:02:56 -04:00
djsrv
6621b6121d GRAPHICS: MACGUI: Fix ID at which Japanese fonts start 2021-07-12 18:02:56 -04:00
djsrv
de929228c4 GRAPHICS: MACGUI: Add Japanese mode 2021-07-12 18:02:56 -04:00
djsrv
ad79812cc6 GRAPHICS: MACGUI: Introduce font aliases
Easy way of adding more font IDs and names for the same font.
2021-07-12 18:02:56 -04:00