[Scummvm-git-logs] scummvm master -> 238971bc469b5dd94e9cb2e97b62c91b5b5cc586

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Fri Jul 23 10:16:50 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
238971bc46 GRAPHICS: MACGUI: initialize slant of macFontfont.


Commit: 238971bc469b5dd94e9cb2e97b62c91b5b5cc586
    https://github.com/scummvm/scummvm/commit/238971bc469b5dd94e9cb2e97b62c91b5b5cc586
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T18:16:22+08:00

Commit Message:
GRAPHICS: MACGUI: initialize slant of macFontfont.

Changed paths:
    graphics/fonts/macfont.cpp


diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index d17bfb8fa7..48d56c96e3 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -301,6 +301,7 @@ bool MacFONTFont::loadFont(Common::SeekableReadStream &stream, MacFontFamily *fa
 	_data._rowWords    = stream.readUint16BE() * 2; // row width of bit image in 16-bit wds
 
 	_data._surfHeight = _data._fRectHeight;
+	_data._slant = 0; // only used in generated font
 
 	if (getDepth(_data._fontType) != 1) {
 		warning("MacFONTFont: %dbpp fonts are not supported", getDepth(_data._fontType));
@@ -531,8 +532,14 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
 	// when we are generating the slant fonts. e.g. italic font, underLine font. we set this. more detail is in drawChar
 	data._slant = slant;
 
+	// update the height, for shadow and outline font, we are drawing the outline, thus we may have 2 more pixel height
+	// for the underLine, we are drawing the line at ascent + 2, so we shall extend the height when we need.
 	if ((slant & kMacFontShadow) || (slant & kMacFontOutline))
 		data._fRectHeight += 2;
+	else if (slant & kMacFontUnderline) {
+		data._fRectHeight = MAX((int)data._fRectHeight, data._ascent + 2);
+	}
+
 	data._surfHeight = data._fRectHeight;
 
 	// Determine width of the bit image table




More information about the Scummvm-git-logs mailing list