1 51 package org.apache.fop.render.mif; 52 53 import org.apache.fop.render.mif.fonts.*; 55 import org.apache.fop.messaging.MessageHandler; 56 import org.apache.fop.layout.FontInfo; 57 import org.apache.fop.layout.FontDescriptor; 58 import org.apache.fop.mif.MIFDocument; 59 61 import java.util.Iterator ; 63 import java.util.HashMap ; 64 65 71 public class FontSetup { 72 73 81 public static void setup(FontInfo fontInfo) { 82 MessageHandler.logln("setting up fonts"); 83 84 fontInfo.addMetrics("F1", new Helvetica()); 85 fontInfo.addMetrics("F2", new HelveticaOblique()); 86 fontInfo.addMetrics("F3", new HelveticaBold()); 87 fontInfo.addMetrics("F4", new HelveticaBoldOblique()); 88 fontInfo.addMetrics("F5", new TimesRoman()); 89 fontInfo.addMetrics("F6", new TimesItalic()); 90 fontInfo.addMetrics("F7", new TimesBold()); 91 fontInfo.addMetrics("F8", new TimesBoldItalic()); 92 fontInfo.addMetrics("F9", new Courier()); 93 fontInfo.addMetrics("F10", new CourierOblique()); 94 fontInfo.addMetrics("F11", new CourierBold()); 95 fontInfo.addMetrics("F12", new CourierBoldOblique()); 96 fontInfo.addMetrics("F13", new Symbol()); 97 fontInfo.addMetrics("F14", new ZapfDingbats()); 98 99 104 105 fontInfo.addFontProperties("F5", "any", "normal", "normal"); 106 fontInfo.addFontProperties("F6", "any", "italic", "normal"); 107 fontInfo.addFontProperties("F6", "any", "oblique", "normal"); 108 fontInfo.addFontProperties("F7", "any", "normal", "bold"); 109 fontInfo.addFontProperties("F8", "any", "italic", "bold"); 110 fontInfo.addFontProperties("F8", "any", "oblique", "bold"); 111 112 fontInfo.addFontProperties("F1", "sans-serif", "normal", "normal"); 113 fontInfo.addFontProperties("F2", "sans-serif", "oblique", "normal"); 114 fontInfo.addFontProperties("F2", "sans-serif", "italic", "normal"); 115 fontInfo.addFontProperties("F3", "sans-serif", "normal", "bold"); 116 fontInfo.addFontProperties("F4", "sans-serif", "oblique", "bold"); 117 fontInfo.addFontProperties("F4", "sans-serif", "italic", "bold"); 118 fontInfo.addFontProperties("F5", "serif", "normal", "normal"); 119 fontInfo.addFontProperties("F6", "serif", "oblique", "normal"); 120 fontInfo.addFontProperties("F6", "serif", "italic", "normal"); 121 fontInfo.addFontProperties("F7", "serif", "normal", "bold"); 122 fontInfo.addFontProperties("F8", "serif", "oblique", "bold"); 123 fontInfo.addFontProperties("F8", "serif", "italic", "bold"); 124 fontInfo.addFontProperties("F9", "monospace", "normal", "normal"); 125 fontInfo.addFontProperties("F10", "monospace", "oblique", "normal"); 126 fontInfo.addFontProperties("F10", "monospace", "italic", "normal"); 127 fontInfo.addFontProperties("F11", "monospace", "normal", "bold"); 128 fontInfo.addFontProperties("F12", "monospace", "oblique", "bold"); 129 fontInfo.addFontProperties("F12", "monospace", "italic", "bold"); 130 131 fontInfo.addFontProperties("F1", "Helvetica", "normal", "normal"); 132 fontInfo.addFontProperties("F2", "Helvetica", "oblique", "normal"); 133 fontInfo.addFontProperties("F2", "Helvetica", "italic", "normal"); 134 fontInfo.addFontProperties("F3", "Helvetica", "normal", "bold"); 135 fontInfo.addFontProperties("F4", "Helvetica", "oblique", "bold"); 136 fontInfo.addFontProperties("F4", "Helvetica", "italic", "bold"); 137 fontInfo.addFontProperties("F5", "Times", "normal", "normal"); 138 fontInfo.addFontProperties("F6", "Times", "oblique", "normal"); 139 fontInfo.addFontProperties("F6", "Times", "italic", "normal"); 140 fontInfo.addFontProperties("F7", "Times", "normal", "bold"); 141 fontInfo.addFontProperties("F8", "Times", "oblique", "bold"); 142 fontInfo.addFontProperties("F8", "Times", "italic", "bold"); 143 fontInfo.addFontProperties("F9", "Courier", "normal", "normal"); 144 fontInfo.addFontProperties("F10", "Courier", "oblique", "normal"); 145 fontInfo.addFontProperties("F10", "Courier", "italic", "normal"); 146 fontInfo.addFontProperties("F11", "Courier", "normal", "bold"); 147 fontInfo.addFontProperties("F12", "Courier", "oblique", "bold"); 148 fontInfo.addFontProperties("F12", "Courier", "italic", "bold"); 149 fontInfo.addFontProperties("F13", "Symbol", "normal", "normal"); 150 fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", "normal"); 151 152 157 158 fontInfo.addFontProperties("F5", "Times-Roman", "normal", "normal"); 159 fontInfo.addFontProperties("F6", "Times-Roman", "oblique", "normal"); 160 fontInfo.addFontProperties("F6", "Times-Roman", "italic", "normal"); 161 fontInfo.addFontProperties("F7", "Times-Roman", "normal", "bold"); 162 fontInfo.addFontProperties("F8", "Times-Roman", "oblique", "bold"); 163 fontInfo.addFontProperties("F8", "Times-Roman", "italic", "bold"); 164 fontInfo.addFontProperties("F5", "Times Roman", "normal", "normal"); 165 fontInfo.addFontProperties("F6", "Times Roman", "oblique", "normal"); 166 fontInfo.addFontProperties("F6", "Times Roman", "italic", "normal"); 167 fontInfo.addFontProperties("F7", "Times Roman", "normal", "bold"); 168 fontInfo.addFontProperties("F8", "Times Roman", "oblique", "bold"); 169 fontInfo.addFontProperties("F8", "Times Roman", "italic", "bold"); 170 fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter", 171 "normal", "normal"); 172 } 173 174 180 public static void addToFontFormat(MIFDocument mifDoc, 181 FontInfo fontInfo) { 182 183 HashMap fonts = fontInfo.getFonts(); 184 Iterator e = fonts.keySet().iterator(); 185 while (e.hasNext()) { 186 String f = (String )e.next(); 187 Font font = (Font)fonts.get(f); 188 FontDescriptor desc = null; 189 if (font instanceof FontDescriptor) { 190 desc = (FontDescriptor)font; 191 } 192 199 200 } 201 } 202 203 } 204 | Popular Tags |