1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: pdffontparser.h 3 // Purpose: 4 // Author: Ulrich Telle 5 // Created: 2007-06-26 6 // Copyright: (c) Ulrich Telle 7 // Licence: wxWindows licence 8 /////////////////////////////////////////////////////////////////////////////// 9 10 /// \file pdffontparser.h Interface of the TrueType/OpenType font parsing support classes 11 12 #ifndef _PDF_FONT_PARSER_H_ 13 #define _PDF_FONT_PARSER_H_ 14 15 // wxWidgets headers 16 #include <wx/arrstr.h> 17 #include <wx/string.h> 18 #include <wx/stream.h> 19 20 // wxPdfDocument headers 21 #include "wx/pdfdocdef.h" 22 23 /// Class representing font parsers 24 class WXDLLIMPEXP_PDFDOC wxPdfFontParser 25 { 26 public: 27 /// Default constructor 28 wxPdfFontParser(); 29 30 /// Default destructor 31 virtual ~wxPdfFontParser(); 32 33 /// Seek to offset in default input stream 34 /** 35 * \param offset offset to be seeked 36 */ 37 void SeekI(int offset); 38 39 /// Seek to offset in specific input stream 40 /** 41 * \param offset offset to be seeked 42 * \param stream input stream 43 */ 44 void SeekI(int offset, wxInputStream* stream); 45 46 /// Tell current position in default input stream 47 /** 48 * \return the current position in the default input stream 49 */ 50 int TellI(); 51 52 /// Tell current position in specific input stream 53 /** 54 * \param stream input stream 55 * \return the current position in the input stream 56 */ 57 int TellI(wxInputStream* stream); 58 59 /// Skip bytes in default input stream 60 /** 61 * \param count number of bytes to skip 62 */ 63 void SkipBytes(int count); 64 65 /// Skip bytes in specific input stream 66 /** 67 * \param count number of bytes to skip 68 * \param stream input stream 69 */ 70 void SkipBytes(int count, wxInputStream* stream); 71 72 /// Read integer from default input stream 73 /** 74 * \return the integer read 75 */ 76 int ReadInt(); 77 78 /// Read short integer from default input stream 79 /** 80 * \return the short integer read 81 */ 82 short ReadShort(); 83 84 /// Read unsigned short integer from default input stream 85 /** 86 * \return the unsigned short integer read 87 */ 88 unsigned short ReadUShort(); 89 90 /// Read byte from default input stream 91 /** 92 * \return the byte read 93 */ 94 unsigned char ReadByte(); 95 96 /// Read byte from specific input stream 97 /** 98 * \param stream input stream 99 * \return the byte read 100 */ 101 unsigned char ReadByte(wxInputStream* stream); 102 103 /// Read string from default input stream 104 /** 105 * \param length the length of the string to read 106 * \return the string read 107 */ 108 wxString ReadString(int length); 109 110 /// Read string from specific input stream 111 /** 112 * \param length the length of the string to read 113 * \param stream input stream 114 * \return the string read 115 */ 116 wxString ReadString(int length, wxInputStream* stream); 117 118 /// Read Unicode string from default input stream 119 /** 120 * \param length the length of the string to read 121 * \return the string read 122 */ 123 wxString ReadUnicodeString(int length); 124 125 /// Read short integer from specific input stream in little endian mode 126 /** 127 * \param stream input stream 128 * \return the short integer read 129 */ 130 short ReadShortLE(wxInputStream* stream); 131 132 /// Read unsigned short integer from specific input stream in little endian mode 133 /** 134 * \param stream input stream 135 * \return the unsigned short integer read 136 */ 137 unsigned short ReadUShortLE(wxInputStream* stream); 138 139 /// Read unsigned integer from specific input stream in little endian mode 140 /** 141 * \param stream input stream 142 * \return the unsigned integer read 143 */ 144 unsigned int ReadUIntLE(wxInputStream* stream); 145 146 /// Read string from specific input stream 147 /** 148 * \param stream input stream 149 * \return the string read 150 */ 151 wxString ReadString(wxInputStream& stream); 152 153 protected: 154 wxString m_fileName; ///< File name of the font file 155 wxString m_fontName; ///< Name of font 156 wxInputStream* m_inFont; ///< Font file input stream 157 wxString m_style; ///< Font style 158 159 private: 160 }; 161 162 #endif 163