[Scummvm-git-logs] scummvm master -> 0884aeeba3af63a4c12536b47440117cda68e2ec
sev-
sev at scummvm.org
Tue Jan 31 19:13:34 CET 2017
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
95be2f2b23 GRAPHICS: Overwhauling of MacText rich formatting
c4f73012e5 DIRECTOR: Generate font style runs for MacText
89e8bdc444 GRAPHICS: More fixes to MacText rich text formatting
0884aeeba3 GRAPHICS: More fixes to MacText formatting
Commit: 95be2f2b2383f0f8835d1a21f6fbcf86fe5a1667
https://github.com/scummvm/scummvm/commit/95be2f2b2383f0f8835d1a21f6fbcf86fe5a1667
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-31T18:46:33+01:00
Commit Message:
GRAPHICS: Overwhauling of MacText rich formatting
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4e86fcf..e9253b5 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -66,7 +66,16 @@ void MacText::splitString(Common::String &str) {
Common::String tmp;
bool prevCR = false;
- int curLine = _text.empty() ? 0 : _text.size() - 1;
+ if (_textLines.empty()) {
+ _textLines.resize(1);
+ _textLines[0].resize(1);
+
+ _textLines[0][0] = _defaultFormatting;
+ }
+
+ int curLine = _textLines.size() - 1;
+ int curChunk = _textLines[curLine].size() - 1;
+ bool nextChunk = false;
while (*s) {
if (*s == '\001') {
@@ -90,27 +99,42 @@ void MacText::splitString(Common::String &str) {
_currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
- if (_formatting.empty())
- _formatting.resize(1);
-
- _formatting[curLine].push_back(_currentFormatting);
+ _textLines[curLine].push_back(_currentFormatting);
- continue;
+ nextChunk = true;
}
- }
-
- if (*s == '\n' && prevCR) { // trean \r\n as one
+ } else if (*s == '\n' && prevCR) { // trean \r\n as one
prevCR = false;
s++;
continue;
+ } else if (*s == '\r') {
+ prevCR = true;
}
- if (*s == '\r')
- prevCR = true;
+ if (*s == '\r' || *s == '\n' || nextChunk) {
+ Common::Array<Common::String> text;
- if (*s == '\r' || *s == '\n') {
- _textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, _text), _textMaxWidth);
+ _textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, text), _textMaxWidth);
+
+ _textLines[curLine][curChunk].text = text[0];
+
+ if (nextChunk) {
+ curChunk++;
+ nextChunk = false;
+
+ _text[curLine] += text[0];
+ } else {
+ _text.push_back(text[0]);
+ }
+
+ if (text.size() > 1) {
+ for (uint i = 1; i < text.size(); i++) {
+ _text.push_back(text[i]);
+
+ //curLine++;
+ }
+ }
tmp.clear();
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 17c3b39..7234cdc 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -32,6 +32,8 @@ namespace Graphics {
class MacWindowManager;
struct MacFontRun {
+ Common::String text;
+
uint16 fontId;
byte textSlant;
byte unk3f;
@@ -110,7 +112,7 @@ private:
TextAlign _textAlignment;
- Common::Array< Common::Array<MacFontRun> > _formatting;
+ Common::Array< Common::Array<MacFontRun> > _textLines;
MacFontRun _defaultFormatting;
MacFontRun _currentFormatting;
};
Commit: c4f73012e5f4792aca573c89d80323973e0c8c58
https://github.com/scummvm/scummvm/commit/c4f73012e5f4792aca573c89d80323973e0c8c58
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-31T18:46:33+01:00
Commit Message:
DIRECTOR: Generate font style runs for MacText
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index e9253b5..e7abcc6 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -68,9 +68,7 @@ void MacText::splitString(Common::String &str) {
if (_textLines.empty()) {
_textLines.resize(1);
- _textLines[0].resize(1);
-
- _textLines[0][0] = _defaultFormatting;
+ _textLines[0].push_back(_defaultFormatting);
}
int curLine = _textLines.size() - 1;
@@ -99,7 +97,12 @@ void MacText::splitString(Common::String &str) {
_currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
- _textLines[curLine].push_back(_currentFormatting);
+ if ((_textLines[curLine])[curChunk].text.empty()) {
+ (_textLines[curLine])[curChunk] = _currentFormatting;
+ continue;
+ } else {
+ _textLines[curLine].push_back(_currentFormatting);
+ }
nextChunk = true;
}
@@ -117,28 +120,36 @@ void MacText::splitString(Common::String &str) {
_textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, text), _textMaxWidth);
- _textLines[curLine][curChunk].text = text[0];
+ if (text.size()) {
+ (_textLines[curLine])[curChunk].text = text[0];
- if (nextChunk) {
- curChunk++;
- nextChunk = false;
+ if (nextChunk) {
+ curChunk++;
- _text[curLine] += text[0];
- } else {
- _text.push_back(text[0]);
+ _text[curLine] += text[0];
+ } else {
+ _text.push_back(text[0]);
+ }
}
if (text.size() > 1) {
for (uint i = 1; i < text.size(); i++) {
_text.push_back(text[i]);
- //curLine++;
+ curLine++;
+ _textLines.resize(curLine + 1);
+ _textLines[curLine].push_back(_currentFormatting);
+ (_textLines[curLine])[0].text = text[i];
+ curChunk = 0;
}
}
tmp.clear();
- s++;
+ if (!nextChunk) // Don't skip next character
+ s++;
+
+ nextChunk = false;
continue;
}
@@ -146,8 +157,26 @@ void MacText::splitString(Common::String &str) {
s++;
}
- if (tmp.size())
- _textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, _text), _textMaxWidth);
+ if (tmp.size()) {
+ Common::Array<Common::String> text;
+
+ _textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, text), _textMaxWidth);
+
+ (_textLines[curLine])[curChunk].text = text[0];
+
+ _text.push_back(text[0]);
+
+ if (text.size() > 1) {
+ for (uint i = 1; i < text.size(); i++) {
+ _text.push_back(text[i]);
+
+ curLine++;
+ _textLines.resize(curLine + 1);
+ _textLines[curLine].push_back(_currentFormatting);
+ (_textLines[curLine])[0].text = text[i];
+ }
+ }
+ }
}
void MacText::reallocSurface() {
Commit: 89e8bdc444cb3d223b7970394f78131f9346e53e
https://github.com/scummvm/scummvm/commit/89e8bdc444cb3d223b7970394f78131f9346e53e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-31T19:02:15+01:00
Commit Message:
GRAPHICS: More fixes to MacText rich text formatting
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index e7abcc6..ed3cddb 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -119,21 +119,19 @@ void MacText::splitString(Common::String &str) {
Common::Array<Common::String> text;
_textMaxWidth = MAX(_font->wordWrapText(tmp, _maxWidth, text), _textMaxWidth);
+ tmp.clear();
if (text.size()) {
- (_textLines[curLine])[curChunk].text = text[0];
-
if (nextChunk) {
+ (_textLines[curLine])[curChunk].text += text[0];
curChunk++;
_text[curLine] += text[0];
- } else {
- _text.push_back(text[0]);
+
+ continue;
}
- }
- if (text.size() > 1) {
- for (uint i = 1; i < text.size(); i++) {
+ for (uint i = 0; i < text.size(); i++) {
_text.push_back(text[i]);
curLine++;
@@ -144,8 +142,6 @@ void MacText::splitString(Common::String &str) {
}
}
- tmp.clear();
-
if (!nextChunk) // Don't skip next character
s++;
@@ -236,6 +232,14 @@ void MacText::render(int from, int to) {
y += _font->getFontHeight() + _interLinear;
}
+ for (uint i = 0; i < _textLines.size(); i++) {
+ debugN(4, "%2d ", i);
+
+ for (uint j = 0; j < _textLines[i].size(); j++)
+ debugN(4, "[%d] \"%s\"", (_textLines[i])[j].fontId, (_textLines[i])[j].text.c_str());
+
+ debug(4, "");
+ }
}
void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
Commit: 0884aeeba3af63a4c12536b47440117cda68e2ec
https://github.com/scummvm/scummvm/commit/0884aeeba3af63a4c12536b47440117cda68e2ec
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-31T19:06:27+01:00
Commit Message:
GRAPHICS: More fixes to MacText formatting
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index ed3cddb..6a3deb2 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -128,6 +128,8 @@ void MacText::splitString(Common::String &str) {
_text[curLine] += text[0];
+ nextChunk = false;
+
continue;
}
@@ -140,6 +142,10 @@ void MacText::splitString(Common::String &str) {
(_textLines[curLine])[0].text = text[i];
curChunk = 0;
}
+ } else {
+ if (nextChunk) { // No text, replacing formatting
+ (_textLines[curLine])[curChunk] = _currentFormatting;
+ }
}
if (!nextChunk) // Don't skip next character
More information about the Scummvm-git-logs
mailing list