static AdobeGlyphList() { Stream resource = null; try { resource = ResourceUtil.GetResourceStream(FontConstants.RESOURCE_PATH + "AdobeGlyphList.txt"); if (resource == null) { String msg = "AdobeGlyphList.txt not found as resource. (It must exist as resource in the package com.itextpdf.text.pdf.fonts)"; throw new Exception(msg); } byte[] buf = new byte[1024]; MemoryStream stream = new MemoryStream(); while (true) { int size = resource.Read(buf); if (size < 0) { break; } stream.Write(buf, 0, size); } resource.Close(); resource = null; String s = PdfEncodings.ConvertToString(stream.ToArray(), null); StringTokenizer tk = new StringTokenizer(s, "\r\n"); while (tk.HasMoreTokens()) { String line = tk.NextToken(); if (line.StartsWith("#")) { continue; } StringTokenizer t2 = new StringTokenizer(line, " ;\r\n\t\f"); if (!t2.HasMoreTokens()) { continue; } String name = t2.NextToken(); if (!t2.HasMoreTokens()) { continue; } String hex = t2.NextToken(); // AdobeGlyphList could contains symbols with marks, e.g.: // resh;05E8 // reshhatafpatah;05E8 05B2 // So in this case we will just skip this nam if (t2.HasMoreTokens()) { continue; } int num = System.Convert.ToInt32(hex, 16); unicode2names[num] = name; names2unicode[name] = num; } } catch (Exception e) { System.Console.Error.WriteLine("AdobeGlyphList.txt loading error: " + e.Message); } finally { if (resource != null) { try { resource.Close(); } catch (Exception) { } } } }
private void WriteFontString(String s) { byte[] b = PdfEncodings.ConvertToBytes(s, PdfEncodings.WINANSI); Array.Copy(b, 0, outFont, fontPtr, b.Length); fontPtr += b.Length; }
protected internal virtual void WriteFontString(String s) { byte[] b = PdfEncodings.ConvertToBytes(s, PdfEncodings.WINANSI); Array.Copy(b, 0, outFont, fontPtr, b.Length); fontPtr += b.Length; }
static AdobeGlyphList() { Stream resource = null; try { resource = ResourceUtil.GetResourceStream(FontResources.ADOBE_GLYPH_LIST); if (resource == null) { throw new Exception(FontResources.ADOBE_GLYPH_LIST + " not found as resource."); } byte[] buf = new byte[1024]; MemoryStream stream = new MemoryStream(); while (true) { int size = resource.Read(buf); if (size < 0) { break; } stream.Write(buf, 0, size); } resource.Dispose(); resource = null; String s = PdfEncodings.ConvertToString(stream.ToArray(), null); StringTokenizer tk = new StringTokenizer(s, "\r\n"); while (tk.HasMoreTokens()) { String line = tk.NextToken(); if (line.StartsWith("#")) { continue; } StringTokenizer t2 = new StringTokenizer(line, " ;\r\n\t\f"); if (!t2.HasMoreTokens()) { continue; } String name = t2.NextToken(); if (!t2.HasMoreTokens()) { continue; } String hex = t2.NextToken(); // AdobeGlyphList could contains symbols with marks, e.g.: // resh;05E8 // reshhatafpatah;05E8 05B2 // So in this case we will just skip this nam if (t2.HasMoreTokens()) { continue; } int num = Convert.ToInt32(hex, 16); unicode2names.Put(num, name); names2unicode.Put(name, num); } } catch (Exception e) { System.Console.Error.WriteLine("AdobeGlyphList.txt loading error: " + e.Message); } finally { if (resource != null) { try { resource.Dispose(); } catch (Exception) { } } } }