1 51 package org.apache.fop.pdf; 52 53 60 public class PDFCMap extends PDFStream { 61 62 65 public static final String GB_EUC_H = "GB-EUC-H"; 66 public static final String GB_EUC_V = "GB_EUC_V"; 67 public static final String GBpc_EUC_H = "GBpc-EUC-H"; 68 public static final String GBpc_EUC_V = "GBpc-EUC-V"; 69 public static final String GBK_EUC_H = "GBK-EUC-H"; 70 public static final String GBK_EUC_V = "GBK-EUC-V"; 71 public static final String UniGB_UCS2_H = "UniGB-UCS2-H"; 72 public static final String UniGB_UCS2_V = "UniGB-UCS2-V"; 73 74 77 public static final String B5pc_H = "B5pc-H"; 78 public static final String B5pc_V = "B5pc-V"; 79 public static final String ETen_B5_H = "ETen-B5-H"; 80 public static final String ETen_B5_V = "ETen-B5-V"; 81 public static final String ETenms_B5_H = "ETenms-B5-H"; 82 public static final String ETenms_B5_V = "ETenms-B5-V"; 83 public static final String CNS_EUC_H = "CNS-EUC-H"; 84 public static final String CNS_EUC_V = "CNS-EUC-V"; 85 public static final String UniCNS_UCS2_H = "UniCNS-UCS2-H"; 86 public static final String UniCNS_UCS2_V = "UniCNS-UCS2-V"; 87 88 91 public static final String _83pv_RKSJ_H = "83pv-RKSJ-H"; public static final String _90ms_RKSJ_H = "90ms-RKSJ-H"; 93 public static final String _90ms_RKSJ_V = "90ms-RKSJ-V"; 94 public static final String _90msp_RKSJ_H = "90msp-RKSJ-H"; 95 public static final String _90msp_RKSJ_V = "90msp-RKSJ-V"; 96 public static final String _90pv_RKSJ_H = "90pv-RKSJ-H"; public static final String Add_RKSJ_H = "Add-RKSJ-H"; 98 public static final String Add_RKSJ_V = "Add-RKSJ-V"; 99 public static final String EUC_H = "EUC-H"; 100 public static final String EUC_V = "EUC-V"; 101 public static final String Ext_RKSJ_H = "Ext-RKSJ-H"; 102 public static final String Ext_RKSJ_V = "Ext-RKSJ-V"; 103 public static final String H = "H"; 104 public static final String V = "V"; 105 public static final String UniJIS_UCS2_H = "UniJIS-UCS2-H"; 106 public static final String UniJIS_UCS2_V = "UniJIS-UCS2-V"; 107 public static final String UniJIS_UCS2_HW_H = "UniJIS-UCS2-HW-H"; 108 public static final String UniJIS_UCS2_HW_V = "UniJIS-UCS2-HW-V"; 109 110 113 public static final String KSC_EUC_H = "KSC-EUC-H"; 114 public static final String KSC_EUC_V = "KSC-EUC-V"; 115 public static final String KSCms_UHC_H = "KSCms-UHC-H"; 116 public static final String KSCms_UHC_V = "KSCms-UHC-V"; 117 public static final String KSCms_UHC_HW_H = "KSCms-UHC-HW-H"; 118 public static final String KSCms_UHC_HW_V = "KSCms-UHC-HW-V"; 119 public static final String KSCpc_EUC_H = "KSCpc-EUC-H"; public static final String UniKSC_UCS2_H = "UniKSC-UCS2-H"; 121 public static final String UniKSC_UCS2_V = "UniKSC-UCS2-V"; 122 123 126 public static final String Identity_H = "Identity-H"; 127 public static final String Identity_V = "Identity-V"; 128 129 132 protected String name; 133 134 137 protected PDFCIDSystemInfo sysInfo; 138 139 142 public static final byte WMODE_HORIZONTAL = 0; 143 144 147 public static final byte WMODE_VERTICAL = 1; 148 149 152 protected byte wMode = WMODE_HORIZONTAL; 153 154 157 protected Object base; 158 159 165 public PDFCMap(int number, String name, PDFCIDSystemInfo sysInfo) { 166 super(number); 167 this.name = name; 168 this.sysInfo = sysInfo; 169 this.base = null; 170 } 171 172 178 public void setWMode(byte mode) { 179 this.wMode = mode; 180 } 181 182 public void addContents() { 183 StringBuffer p = new StringBuffer (); 184 fillInPDF(p); 185 add(p.toString()); 186 } 187 188 193 public void setUseCMap(String base) { 194 this.base = base; 195 } 196 197 202 public void setUseCMap(PDFStream base) { 203 this.base = base; 204 } 205 206 public void fillInPDF(StringBuffer p) { 207 p.append("%!PS-Adobe-3.0 Resource-CMap\n"); 212 p.append("%%DocumentNeededResources: ProcSet (CIDInit)\n"); 213 p.append("%%IncludeResource: ProcSet (CIDInit)\n"); 214 p.append("%%BeginResource: CMap (" + name + ")\n"); 215 p.append("%%EndComments\n"); 216 217 p.append("/CIDInit /ProcSet findresource begin\n"); 218 p.append("12 dict begin\n"); 219 p.append("begincmap\n"); 220 221 p.append("/CIDSystemInfo 3 dict dup begin\n"); 222 p.append(" /Registry (Adobe) def\n"); 223 p.append(" /Ordering (Identity) def\n"); 224 p.append(" /Supplement 0 def\n"); 225 p.append("end def\n"); 226 227 p.append("/CMapVersion 1 def\n"); 228 p.append("/CMapType 1 def\n"); 229 p.append("/CMapName /" + name + " def\n"); 230 231 p.append("1 begincodespacerange\n"); 232 p.append("<0000> <FFFF>\n"); 233 p.append("endcodespacerange\n"); 234 p.append("1 begincidrange\n"); 235 p.append("<0000> <FFFF> 0\n"); 236 p.append("endcidrange\n"); 237 238 242 p.append("endcmap\n"); 243 p.append("CMapName currentdict /CMap defineresource pop\n"); 244 p.append("end\n"); 245 p.append("end\n"); 246 p.append("%%EndResource\n"); 247 p.append("%%EOF\n"); 248 261 } 262 263 } 264 | Popular Tags |