You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ar...@apache.org on 2001/02/11 06:42:33 UTC
cvs commit: xml-fop/jpfop-0.17.0/src/org/apache/fop/render/pdf CIDFontWidthsEntry.java
arved 01/02/10 21:42:33
Added: jpfop-0.17.0/src/org/apache/fop/render/pdf
CIDFontWidthsEntry.java
Log:
Modified JPFOP PDF rendering class
Revision Changes Path
1.1 xml-fop/jpfop-0.17.0/src/org/apache/fop/render/pdf/CIDFontWidthsEntry.java
Index: CIDFontWidthsEntry.java
===================================================================
package org.apache.fop.render.pdf;
/**
* This object is used for widths in CIDFonts .
* The entry of Widths for a CIDFont allows two defferent formats .
* For more details , see PDF specification p.213 .
*/
public class CIDFontWidthsEntry {
int[] widths = null;
int width = 0;
int start = 0;
int end = 0;
/**
* C [ W1 W2 ... Wn ] format entry .
*/
CIDFontWidthsEntry(int start, int[] widths) {
this.start = start;
this.end = start+widths.length;
this.widths=widths;
}
/**
* Cfirst Clast W format entry .
*/
CIDFontWidthsEntry(int start, int end, int width) {
this.start = start;
this.end = end;
this.width = width;
}
/**
* Get widths for specified code point .
*/
public int getWidth(int codePoint) throws ArrayIndexOutOfBoundsException {
if (codePoint<start || end<codePoint)
throw new ArrayIndexOutOfBoundsException();
return ( widths == null ) ? width : widths[codePoint-start];
}
public void toString(StringBuffer sb) {
sb.append(start);
if ( widths == null ) {
sb.append(" ");
sb.append(end);
sb.append(" ");
sb.append(width);
sb.append("\n");
} else {
sb.append(" [ ");
for ( int i = 0; i < widths.length; i++ ) {
sb.append(widths[i]);
sb.append(" ");
}
sb.append("]\n");
}
}
}