/** * @see com.lowagie.text.SplitCharacter#isSplitCharacter(int, int, int, * char[], com.lowagie.text.pdf.PdfChunk[]) */ public boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) { char c; if (ck == null) c = cc[current]; else c = (char) ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]); return (c == '.'); }
protected char currentChar(int current, char[] cc, PdfChunk[] ck) { char currentCh = cc[current]; if (ck != null) { PdfChunk chunk = ck[Math.min(current, ck.length - 1)]; currentCh = (char)chunk.getUnicodeEquivalent(currentCh); } return currentCh; }
@Override public boolean isSplitCharacter(int startIdx, int current, int endIdx, char[] cc, PdfChunk[] ck) { ++current; if (current == endIdx) { return false; } if (!(chars == cc && this.start == startIdx && this.end == endIdx)) { chars = cc; this.start = startIdx; this.end = endIdx; breakIter.setText(new ArrayCharIterator(cc, startIdx, endIdx)); boundary = new boolean[endIdx - startIdx + 1]; lastBoundary = breakIter.first(); if (lastBoundary != BreakIterator.DONE) { boundary[lastBoundary - startIdx] = true; } } while (current > lastBoundary) { lastBoundary = breakIter.next(); if (lastBoundary == BreakIterator.DONE) { lastBoundary = Integer.MAX_VALUE; } else { boundary[lastBoundary - startIdx] = true; } } return boundary[current - startIdx] || currentChar(current - 1, cc, ck) <= ' '; }
/** * Returns <CODE>true</CODE> if the character can split a line. The splitting implementation * is free to look ahead or look behind characters to make a decision. * <p> * The default implementation is: * <p> * <pre> * public boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) { * char c; * if (ck == null) * c = cc[current]; * else * c = (char) ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]); * if (c <= ' ' || c == '-') { * return true; * } * if (c < 0x2e80) * return false; * return ((c >= 0x2e80 && c < 0xd7a0) * || (c >= 0xf900 && c < 0xfb00) * || (c >= 0xfe30 && c < 0xfe50) * || (c >= 0xff61 && c < 0xffa0)); * } * </pre> * @param start the lower limit of <CODE>cc</CODE> inclusive * @param current the pointer to the character in <CODE>cc</CODE> * @param end the upper limit of <CODE>cc</CODE> exclusive * @param cc an array of characters at least <CODE>end</CODE> sized * @param ck an array of <CODE>PdfChunk</CODE>. The main use is to be able to call * {@link PdfChunk#getUnicodeEquivalent(int)}. It may be <CODE>null</CODE> * or shorter than <CODE>end</CODE>. If <CODE>null</CODE> no conversion takes place. * If shorter than <CODE>end</CODE> the last element is used * @return <CODE>true</CODE> if the character(s) can split a line */ public boolean isSplitCharacter(int start, int current, int end, char cc[], PdfChunk ck[]);
/** * Returns <CODE>true</CODE> if the character can split a line. The splitting implementation * is free to look ahead or look behind characters to make a decision. * <p> * The default implementation is: * <p> * <pre> * public boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) { * char c; * if (ck == null) * c = cc[current]; * else * c = ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]); * if (c <= ' ' || c == '-') { * return true; * } * if (c < 0x2e80) * return false; * return ((c >= 0x2e80 && c < 0xd7a0) * || (c >= 0xf900 && c < 0xfb00) * || (c >= 0xfe30 && c < 0xfe50) * || (c >= 0xff61 && c < 0xffa0)); * } * </pre> * @param start the lower limit of <CODE>cc</CODE> inclusive * @param current the pointer to the character in <CODE>cc</CODE> * @param end the upper limit of <CODE>cc</CODE> exclusive * @param cc an array of characters at least <CODE>end</CODE> sized * @param ck an array of <CODE>PdfChunk</CODE>. The main use is to be able to call * {@link PdfChunk#getUnicodeEquivalent(char)}. It may be <CODE>null</CODE> * or shorter than <CODE>end</CODE>. If <CODE>null</CODE> no convertion takes place. * If shorter than <CODE>end</CODE> the last element is used * @return <CODE>true</CODE> if the character(s) can split a line */ public boolean isSplitCharacter(int start, int current, int end, char cc[], PdfChunk ck[]);