Fixed bug in fields in style file;

No longer doing GetTextExtent("\n");
Moved pt boxes to style files;

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@390 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-18 22:22:18 +00:00
parent 4a6e10ad93
commit e9597a142c
14 changed files with 316 additions and 240 deletions
+12 -6
View File
@@ -33,14 +33,20 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>&
dc.SetFont(*font, scale);
// find sizes & breaks
double prev_width = 0;
size_t line_start = start; // start of the current line
for (size_t i = start ; i < end ; ++i) {
Char c = content.GetChar(i - this->start);
RealSize s = dc.GetTextExtent(content.substr(start - this->start, i - start + 1));
out.push_back(CharInfo(RealSize(s.width - prev_width, s.height),
c == _('\n') ? break_style :
c == _(' ') ? BREAK_SOFT : BREAK_MAYBE
));
prev_width = s.width;
if (c == _('\n')) {
out.push_back(CharInfo(RealSize(0, dc.GetCharHeight()), break_style));
line_start = i + 1;
prev_width = 0;
} else {
RealSize s = dc.GetTextExtent(content.substr(line_start - this->start, i - line_start + 1));
out.push_back(CharInfo(RealSize(s.width - prev_width, s.height),
c == _(' ') ? BREAK_SOFT : BREAK_MAYBE
));
prev_width = s.width;
}
}
}