1 /** 2 * Describes an encoder 3 */ 4 module harud.encoder; 5 6 import harud.c; 7 import harud.haruobject; 8 import harud.types; 9 10 /** 11 * Encoder class 12 */ 13 class Encoder : IHaruObject { 14 protected HPDF_Encoder _encoder; 15 16 this(HPDF_Encoder encoder) { 17 _encoder = encoder; 18 } 19 20 /** 21 * Gets the type of an encoding object. 22 * 23 * Returns: 24 * a Encoder value 25 */ 26 HaruEncoderType getType() { 27 return HPDF_Encoder_GetType(this._encoder); 28 } 29 30 /** 31 * Get the type of byte in the text at position index. 32 * 33 * Returns: 34 * a $(LINK2 harud/c/types/HaruByteType.html, HaruByteType) value 35 */ 36 HaruByteType getByteType(char[] text, uint index) { 37 return HPDF_Encoder_GetByteType(this._encoder, cast(char*)text, index); 38 } 39 40 /** 41 * Converts a specified character code to unicode. 42 * 43 * Params: 44 * code = A character code to convert. 45 * 46 * Returns: 47 * the converted character to unicode 48 */ 49 HPDF_UNICODE getUnicode(ushort code) { 50 return HPDF_Encoder_GetUnicode(this._encoder, code); 51 } 52 53 unittest { 54 55 } 56 57 /** 58 * Gets the writing mode for the encoding object. 59 * 60 * Returns: 61 * a $(LINK2 harud/c/types/HaruWritingMode.html, HaruWritingMode) value 62 */ 63 HaruWritingMode getWritingMode() { 64 return HPDF_Encoder_GetWritingMode(this._encoder); 65 } 66 67 public HPDF_HANDLE getHandle() { 68 return _encoder; 69 } 70 }