Commit Graph
71 Commits
Author SHA1 Message Date
Torbjörn Andersson 53d149b45b GRAPHICS: Make Mac font rendering more like the original
By applying italics before outline, not after, and slanting italics
characters from the bottom up instead of top down, I now get pixel
perfect rendering for my experimental About dialogs for Loom and Indiana
Jones and the Last Crusade.
2023-11-18 18:47:39 +01:00
Torbjörn Andersson 16ac86cdeb GRAPHICS: Calculate bitmapOffset correctly. Again.
Add, don't set, the extra bitmap offset for italics to keep glyphs from
overlapping in memory.
2023-11-18 18:47:39 +01:00
Torbjörn Andersson e5e5f049be GRAPHICS: Implement kMacFontCondense and kMacFontExtend
Judging by the experiments I made in a Mac emulator, condensed and
extended slant simply decreases and increases the glyph width by one.
You'd think it would depend on the font size, but apparently not. It is
possible to use both condensed and extended slant at the same time, and
it's just as useless as it sounds.
2023-10-16 17:40:29 +02:00
Torbjörn Andersson 3e0a726cb4 GRAPHICS: Calculate bitmapOffset correctly
We have to take into consideration that text can use any combination of
slants. Otherwise, glyphs may spill into memory used for other glyphs.
This was probably only an issue when the glyph storage crossed the
boundary from one byte length into another.
2023-10-16 17:40:29 +02:00
Torbjörn Andersson 789f2dfaf1 GRAPHICS: Make sure outline glyphs aren't cropped on the left side
This will offset all outlined glyphs one pixel to the right. I hope that
doesn't cause issues elsewhere.
2023-10-16 17:40:29 +02:00
Torbjörn Andersson 5009bb67e4 GRAPHICS: Fix bold text to be more (hopefully exeactly) like the original
QuickDraw appears to simply draw the character once normally and once
shifted one pixel to the right. This was perhaps most noticeable on
small characters with lots of edges. (I noticed it first on "W" in
Geneva 9.)
2023-10-16 17:40:29 +02:00
Torbjörn Andersson e22310c2ad GRAPHICS: Fix building with DEBUGSCALING 2023-10-16 17:40:29 +02:00
elasota cffd2b00f7 GRAPHICS: Fix OOB writes when drawing underlined text where the underline doesn't fit in bounds. 2023-08-16 19:12:49 +03:00
NischayDiwan 4b83dd78d6 GRAPHICS: Refactor MacFont scaling into reusable methods
- The refactoring code for MacFont that magnifies the font on a surface and then uses a grayscalemap to refactor the scaling, is pushed back into a resuable method in the base font class.
 - surface magnigy funtion transfer and scaleSingleGlyph method add to the font class.
2023-04-16 21:13:50 +02: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
Roland van Laar b517ab6635 GRAPHICS: MACGUI: Fix memory leak in scaleFont
Free all surfaces after use.
2022-09-20 11:04:58 +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
Orgad Shaneh 7a4e5612de JANITORIAL: Replace new[]/memset with new[]()
Mostly done using the following Ruby script:

