[Scummvm-git-logs] scummvm master -> b2cabfb4d1d28c318b34a1671eeda3122e6f80f8

bluegr noreply at scummvm.org
Mon Jun 22 01:22:31 UTC 2026


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

Summary:
b2cabfb4d1 NANCY: Fix font related TODOs for ConversationPopup in Nancy10+


Commit: b2cabfb4d1d28c318b34a1671eeda3122e6f80f8
    https://github.com/scummvm/scummvm/commit/b2cabfb4d1d28c318b34a1671eeda3122e6f80f8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-06-22T04:22:21+03:00

Commit Message:
NANCY: Fix font related TODOs for ConversationPopup in Nancy10+

Changed paths:
    engines/nancy/misc/hypertext.cpp
    engines/nancy/ui/conversationpopup.cpp


diff --git a/engines/nancy/misc/hypertext.cpp b/engines/nancy/misc/hypertext.cpp
index 39ea5c730e1..99ad71b1d98 100644
--- a/engines/nancy/misc/hypertext.cpp
+++ b/engines/nancy/misc/hypertext.cpp
@@ -60,6 +60,13 @@ void HypertextParser::setImageName(const Common::Path &name) {
 	_imageName = name;
 }
 
+static uint lineStep(const Graphics::Font *font) {
+	const uint h = font->getFontHeight();
+	if (g_nancy->getGameType() >= kGameTypeNancy10)
+		return h + h / 9;
+	return h;
+}
+
 void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffsetNonNewline, uint fontID, uint highlightFontID) {
 	using namespace Common;
 
@@ -235,7 +242,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 		// Setup most of the hotspot; textbox
 		if (hasHotspot) {
 			hotspot.left = textBounds.left;
-			hotspot.top = textBounds.top + (_numDrawnLines * font->getFontHeight()) - 1;
+			hotspot.top = textBounds.top + (_numDrawnLines * lineStep(font)) - 1;
 			hotspot.setHeight(0);
 			hotspot.setWidth(0);
 		}
@@ -274,7 +281,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 
 						_fullSurface.blitFrom(image, _imageSrcs[i],
 							Common::Point(	textBounds.left + horizontalOffset + 1,
-											textBounds.top + _numDrawnLines * highlightFont->getFontHeight() + _imageVerticalOffset));
+											textBounds.top + _numDrawnLines * lineStep(highlightFont) + _imageVerticalOffset));
 						_imageVerticalOffset += _imageSrcs[i].height() - 1;
 
 						if (lineNumber == 0) {
@@ -330,7 +337,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 						markDest.moveTo(textBounds.left + horizontalOffset + (newLineStart ? 0 : leftOffsetNonNewline) + 1,
 							lineNumber == 0 ?
 								textBounds.top - ((font->getFontHeight() + 1) / 2) + _imageVerticalOffset + 4 :
-								textBounds.top + _numDrawnLines * font->getFontHeight() + _imageVerticalOffset - 4);
+								textBounds.top + _numDrawnLines * lineStep(font) + _imageVerticalOffset - 4);
 
 						// For now we do not check if we need to go to new line; neither does the original
 						_fullSurface.blitFrom(g_nancy->_graphics->_object0, markSrc, markDest);
@@ -344,7 +351,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 
 						if (hasHotspot) {
 							hotspot.left = textBounds.left + (newLineStart ? 0 : horizontalOffset + leftOffsetNonNewline);
-							hotspot.top = textBounds.top + _numDrawnLines * font->getFontHeight() + _imageVerticalOffset - 1;
+							hotspot.top = textBounds.top + _numDrawnLines * lineStep(font) + _imageVerticalOffset - 1;
 							hotspot.setHeight(0);
 							hotspot.setWidth(0);
 						} else {
@@ -382,7 +389,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 				font->drawString(				&_fullSurface,
 												stringToDraw,
 												textBounds.left + horizontalOffset + (newLineStart ? 0 : leftOffsetNonNewline),
-												textBounds.top + _numDrawnLines * font->getFontHeight() + _imageVerticalOffset,
+												textBounds.top + _numDrawnLines * lineStep(font) + _imageVerticalOffset,
 												textBounds.width(),
 												colorID);
 
@@ -391,7 +398,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 					highlightFont->drawString(	&_textHighlightSurface,
 												stringToDraw,
 												textBounds.left + horizontalOffset + (newLineStart ? leftOffsetNonNewline : 0),
-												textBounds.top + _numDrawnLines * highlightFont->getFontHeight() + _imageVerticalOffset,
+												textBounds.top + _numDrawnLines * lineStep(highlightFont) + _imageVerticalOffset,
 												textBounds.width(),
 												colorID);
 				}
