From 1b4d525eda8eaea0b4425d26ffa42c3a0c723b54 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 16 Apr 2018 18:30:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third/v2/lowagie/text/pdf/PdfChunk.java | 61 ++++++------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java index a45255cb7..4df44bd54 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java @@ -548,42 +548,23 @@ 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 { - if (value.length() > 1 && value.endsWith(" ")) { - value = value.substring(0, value.length() - 1); - return font.width(' '); - } + /** + * Trims the last space. + * @return the width of the space trimmed, otherwise 0 + */ + + 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 { - if (value.length() > 1 && value.startsWith(" ")) { - value = value.substring(1); - return font.width(' '); - } + } + + public float trimFirstSpace() { + if (value.length() > 1 && value.startsWith(" ")) { + value = value.substring(1); + return font.width(' '); } return 0; } @@ -792,16 +773,8 @@ public class PdfChunk { * @return the trimmed String */ 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); - } + while (string.endsWith(" ") || string.endsWith("\t")) { + string = string.substring(0, string.length() - 1); } return string; }