private static String getCompatibleUniMap(String registry) { String uniMap = ""; for (String name : CidFontProperties.getRegistryNames().get(registry + "_Uni")) { uniMap = name; if (name.endsWith("H")) { break; } } return uniMap; } }
private static Map<String, Object> readFontProperties(String name) throws java.io.IOException { name += ".properties"; InputStream resource = ResourceUtil.getResourceStream(FontResources.CMAPS + name); Properties p = new Properties(); p.load(resource); resource.close(); IntHashtable W = createMetric(p.getProperty("W")); p.remove("W"); IntHashtable W2 = createMetric(p.getProperty("W2")); p.remove("W2"); Map<String, Object> map = new HashMap<String, Object>(); for (Object obj : p.keySet()) { map.put((String)obj, p.getProperty((String)obj)); } map.put("W", W); map.put("W2", W2); return map; }
CidFont(String fontName, Set<String> cmaps) { this.fontName = fontName; compatibleCmaps = cmaps; fontNames = new FontNames(); initializeCidFontNameAndStyle(fontName); Map<String, Object> fontDesc = CidFontProperties.getAllFonts().get(fontNames.getFontName()); if (fontDesc == null) { throw new IOException("There is no such predefined font: {0}").setMessageParams(fontName); } initializeCidFontProperties(fontDesc); }
PdfType0Font(CidFont font, String cmap) { super(); if (!CidFontProperties.isCidFont(font.getFontNames().getFontName(), cmap)) { throw new PdfException("Font {0} with {1} encoding is not a cjk font.") .setMessageParams(font.getFontNames().getFontName(), cmap); } this.fontProgram = font; vertical = cmap.endsWith("V"); String uniMap = getCompatibleUniMap(fontProgram.getRegistry()); cmapEncoding = new CMapEncoding(cmap, uniMap); longTag = new HashSet<>(); cidFontType = CID_FONT_TYPE_0; }
CidFont(String fontName, Set<String> cmaps) { this.fontName = fontName; compatibleCmaps = cmaps; fontNames = new FontNames(); initializeCidFontNameAndStyle(fontName); Map<String, Object> fontDesc = CidFontProperties.getAllFonts().get(fontNames.getFontName()); if (fontDesc == null) { throw new IOException("There is no such predefined font: {0}").setMessageParams(fontName); } initializeCidFontProperties(fontDesc); }
String cidFontName = cidFont.getAsName(PdfName.BaseFont).getValue(); String uniMap = getUniMapFromOrdering(getOrdering(cidFont)); if (uniMap != null && uniMap.startsWith("Uni") && CidFontProperties.isCidFont(cidFontName, uniMap)) { try { fontProgram = FontProgramFactory.createFont(cidFontName);
private static String getCompatibleUniMap(String registry) { String uniMap = ""; for (String name : CidFontProperties.getRegistryNames().get(registry + "_Uni")) { uniMap = name; if (name.endsWith("H")) { break; } } return uniMap; } }
private static Map<String, Object> readFontProperties(String name) throws java.io.IOException { name += ".properties"; InputStream resource = ResourceUtil.getResourceStream(FontResources.CMAPS + name); Properties p = new Properties(); p.load(resource); resource.close(); IntHashtable W = createMetric(p.getProperty("W")); p.remove("W"); IntHashtable W2 = createMetric(p.getProperty("W2")); p.remove("W2"); Map<String, Object> map = new HashMap<String, Object>(); for (Object obj : p.keySet()) { map.put((String)obj, p.getProperty((String)obj)); } map.put("W", W); map.put("W2", W2); return map; }
private String getCompatibleUniMap(String registry) { String uniMap = ""; for (String name : CidFontProperties.getRegistryNames().get(registry + "_Uni")) { uniMap = name; if (name.endsWith("V") && vertical) { break; } else if (!name.endsWith("V") && !vertical) { break; } } return uniMap; }