Browse Source

Various small fixes

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1177228 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_1rc1old
Simon Pepping 12 years ago
parent
commit
0a4a0fdf2e

+ 27
- 13
src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java View File

@@ -98,7 +98,7 @@ public abstract class CharactersetEncoder {
* sequence it will return its EBCDIC code-point, however, the "Shift In - Shift Out" operators
* are removed from the sequence of bytes. These are only used in Line Data.
*/
private final static class EbcdicDoubleByteEncoder extends CharactersetEncoder {
private static final class EbcdicDoubleByteEncoder extends CharactersetEncoder {
private EbcdicDoubleByteEncoder(String encoding) {
super(encoding);
}
@@ -116,7 +116,7 @@ public abstract class CharactersetEncoder {
* the primary format for most Latin character sets. This can also be used for Unicode double-
* byte character sets (DBCS).
*/
private final static class DefaultEncoder extends CharactersetEncoder {
private static final class DefaultEncoder extends CharactersetEncoder {
private DefaultEncoder(String encoding) {
super(encoding);
}
@@ -145,20 +145,26 @@ public abstract class CharactersetEncoder {
/**
* A container for encoded character bytes
*/
public static class EncodedChars {
public static final class EncodedChars {

final private byte[] bytes;
private final byte[] bytes;

final private int offset;
private final int offset;

final private int length;
private final int length;

private EncodedChars(byte[] bytes, int offset, int length) {
if (offset < 0) throw new IllegalArgumentException();
if (offset < 0) {
throw new IllegalArgumentException();
}

if (length < 0) throw new IllegalArgumentException();
if (length < 0) {
throw new IllegalArgumentException();
}

if (offset + length > bytes.length) throw new IllegalArgumentException();
if (offset + length > bytes.length) {
throw new IllegalArgumentException();
}

this.bytes = bytes;

@@ -175,14 +181,22 @@ public abstract class CharactersetEncoder {
* write <code>length</code> bytes from <code>offset</code> to the output stream
*
* @param out output to write the bytes to
* @param offset the offset where to write
* @param length the length to write
* @throws IOException if an I/O error occurs
*/
public void writeTo(OutputStream out, int offset, int length) throws IOException {
if (offset < 0) throw new IllegalArgumentException();
if (offset < 0) {
throw new IllegalArgumentException();
}

if (length < 0) throw new IllegalArgumentException();
if (length < 0) {
throw new IllegalArgumentException();
}

if (offset + length > this.length) throw new IllegalArgumentException();
if (offset + length > this.length) {
throw new IllegalArgumentException();
}

out.write(bytes, this.offset + offset, length);
}
@@ -190,7 +204,7 @@ public abstract class CharactersetEncoder {
/**
* The number of containing bytes.
*
* @return
* @return the length
*/
public int getLength() {
return length;

+ 3
- 8
src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java View File

@@ -85,10 +85,6 @@ public abstract class PtocaBuilder implements PtocaConstants {
baout.writeTo(out);
}

private void write(byte[] data, int offset, int length) {
baout.write(data, offset, length);
}

private void writeByte(int data) {
baout.write(data);
}
@@ -180,14 +176,12 @@ public abstract class PtocaBuilder implements PtocaConstants {
currentX = -1;
}

private static final int TRANSPARENT_MAX_SIZE = 253;

/**
* The Transparent Data control sequence contains a sequence of code points
* that are presented without a scan for embedded control sequences. If the data is larger
* than fits in one chunk, additional chunks are automatically generated.
*
* @param data The text data to add.
* @param encodedChars The encoded text data to add.
* @throws IOException if an I/O error occurs
*/
public void addTransparentData(EncodedChars encodedChars) throws IOException {
@@ -206,7 +200,8 @@ public abstract class PtocaBuilder implements PtocaConstants {



private void addTransparentDataChunk(EncodedChars encodedChars, int offset, int length) throws IOException {
private void addTransparentDataChunk(EncodedChars encodedChars, int offset, int length)
throws IOException {
newControlSequence();
encodedChars.writeTo(baout, offset, length);
commit(chained(TRN));

+ 2
- 2
src/java/org/apache/fop/fonts/MultiByteFont.java View File

@@ -47,8 +47,8 @@ public class MultiByteFont extends CIDFont {
setFontType(FontType.TYPE0);
}

/** {@inheritdoc} */
public int getdefaultwidth() {
/** {@inheritDoc} */
public int getDefaultWidth() {
return defaultWidth;
}


+ 3
- 3
src/java/org/apache/fop/render/java2d/InstalledFontCollection.java View File

@@ -38,10 +38,10 @@ public class InstalledFontCollection implements FontCollection {

private static Log log = LogFactory.getLog(InstalledFontCollection.class);

private static final Set HARDCODED_FONT_NAMES;
private static final Set<String> HARDCODED_FONT_NAMES;

static {
HARDCODED_FONT_NAMES = new java.util.HashSet();
HARDCODED_FONT_NAMES = new java.util.HashSet<String>();
HARDCODED_FONT_NAMES.add("any");
HARDCODED_FONT_NAMES.add("sans-serif");
HARDCODED_FONT_NAMES.add("serif");
@@ -58,7 +58,7 @@ public class InstalledFontCollection implements FontCollection {
}

/** Required by new instances of FontMetricsMapper */
final private Java2DFontMetrics java2DFontMetrics;
private final Java2DFontMetrics java2DFontMetrics;

/**
* Main constructor

+ 1
- 1
src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java View File

@@ -168,7 +168,7 @@ public class PSImageHandlerGraphics2D implements PSImageHandler {
return formGen;
}

private static abstract class EPSFormGenerator extends FormGenerator {
private abstract static class EPSFormGenerator extends FormGenerator {

EPSFormGenerator(String formName, String title, Dimension2D dimensions) {
super(formName, title, dimensions);

Loading…
Cancel
Save