@Override public boolean charExists(int c) { if (cjkMirror != null) return cjkMirror.charExists(c); else if (isType0) { return metrics.containsKey(Integer.valueOf(c)); } else return super.charExists(c); }
@Override public boolean charExists(int c) { if (cjkMirror != null) return cjkMirror.charExists(c); else if (isType0) { return metrics.containsKey(Integer.valueOf(c)); } else return super.charExists(c); }
for (int f = 0; f < fonts.size(); ++f) { font = fonts.get(f); if (font.getBaseFont().charExists(u) || Character.getType(u) == Character.FORMAT) { if (currentFont != font) { if (sb.length() > 0 && currentFont != null) { for (int f = 0; f < fonts.size(); ++f) { font = fonts.get(f); if (font.getBaseFont().charExists(c) || Character.getType(c) == Character.FORMAT) { if (currentFont != font) { if (sb.length() > 0 && currentFont != null) {
public static FontGroup getUnicodeGroup( char ch, Font font, Font fontAsian, Font fontComplex ) { if ( font != null && font.getBaseFont() != null ) { if ( font.getBaseFont().charExists( ch ) ) { return WESTERN; } } if ( fontAsian != null && fontAsian.getBaseFont() != null ) { if ( fontAsian.getBaseFont().charExists( ch ) ) { return ASIAN; } } if ( fontComplex != null && fontComplex.getBaseFont() != null ) { if ( fontComplex.getBaseFont().charExists( ch ) ) { return COMPLEX; } } return WESTERN; } }
@Override public void emit(RichText text, ITextContext context) { StringBuilder b = new StringBuilder(); Font font = text.getFont(); BaseFont baseFont = font.getBaseFont(); for (char c : text.getText().toCharArray()) { if (!baseFont.charExists(c)) { emitText(context, b, font); reset(b); emitSymbol(context, String.valueOf(c)); } else { b.append(c); } } emitText(context, b, font); }
for (int f = 0; f < getSize(); ++f) { font = getFont(f); if (font.getBaseFont().charExists(u) || Character.getType(u) == Character.FORMAT) { if (currentFont != font) { if (sb.length() > 0 && currentFont != null) { for (int f = 0; f < getSize(); ++f) { font = getFont(f); if (font.getBaseFont().charExists(c) || Character.getType(c) == Character.FORMAT) { if (currentFont != font) { if (sb.length() > 0 && currentFont != null) {
private String replaceMissingCharacters(String string) { char[] charArr = string.toCharArray(); char replacementCharacter = Configuration.valueAsChar("xr.renderer.missing-character-replacement", '#'); // first check to see if the replacement character even exists in the // given font. If not, then do nothing. if (!_font.getFontDescription().getFont().charExists(replacementCharacter)) { XRLog.render(Level.INFO, "Missing replacement character [" + replacementCharacter + ":" + (int) replacementCharacter + "]. No replacement will occur."); return string; } // iterate through each character in the string and make an appropriate // replacement for (int i = 0; i < charArr.length; i++) { if (!(charArr[i] == ' ' || charArr[i] == '\u00a0' || charArr[i] == '\u3000' || _font.getFontDescription().getFont() .charExists(charArr[i]))) { XRLog.render(Level.INFO, "Missing character [" + charArr[i] + ":" + (int) charArr[i] + "] in string [" + string + "]. Replacing with '" + replacementCharacter + "'"); charArr[i] = replacementCharacter; } } return String.valueOf(charArr); }