(Dir.glob('**/*.cpp') + Dir.glob('**/*.h')).each do |file|
  s = File.read(file, encoding: 'iso8859-1')
  t = s.gsub(/(([\w_.\[\]]+)\s*=\s*new\s+\S+?\[[^\]]+?\](?!\())([^\{\}]*?)\n\s+memset\(\s*\2\s*,\s*0\s*,[^;]*;/m, '\1()\3')
  if t != s
    File.open(file, 'w') { |io| io.write(t) }
  end
end
2021-11-10 19:53:15 +01:00
Alexandre Detiste 6044504762 JANITORIAL: typos
some in the variable names, some in the comments;
no change for the strings that interract with original games assets
2021-10-31 20:46:31 +01:00
ysj1173886760 948604d79d GRAPHICS: MACGUI: text length should not bigger than maxWidth - 1 2021-07-29 12:04:20 +08:00
ysj1173886760 a2d453a8f9 GRAPHICS: MACGUI: don't apply the kerning offset for the generated font
because we have already applied it when we are generating the font.
2021-07-26 20:55:49 +08:00
ysj1173886760 238971bc46 GRAPHICS: MACGUI: initialize slant of macFontfont. 2021-07-23 18:16:22 +08:00
ysj1173886760 7e2f3edc61 GRAPHICS: MACGUI: initialize bitImage to 0. 2021-07-23 17:06:38 +08:00
ysj1173886760 dc8418b547 GRAPHICS: MACGUI: implement shadow font. 2021-07-23 17:06:38 +08:00
ysj1173886760 1d7e82bf3e GRAPHICS: MACGUI: amend makeOutline 2021-07-23 17:06:38 +08:00
ysj1173886760 cae8166101 GRAPHICS: MACGUI: organize the code for extension. 2021-07-23 17:06:38 +08:00
ysj1173886760 822ca12ab2 GRAPHICS: MACGUI: draw the underLine in kerning area when we are dealing with underLine font. 2021-07-23 17:06:38 +08:00
ysj1173886760 0aa7518c5b GRAPHICS: MACGUI: set the kerning offset to 0 when dealing with underLined space. 2021-07-23 17:06:38 +08:00
ysj1173886760 6752b923b9 GRAPHICS: MACGUI: amend makeOutline in macFont. 2021-07-23 17:06:38 +08:00
ysj1173886760 e434198924 GRAPHICS: MACGUI: implement underline font. 2021-07-23 17:06:38 +08:00
ysj1173886760 3d0b7d5130 GRAPHICS: MACGUI: modify the parameter of scaleFont in macFont 2021-07-23 17:06:38 +08:00
ysj1173886760 4dd8e71fb9 GRAPHICS: MACGUI: fix outline style font. 2021-07-22 21:42:19 +08:00
ysj1173886760 e02911f283 GRAPHICS: MACGUI: add 1 to the width of outline font. 2021-07-22 21:42:19 +08:00
ysj1173886760 9ec4a2449e GRAPHICS: MACGUI: using bitmapWidth to replace width when dealing with bitmap. 2021-07-22 21:42:19 +08:00
ysj1173886760 63b9ae3679 GRAPHICS: MACGUI: enhance italic font. Fix the implementation for generating slant fonts. 2021-07-22 21:42:19 +08:00
ysj1173886760 79755cfb02 GRAPHICS: MACGUI: implement basic italic supporting. 2021-07-22 21:42:18 +08:00
ysj1173886760 a319074c86 GRAPHICS: MACGUI: add kerning offset when drawing single char 2021-07-20 16:49:01 +08:00
ysj1173886760 296750d5de GRAPHICS: MACGUI: implement reading styleWidths and glyph-width table for macfont 2021-07-20 16:49:01 +08:00
ysj1173886760 e24b22ed56 GRAPHICS: MACGUI: eliminate some TODO in load macFontFamily 2021-07-20 16:49:01 +08:00
Torbjörn Andersson 2fb992ed4e GRAPHICS: Clip Mac font glyphs to the destination surface
This was probably causing instabilities in the MacVenture engine. The
engine is pretty broken at the moment, and the command window is so
small that text doesn't fit in it at all. Hopefully this will make the
remaining errors easier to debug... some day.
2021-04-04 10:23:20 +02:00
Eugene Sandulenko b221999e1e GRAPHICS: Allocate more memory on generating scaled Mac fonts 2020-08-17 00:50:56 +02:00
Eugene Sandulenko a7f73321d5 GRAPHICS: Fix clash with Amiga #define 2020-04-29 00:01:30 +02:00
Eugene Sandulenko 80f1132e22 GRAPHICS: FONTS: Fix Mac outline font generation 2020-03-22 18:08:30 +01:00
Eugene Sandulenko 930cf4df03 GRAPHICS: Generate Mac outline fonts 2020-03-22 17:41:21 +01:00
Eugene Sandulenko 6774d7aced GRAPHICS: MACGUI: Initial code for generating outlined fonts 2020-03-22 01:39:29 +01:00
Eugene Sandulenko da8bfeca5e GRAPHICS: FONTS: Improved visuals for generated bold fonts 2020-01-07 22:46:24 +01:00
Eugene Sandulenko 858f8791ec GRAPHICS: FONTS: Fix memory override 2020-01-07 22:09:59 +01:00
Eugene Sandulenko a98d3832d9 GRAPHICS: FONTS: Fix warnings 2020-01-07 22:00:23 +01:00
Eugene Sandulenko fc00b78a48 GRAPHICS: FONTS: Implement generation of bold fonts 2020-01-07 21:57:12 +01:00
Eugene Sandulenko b5a95d4783 GRAPHICS: FONTS: Made scaling form MacFONT as a step 2020-01-07 21:57:12 +01:00
Eugene Sandulenko 90c305c904 GRAPHICS: FONTS: Use better algorithm for MacFONT scaling added debug output 2020-01-07 21:57:12 +01:00
Eugene Sandulenko 40cb3b8f92 GRAPHICS: FONT: Really fix mismatched new/delete 2019-12-26 17:31:42 +01:00
Eugene Sandulenko 043acc1ccc GRAPHICS: FONTS: Fix mismatched new/delete. 2019-12-26 17:25:31 +01:00
Eugene Sandulenko bfb757c3c0 GRAPHICS: Load Mac font heights too (still unused) 2017-08-01 10:42:21 +02:00