|
|
|
@ -548,43 +548,24 @@ public class PdfChunk {
|
|
|
|
|
return 0.0f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* Trims the last space. |
|
|
|
|
* @return the width of the space trimmed, otherwise 0 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
public float trimLastSpace() |
|
|
|
|
{ |
|
|
|
|
BaseFont ft = font.getFont(); |
|
|
|
|
if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') { |
|
|
|
|
if (value.length() > 1 && value.endsWith("\u0001")) { |
|
|
|
|
value = value.substring(0, value.length() - 1); |
|
|
|
|
return font.width('\u0001'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
public float trimLastSpace() { |
|
|
|
|
if (value.length() > 1 && value.endsWith(" ")) { |
|
|
|
|
value = value.substring(0, value.length() - 1); |
|
|
|
|
return font.width(' '); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
public float trimFirstSpace() |
|
|
|
|
{ |
|
|
|
|
BaseFont ft = font.getFont(); |
|
|
|
|
if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') { |
|
|
|
|
if (value.length() > 1 && value.startsWith("\u0001")) { |
|
|
|
|
value = value.substring(1); |
|
|
|
|
return font.width('\u0001'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
public float trimFirstSpace() { |
|
|
|
|
if (value.length() > 1 && value.startsWith(" ")) { |
|
|
|
|
value = value.substring(1); |
|
|
|
|
return font.width(' '); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -792,17 +773,9 @@ public class PdfChunk {
|
|
|
|
|
* @return the trimmed <CODE>String</CODE> |
|
|
|
|
*/ |
|
|
|
|
String trim(String string) { |
|
|
|
|
BaseFont ft = font.getFont(); |
|
|
|
|
if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') { |
|
|
|
|
while (string.endsWith("\u0001")) { |
|
|
|
|
string = string.substring(0, string.length() - 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
while (string.endsWith(" ") || string.endsWith("\t")) { |
|
|
|
|
string = string.substring(0, string.length() - 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return string; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|