mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 21:47:00 -04:00
Fix error introduced in r1465: in single line text box, no lines were generated (which led to a crash), or text was scaled down when this was not intended.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1524 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -350,6 +350,7 @@ void TextViewer::prepareElements(const String& text, const TextStyle& style, Con
|
|||||||
void TextViewer::prepareLines(RotatedDC& dc, const String& text, TextStyle& style, Context& ctx) {
|
void TextViewer::prepareLines(RotatedDC& dc, const String& text, TextStyle& style, Context& ctx) {
|
||||||
vector<CharInfo> chars;
|
vector<CharInfo> chars;
|
||||||
prepareLinesTryScales(dc, text, style, chars);
|
prepareLinesTryScales(dc, text, style, chars);
|
||||||
|
assert(!lines.empty());
|
||||||
|
|
||||||
// store information about the content/layout, allow this to change alignment
|
// store information about the content/layout, allow this to change alignment
|
||||||
style.content_width = 0;
|
style.content_width = 0;
|
||||||
@@ -559,7 +560,7 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector<CharInfo>& chars,
|
|||||||
if (line_size.width + word_size.width > max_width) {
|
if (line_size.width + word_size.width > max_width) {
|
||||||
if (!style.field().multi_line) {
|
if (!style.field().multi_line) {
|
||||||
// single line word does not fit
|
// single line word does not fit
|
||||||
return false;
|
if (stop_if_too_long) return false;
|
||||||
} else if (word_start == line.start) {
|
} else if (word_start == line.start) {
|
||||||
// single word on this line; the word is too long
|
// single word on this line; the word is too long
|
||||||
if (stop_if_too_long) {
|
if (stop_if_too_long) {
|
||||||
@@ -683,6 +684,7 @@ void TextViewer::alignLines(RotatedDC& dc, const vector<CharInfo>& chars, const
|
|||||||
-RealSize(style.padding_left+style.padding_right, style.padding_top + style.padding_bottom));
|
-RealSize(style.padding_left+style.padding_right, style.padding_top + style.padding_bottom));
|
||||||
if (style.paragraph_height <= 0) {
|
if (style.paragraph_height <= 0) {
|
||||||
// whole text box alignment
|
// whole text box alignment
|
||||||
|
assert(!lines.empty());
|
||||||
double top = lines[0].top;
|
double top = lines[0].top;
|
||||||
alignParagraph(0, lines.size(), chars, style, RealRect(RealPoint(0,top),s));
|
alignParagraph(0, lines.size(), chars, style, RealRect(RealPoint(0,top),s));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user