1 17 18 19 20 package org.apache.fop.fonts; 21 22 25 public class SingleByteFont extends CustomFont { 26 27 private CodePointMapping mapping; 28 29 private String encoding = "WinAnsiEncoding"; 30 31 private int[] width = null; 32 33 36 public SingleByteFont() { 37 updateMapping(); 38 } 39 40 43 protected void updateMapping() { 44 mapping = CodePointMapping.getMapping(getEncoding()); 45 } 46 47 50 public boolean isEmbeddable() { 51 return (getEmbedFileName() == null && getEmbedResourceName() == null) ? false 52 : true; 53 } 54 55 58 public String getEncoding() { 59 return encoding; 60 } 61 62 66 public void setEncoding(String encoding) { 67 this.encoding = encoding; 68 updateMapping(); 69 } 70 71 74 public int getWidth(int i, int size) { 75 return size * width[i]; 76 } 77 78 81 public int[] getWidths() { 82 int[] arr = new int[width.length]; 83 System.arraycopy(width, 0, arr, 0, width.length - 1); 84 return arr; 85 } 86 87 90 public char mapChar(char c) { 91 char d = mapping.mapChar(c); 92 if (d != 0) { 93 return d; 94 } else { 95 return '#'; 96 } 97 } 98 99 102 public boolean hasChar(char c) { 103 return (mapping.mapChar(c) > 0); 104 } 105 106 107 108 113 public void setWidth(int index, int width) { 114 if (this.width == null) { 115 this.width = new int[256]; 116 } 117 this.width[index] = width; 118 } 119 120 public char[] getCharsUsed() { 121 return null; 122 } 123 } 124 125 | Popular Tags |