Commit Graph
106 Commits
Author SHA1 Message Date
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
djsrv 0c053d20ba GRAPHICS: MACGUI: Replace kMacCentralEurope with kMacRoman 2021-07-12 15:41:21 -04:00
djsrv 354e344b4d GRAPHICS: MACGUI: Start IDs for new font registrations at 100
Makes it clearer that these are not system fonts.
2021-07-12 15:41:21 -04:00
djsrv 68426370f3 GRAPHICS: MACGUI: Don't register font name in loadFonts
We don't know a font's preferred ID at this point. We must get that from
the Director movie's font map.
2021-07-12 15:41:15 -04:00
djsrv 9fe78bc54d GRAPHICS: MACGUI: Fix unregistered font segfault 2021-07-12 01:33:16 -04:00
djsrv f4d2b75342 GRAPHICS: MACGUI: Set default encodings in registerFontName 2021-07-12 00:38:05 -04:00
djsrv 2e3b08017f GRAPHICS: MACGUI: Whitespace cleanup 2021-07-12 00:38:05 -04:00
djsrv acb3ace45e GRAPHICS: MACGUI: Detect Japanese fonts from preferred ID 2021-07-12 00:38:05 -04:00
djsrv 71d4127b8a GRAPHICS: MACGUI: Store font lang and encoding 2021-07-12 00:38:05 -04:00
djsrv ed406150c2 GRAPHICS: MACGUI: Add font name from Alan Kay demo 2021-07-12 00:38:05 -04:00