mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
with paragraph_height text now resizes if a single paragraph becomes full;
Fixed issue with reader looping when save_value=false; Package manager will not contain packages that failed to load git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@681 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -622,8 +622,22 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector<CharInfo>& chars,
|
||||
line.end_or_soft = max(line.start, min(line.end_or_soft, line.end()));
|
||||
lines.push_back(line);
|
||||
// does it fit vertically?
|
||||
return lines.empty() ||
|
||||
lines.back().bottom() <= dc.getInternalSize().height - style.padding_bottom;
|
||||
if (style.paragraph_height > 0) {
|
||||
// height = max(paragraph_height) * paragraph_count
|
||||
double max_height = 0;
|
||||
// per paragraph alignment
|
||||
size_t start = 0;
|
||||
for (size_t last = 0 ; last < lines.size() ; ++last) {
|
||||
if (lines[last].break_after != BREAK_SOFT || last == lines.size()) {
|
||||
max_height = max(max_height, lines[last].bottom() - lines[start].top);
|
||||
start = last + 1;
|
||||
}
|
||||
}
|
||||
// how many paragraphs would fit?
|
||||
int n = floor(0.5 + (dc.getInternalSize().height - style.padding_bottom) / style.paragraph_height);
|
||||
lines.back().top = max_height * n - lines.back().line_height;
|
||||
}
|
||||
return lines.back().bottom() <= dc.getInternalSize().height - style.padding_bottom;
|
||||
}
|
||||
|
||||
double TextViewer::lineLeft(RotatedDC& dc, const TextStyle& style, double y) const {
|
||||
|
||||
Reference in New Issue
Block a user