mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
implemented "direction:vertical" support, also for symbols
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@269 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -31,7 +31,8 @@ enum DrawWhat
|
||||
|
||||
/// Information on a linebreak
|
||||
enum LineBreak
|
||||
{ BREAK_NO // no line break
|
||||
{ BREAK_NO // no line break ever
|
||||
, BREAK_MAYBE // break here when in "direction:vertical" mode
|
||||
, BREAK_SOFT // optional line break (' ')
|
||||
, BREAK_HARD // always a line break ('\n')
|
||||
, BREAK_LINE // line break with a separator line (<line>)
|
||||
@@ -42,7 +43,7 @@ struct CharInfo {
|
||||
RealSize size;
|
||||
LineBreak break_after;
|
||||
|
||||
inline CharInfo(RealSize size, LineBreak break_after = BREAK_NO) : size(size), break_after(break_after) {}
|
||||
inline CharInfo(RealSize size, LineBreak break_after) : size(size), break_after(break_after) {}
|
||||
};
|
||||
|
||||
/// A section of text that can be rendered using a TextViewer
|
||||
|
||||
@@ -38,7 +38,7 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>&
|
||||
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_NO
|
||||
c == _(' ') ? BREAK_SOFT : BREAK_MAYBE
|
||||
));
|
||||
prev_width = s.width;
|
||||
}
|
||||
|
||||
@@ -410,6 +410,11 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector<CharInfo>& chars,
|
||||
} else if (c.break_after == BREAK_SOFT && style.field().multi_line) {
|
||||
// Soft break == end of word
|
||||
accept_word = true;
|
||||
} else if (c.break_after == BREAK_MAYBE && style.direction == TOP_TO_BOTTOM) {
|
||||
break_now = true;
|
||||
accept_word = true;
|
||||
hide_breaker = false;
|
||||
line_height_multiplier = style.line_height_soft;
|
||||
}
|
||||
// Add size of the character
|
||||
word_size = add_horizontal(word_size, c.size);
|
||||
|
||||
Reference in New Issue
Block a user