protected internal virtual void FillCustomEncoding() { differences = new String[256]; StringTokenizer tok = new StringTokenizer(baseEncoding.Substring(1), " ,\t\n\r\f"); if (tok.NextToken().Equals("full")) { while (tok.HasMoreTokens()) { String order = tok.NextToken(); String name = tok.NextToken(); char uni = (char)Convert.ToInt32(tok.NextToken(), 16); int uniName = AdobeGlyphList.NameToUnicode(name); int orderK; if (order.StartsWith("'")) { orderK = order[1]; } else { orderK = Convert.ToInt32(order); } orderK %= 256; unicodeToCode.Put(uni, orderK); codeToUnicode[orderK] = (int)uni; differences[orderK] = name; unicodeDifferences.Put(uni, uniName); } } else { int k = 0; if (tok.HasMoreTokens()) { k = Convert.ToInt32(tok.NextToken()); } while (tok.HasMoreTokens() && k < 256) { String hex = tok.NextToken(); int uni = Convert.ToInt32(hex, 16) % 0x10000; String name = AdobeGlyphList.UnicodeToName(uni); if (name == null) { name = "uni" + hex; } unicodeToCode.Put(uni, k); codeToUnicode[k] = uni; differences[k] = name; unicodeDifferences.Put(uni, uni); k++; } } for (int k = 0; k < 256; k++) { if (differences[k] == null) { differences[k] = NOTDEF; } } }
protected internal virtual void FillNamedEncoding() { PdfEncodings.ConvertToBytes(" ", baseEncoding); // check if the encoding exists bool stdEncoding = PdfEncodings.WINANSI.Equals(baseEncoding) || PdfEncodings.MACROMAN.Equals(baseEncoding); if (!stdEncoding && differences == null) { differences = new String[256]; } byte[] b = new byte[256]; for (int k = 0; k < 256; ++k) { b[k] = (byte)k; } String str = PdfEncodings.ConvertToString(b, baseEncoding); char[] encoded = str.ToCharArray(); for (int ch = 0; ch < 256; ++ch) { char uni = encoded[ch]; String name = AdobeGlyphList.UnicodeToName(uni); if (name == null) { name = FontConstants.notdef; } else { unicodeToCode.Put(uni, ch); codeToUnicode[ch] = (int)uni; unicodeDifferences.Put(uni, uni); } if (differences != null) { differences[ch] = name; } } }
public virtual bool AddSymbol(int code, int unicode) { if (code < 0 || code > 255) { return false; } String glyphName = AdobeGlyphList.UnicodeToName(unicode); if (glyphName != null) { unicodeToCode.Put(unicode, code); codeToUnicode[code] = unicode; differences[code] = glyphName; unicodeDifferences.Put(unicode, unicode); return true; } else { return false; } }
protected internal virtual void FillStandardEncoding() { int[] encoded = PdfEncodings.standardEncoding; for (int ch = 0; ch < 256; ++ch) { int uni = encoded[ch]; String name = AdobeGlyphList.UnicodeToName(uni); if (name == null) { name = FontConstants.notdef; } else { unicodeToCode.Put(uni, ch); codeToUnicode[ch] = uni; unicodeDifferences.Put(uni, uni); } if (differences != null) { differences[ch] = name; } } }