@@ -409,7 +416,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 					hotspot.setWidth(MAX<int16>(hotspot.width(), font->getStringWidth(stringToDraw)));
 
 					if (!stringToDraw.empty() && newWrappedLine) {
-						hotspot.setHeight(hotspot.height() + font->getFontHeight());
+						hotspot.setHeight(hotspot.height() + lineStep(font));
 					}
 				}
 
@@ -425,7 +432,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 			++_numDrawnLines;
 
 			// Record the height of the text currently drawn. Used for textbox scrolling
-			_drawnTextHeight = (_numDrawnLines - 1) * font->getFontHeight() + _imageVerticalOffset;
+			_drawnTextHeight = (_numDrawnLines - 1) * lineStep(font) + _imageVerticalOffset;
 		}
 
 		// Draw the footer image(s)
@@ -435,14 +442,14 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 
 				_fullSurface.blitFrom(image, _imageSrcs[i],
 					Common::Point(	textBounds.left + horizontalOffset + 1,
-									textBounds.top + _numDrawnLines * highlightFont->getFontHeight() + _imageVerticalOffset));
+									textBounds.top + _numDrawnLines * lineStep(highlightFont) + _imageVerticalOffset));
 				_imageVerticalOffset += _imageSrcs[i].height() - 1;
 
 				if (i < _imageLineIDs.size() - 1) {
 					_imageVerticalOffset += (font->getFontHeight() + 1) / 2 + 3;
 				}
 
-				_drawnTextHeight = (_numDrawnLines - 1) * font->getFontHeight() + _imageVerticalOffset;
+				_drawnTextHeight = (_numDrawnLines - 1) * lineStep(font) + _imageVerticalOffset;
 			}
 		}
 
@@ -466,12 +473,12 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 
 		// Add a newline after every full piece of text
 		++_numDrawnLines;
-		_drawnTextHeight += font->getFontHeight();
+		_drawnTextHeight += lineStep(font);
 	}
 
 	// Add a line's height at end of text to replicate original behavior
 	if (font) {
-		_drawnTextHeight += font->getFontHeight();
+		_drawnTextHeight += lineStep(font);
 	}
 
 	_needsTextRedraw = false;
diff --git a/engines/nancy/ui/conversationpopup.cpp b/engines/nancy/ui/conversationpopup.cpp
index dbc44d6abc3..13a84a1a891 100644
--- a/engines/nancy/ui/conversationpopup.cpp
+++ b/engines/nancy/ui/conversationpopup.cpp
@@ -124,15 +124,9 @@ void ConversationPopup::drawContent() {
 	_fullSurface.fillRect(Common::Rect(0, 0, _fullSurface.w, _fullSurface.h), 0);
 	_textHighlightSurface.fillRect(Common::Rect(0, 0, _textHighlightSurface.w, _textHighlightSurface.h), 0);
 
-	// TODO: Padding doesn't match the original game. leftOffset returns an
-	// unexpected value for Nancy 10+, so upOffset is used as a fallback for
-	// both axes until the TBOX layout for Nancy 10+ is better understood.
-
-	// TODO: Line spacing is tighter than the original game.
-	
 	Common::Rect textBounds(0, 0, _fullSurface.w, _fullSurface.h);
-	textBounds.top += _tboxData->upOffset;
-	textBounds.left += _tboxData->upOffset;
+	textBounds.top  += _tboxData->scrollbarDefaultPos.y;
+	textBounds.left += _tboxData->scrollbarDefaultPos.x;
 
 	drawAllText(textBounds, 0, _tboxData->conversationFontID, _tboxData->highlightConversationFontID);
 
@@ -156,7 +150,7 @@ void ConversationPopup::drawContent() {
 }
 
 uint16 ConversationPopup::getInnerHeight() const {
-	return _drawnTextHeight + _tboxData->upOffset;
+	return _drawnTextHeight + _tboxData->scrollbarDefaultPos.y;
 }
 
 Common::Rect ConversationPopup::toPopupLocal(const Common::Rect &chunkRect, bool useGameFrame) const {




More information about the Scummvm-git-logs mailing list