text saving fixed

This commit is contained in:
honfika@gmail.com
2015-02-12 11:27:37 +01:00
parent b178ff2cb7
commit bd149d8ae8
3 changed files with 17 additions and 1 deletions

View File

@@ -345,6 +345,14 @@ public class DefineText2Tag extends TextTag {
throw new TextParseException("Font not defined", lexer.yyline());
}
while (txt.charAt(0) == '\r' || txt.charAt(0) == '\n') {
txt = txt.substring(1);
}
while (txt.charAt(txt.length() - 1) == '\r' || txt.charAt(txt.length() - 1) == '\n') {
txt = txt.substring(0, txt.length() - 1);
}
StringBuilder txtSb = new StringBuilder();
for (int i = 0; i < txt.length(); i++) {
char c = txt.charAt(i);

View File

@@ -351,6 +351,14 @@ public class DefineTextTag extends TextTag {
throw new TextParseException("Font not defined", lexer.yyline());
}
while (txt.charAt(0) == '\r' || txt.charAt(0) == '\n') {
txt = txt.substring(1);
}
while (txt.charAt(txt.length() - 1) == '\r' || txt.charAt(txt.length() - 1) == '\n') {
txt = txt.substring(0, txt.length() - 1);
}
StringBuilder txtSb = new StringBuilder();
for (int i = 0; i < txt.length(); i++) {
char c = txt.charAt(i);

View File

@@ -395,7 +395,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
public void updateTextBounds(RECT textBounds) {
TextImportResizeTextBoundsMode resizeMode = Configuration.textImportResizeTextBoundsMode.get();
if (resizeMode.equals(TextImportResizeTextBoundsMode.GROW_ONLY) || resizeMode.equals(TextImportResizeTextBoundsMode.GROW_AND_SHRINK)) {
if (resizeMode != null && (resizeMode.equals(TextImportResizeTextBoundsMode.GROW_ONLY) || resizeMode.equals(TextImportResizeTextBoundsMode.GROW_AND_SHRINK))) {
ExportRectangle newBounds = calculateTextBounds();
if (newBounds != null) {
int xMin = (int) Math.floor(newBounds.xMin);