[Scummvm-git-logs] scummvm master -> 7c616a5737efff23742cd7c1adbdf24e873a04f0
sev-
sev at scummvm.org
Sat Feb 4 16:44:19 CET 2017
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
91d85feace GRAPHICS: Correctly process empty lines in MacText
1a4be95aaa GRAPHICS: Try to generate font names from slant in MacFontManager
906d94a742 GRAPHICS: Enforce font recomputation in MacText
bbb3c5ae9a GRAPHICS: Removing Director-specific hack in text width calculation
7c616a5737 DIRECTOR: Added workaround for Text Cast width
Commit: 91d85feace2588c4e9673148e453e8a6fdc0bcb5
https://github.com/scummvm/scummvm/commit/91d85feace2588c4e9673148e453e8a6fdc0bcb5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-04T15:31:44+01:00
Commit Message:
GRAPHICS: Correctly process empty lines in MacText
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 66a041e..4c02292 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -162,6 +162,11 @@ void MacText::splitString(Common::String &str) {
} else {
if (nextChunk) { // No text, replacing formatting
_textLines[curLine].chunks[curChunk] = _currentFormatting;
+ } else { // Otherwise it is an empty line
+ curLine++;
+ _textLines.resize(curLine + 1);
+ _textLines[curLine].chunks.push_back(previousFormatting);
+ curChunk = 0;
}
}
Commit: 1a4be95aaa3ae8a857a9d3d2b3903b42396b443d
https://github.com/scummvm/scummvm/commit/1a4be95aaa3ae8a857a9d3d2b3903b42396b443d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-04T16:04:36+01:00
Commit Message:
GRAPHICS: Try to generate font names from slant in MacFontManager
Changed paths:
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index cf7ec40..f57cc9b 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -74,6 +74,17 @@ static const char *const fontNames[] = {
"New Century Schoolbook"
};
+static const char *const fontStyleSuffixes[] = {
+ "",
+ "Bold",
+ "Italic",
+ "Underline",
+ "Outline",
+ "Shadow",
+ "Condense",
+ "Extend"
+};
+
MacFontManager::MacFontManager() {
for (uint i = 0; i < ARRAYSIZE(fontNames); i++)
if (fontNames[i])
@@ -244,8 +255,14 @@ const Font *MacFontManager::getFont(MacFont macFont) {
if (macFont.getName().empty())
macFont.setName(getFontName(macFont.getId(), macFont.getSize(), macFont.getSlant()));
- if (!_fontRegistry.contains(macFont.getName()))
- generateFontSubstitute(macFont);
+ if (!_fontRegistry.contains(macFont.getName())) {
+ // Let's try to generate name
+ if (macFont.getSlant() != kMacFontRegular)
+ macFont.setName(getFontName(macFont.getId(), macFont.getSize(), macFont.getSlant(), true));
+
+ if (!_fontRegistry.contains(macFont.getName()))
+ generateFontSubstitute(macFont);
+ }
font = FontMan.getFontByName(macFont.getName());
@@ -286,7 +303,7 @@ void MacFontManager::clearFontMapping() {
_extraFontIds.clear();
}
-const char *MacFontManager::getFontName(int id, int size, int slant) {
+const char *MacFontManager::getFontName(int id, int size, int slant, bool tryGen) {
static char name[128];
Common::String n;
@@ -299,6 +316,17 @@ const char *MacFontManager::getFontName(int id, int size, int slant) {
n = fontNames[0]; // Fallback to Chicago
}
+ if (tryGen && slant != kMacFontRegular) {
+ for (int i = 0; i < 7; i++) {
+ if (slant & (1 << i)) {
+ n += ' ';
+ n += fontStyleSuffixes[i + 1];
+ }
+ }
+
+ slant = 0;
+ }
+
snprintf(name, 128, "%s-%d-%d", n.c_str(), slant, size);
return name;
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 07407e2..c154b8b 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -123,7 +123,7 @@ public:
* @param size size of the font
* @return the font name or NULL if ID goes beyond the mapping
*/
- const char *getFontName(int id, int size, int slant = kMacFontRegular);
+ const char *getFontName(int id, int size, int slant = kMacFontRegular, bool tryGen = false);
const char *getFontName(MacFont &font);
int getFontIdByName(Common::String name);
Commit: 906d94a7422eb679f9051ad31c4cad5a83804799
https://github.com/scummvm/scummvm/commit/906d94a7422eb679f9051ad31c4cad5a83804799
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-04T16:05:01+01:00
Commit Message:
GRAPHICS: Enforce font recomputation in MacText
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4c02292..2064681 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -263,7 +263,7 @@ void MacText::render(int from, int to) {
debugN(4, "%2d ", i);
for (uint j = 0; j < _textLines[i].chunks.size(); j++)
- debugN(4, "[%d] \"%s\"", _textLines[i].chunks[j].fontId, _textLines[i].chunks[j].text.c_str());
+ debugN(4, "[%d (%d)] \"%s\" ", _textLines[i].chunks[j].fontId, _textLines[i].chunks[j].textSlant, _textLines[i].chunks[j].text.c_str());
debug(4, "%s", "");
}
@@ -280,6 +280,9 @@ int MacText::getLineWidth(int line, bool enforce) {
int height = 0;
for (uint i = 0; i < _textLines[line].chunks.size(); i++) {
+ if (enforce)
+ _textLines[line].chunks[i].font = nullptr;
+
if (!_textLines[line].chunks[i].text.empty())
width += _textLines[line].chunks[i].getFont()->getStringWidth(_textLines[line].chunks[i].text);
Commit: bbb3c5ae9a876fed7faabb599273d5d4e789ffab
https://github.com/scummvm/scummvm/commit/bbb3c5ae9a876fed7faabb599273d5d4e789ffab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-04T16:29:24+01:00
Commit Message:
GRAPHICS: Removing Director-specific hack in text width calculation
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 2064681..4042088 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -43,7 +43,7 @@ MacText::MacText(Common::String s, MacWindowManager *wm, const Font *font, int f
_font = font;
_fgcolor = fgcolor;
_bgcolor = bgcolor;
- _maxWidth = maxWidth - 1; // This seems to be correct. TODO: More testing is required
+ _maxWidth = maxWidth;
_textMaxWidth = 0;
_textMaxHeight = 0;
_surface = nullptr;
Commit: 7c616a5737efff23742cd7c1adbdf24e873a04f0
https://github.com/scummvm/scummvm/commit/7c616a5737efff23742cd7c1adbdf24e873a04f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-04T16:43:57+01:00
Commit Message:
DIRECTOR: Added workaround for Text Cast width
Changed paths:
engines/director/frame.cpp
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 693e477..7ea9ec6 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -899,7 +899,9 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
if (_vm->getVersion() >= 4 && !isButtonLabel) height = textCast->initialRect.bottom;
height += textShadow;
- int width = _sprites[spriteId]->_width;
+ // WORKAROUND: TODO: Check what is the actual size in the original
+ // 4 is for the horizontal bars space, 1 on the left edge, 2 on the right edge
+ int width = _sprites[spriteId]->_width - 7;
if (_vm->getVersion() >= 4 && !isButtonLabel) width = textCast->initialRect.right;
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
More information about the Scummvm-git-logs
mailing list