Skip to content

Commit

Permalink
PDFBOX-5469: reformat source
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1917616 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
lehmi committed May 9, 2024
1 parent 6a509f6 commit 749cda1
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* This class represents a converter for a mapping into a Type2-sequence.
*
* @author Villu Ruusmann
*/
public class Type2CharStringParser
Expand Down Expand Up @@ -62,13 +63,13 @@ public List<Object> parse(byte[] bytes, byte[][] globalSubrIndex, byte[][] local
return glyphData.sequence;
}

private void parseSequence(byte[] bytes, byte[][] globalSubrIndex,
byte[][] localSubrIndex, GlyphData glyphData)
throws IOException
private void parseSequence(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex,
GlyphData glyphData) throws IOException
{
DataInput input = new DataInputByteArray(bytes);
boolean localSubroutineIndexProvided = localSubrIndex != null && localSubrIndex.length > 0;
boolean globalSubroutineIndexProvided = globalSubrIndex != null && globalSubrIndex.length > 0;
boolean globalSubroutineIndexProvided = globalSubrIndex != null
&& globalSubrIndex.length > 0;

while (input.hasRemaining())
{
Expand All @@ -81,14 +82,14 @@ else if (b0 == CALLGSUBR && globalSubroutineIndexProvided)
{
processCallSubr(globalSubrIndex, localSubrIndex, globalSubrIndex, glyphData);
}
else if ( (b0 >= 0 && b0 <= 27) || (b0 >= 29 && b0 <= 31))
else if ((b0 >= 0 && b0 <= 27) || (b0 >= 29 && b0 <= 31))
{
glyphData.sequence.add(readCommand(b0, input, glyphData));
}
}
else if (b0 == 28 || (b0 >= 32 && b0 <= 255))
{
glyphData.sequence.add(readNumber(b0, input));
}
}
else
{
throw new IllegalArgumentException();
Expand All @@ -97,8 +98,7 @@ else if (b0 == 28 || (b0 >= 32 && b0 <= 255))
}

private void processCallSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex,
byte[][] subrIndex, GlyphData glyphData)
throws IOException
byte[][] subrIndex, GlyphData glyphData) throws IOException
{
int subrNumber = calculateSubrNumber(
(Integer) glyphData.sequence.remove(glyphData.sequence.size() - 1),
Expand Down Expand Up @@ -167,17 +167,17 @@ private Number readNumber(int b0, DataInput input) throws IOException
if (b0 == 28)
{
return (int) input.readShort();
}
}
else if (b0 >= 32 && b0 <= 246)
{
return b0 - 139;
}
}
else if (b0 >= 247 && b0 <= 250)
{
int b1 = input.readUnsignedByte();

return (b0 - 247) * 256 + b1 + 108;
}
}
else if (b0 >= 251 && b0 <= 254)
{
int b1 = input.readUnsignedByte();
Expand All @@ -190,7 +190,7 @@ else if (b0 == 255)
// The lower bytes are representing the digits after the decimal point
double fraction = input.readUnsignedShort() / 65535d;
return value + fraction;
}
}
else
{
throw new IllegalArgumentException();
Expand All @@ -200,7 +200,7 @@ else if (b0 == 255)
private int getMaskLength(int hstemCount, int vstemCount)
{
int hintCount = hstemCount + vstemCount;
int length = hintCount / 8;
int length = hintCount / 8;
if (hintCount % 8 > 0)
{
length++;
Expand Down

0 comments on commit 749cda1

Please sign in to comment.