Skip to content

Commit

Permalink
PDFBOX-5961: refactor
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923999 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Feb 23, 2025
1 parent ff6b299 commit d17444c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,24 +349,24 @@ private int toCIDFromRanges(byte[] code)
*/
void addCharMapping(byte[] codes, String unicode)
{
if (codes.length == 1)
switch (codes.length)
{
charToUnicodeOneByte.put(CMapStrings.getIndexValue(codes), unicode);
unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
}
else if (codes.length == 2)
{
charToUnicodeTwoBytes.put(CMapStrings.getIndexValue(codes), unicode);
unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
}
else if (codes.length == 3 || codes.length == 4)
{
charToUnicodeMoreBytes.put(toInt(codes), unicode);
unicodeToByteCodes.put(unicode, codes.clone());
}
else
{
LOG.warn("Mappings with more than 4 bytes (here: {}) aren't supported yet", codes.length);
case 1:
charToUnicodeOneByte.put(CMapStrings.getIndexValue(codes), unicode);
unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
break;
case 2:
charToUnicodeTwoBytes.put(CMapStrings.getIndexValue(codes), unicode);
unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
break;
case 3:
case 4:
charToUnicodeMoreBytes.put(toInt(codes), unicode);
unicodeToByteCodes.put(unicode, codes.clone());
break;
default:
LOG.warn("Mappings with more than 4 bytes (here: {}) aren't supported yet", codes.length);
break;
}
// fixme: ugly little hack
if (SPACE.equals(unicode))
Expand Down

0 comments on commit d17444c

Please sign in to comment.