com.lowagie.text.pdf.PdfChunk Java Examples

The following examples show how to use com.lowagie.text.pdf.PdfChunk. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SplitCharTest.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @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 == '.');
}
 
Example #2
Source File: BreakIteratorSplitCharacter.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: BreakIteratorSplitCharacter.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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) <= ' ';
}
 
Example #4
Source File: SplitCharacter.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * 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[]);
 
Example #5
Source File: SplitCharacter.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 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[]);
 
Example #6
Source File: SplitCharacter.java    From MesquiteCore with GNU Lesser General Public License v3.0 votes vote down vote up
/**
 * 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[]);