org.jpedal.fonts.EncodingUNIJIS Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* EncodingUNIJIS.java
* ---------------
*/
package org.jpedal.fonts;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import org.jpedal.utils.LogWriter;
public class EncodingUNIJIS implements CmapEncoding {
private final int[] uniMap = new int[65536];
public EncodingUNIJIS() {
final ClassLoader loader = this.getClass().getClassLoader();
String line;
int u16, unicodeVal;
final BufferedReader input_stream;
String xx, yy;
try {
input_stream = new BufferedReader(
new InputStreamReader(loader.getResourceAsStream("org/jpedal/res/pdf/jis.cfg")));
while (true) {
line = input_stream.readLine();
if (line == null) {
break;
}
if (line.startsWith("0x")) {
final StringTokenizer values = new StringTokenizer(line);
xx = values.nextToken().substring(2);
yy = values.nextToken().substring(2);
u16 = Integer.parseInt(xx, 16);
unicodeVal = Integer.parseInt(yy, 16);
uniMap[u16] = unicodeVal;
}
}
input_stream.close();
} catch (final Exception e) {
e.printStackTrace();
LogWriter.writeLog("Exception: " + e.getMessage());
}
}
@Override
public int getUnicodeValue(final int cid) {
return uniMap[cid];
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy