3
PDFBox를 구현할 때 다른 글꼴을 테스트하여 여러 언어로 문자열을 쓰는 방법을 만들었습니다. PDFBox - 서로 게이트 쌍으로 구성된 문자열을 인코딩 할 수 없습니다.
PDFont currentFont = PDType0Font.load(pdfDocument, new File("path/to/font/font.ttf"));
for (int offset = 0; offset < sValue.length();) {
int iCodePoint = sValue.codePointAt(offset);
boolean isEncodable = isCodePointEncodable(currentFont, iCodePoint);
//-Further logic here, etc.
offset += Character.charCount(iCodePoint);
}
private boolean isCodePointEncodable (PDFont currentFont, int iCodePoint) throws IOException {
StringBuilder st = new StringBuilder();
st.appendCodePoint(iCodePoint);
try {
currentFont.encode(st.toString());
return true;
} catch (IllegalArgumentException iae) {
return false;
}
}
이 기본 다국어 평면 (BMP)에서 아무것도 잘 작동하지만
는 BMP 넘어 unicodes을 포함 아무것도 작동하지 않습니다. 관련된 글꼴을 그림 문자 차트로 다운로드하여보고 각 코드를 기록했습니다. 예를 들어, U + 1F681 (또는 십진수 128641) 인 코드를 시도 할 때 로깅을 추적하여이 문자를 정확히 일치시키는 NotoEmoji-Regular.ttf에이 문자를 인코딩하려고 시도했으며 실제로이 문자가 있음을 발견했습니다. 불행히도 여전히 false를 반환했습니다.Code Point 128641() cannot be encoded in font NotoEmoji
이에 대한 대안이나 해결책이 있습니다
는 특히, 내 로깅 서버는이 반환? 고맙습니다.