home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 720 / PDF090B4-SorceCode / pdf / FontEncoding.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  1.8 KB  |  76 lines

  1. //========================================================================
  2. //
  3. // FontEncoding.h
  4. //
  5. // Copyright 1999 Derek B. Noonburg
  6. //
  7. //========================================================================
  8. //
  9. // Ported to EPOC by Sander van der Wal
  10. //
  11. // $Id: FontEncoding.h 1.2 2000-09-17 13:38:18+02 svdwal Exp svdwal $
  12.  
  13. #ifndef FONTENCODING_H
  14. #define FONTENCODING_H
  15.  
  16. #ifdef __GNUC__
  17. #pragma interface
  18. #endif
  19.  
  20. #ifndef __E32BASE_H__
  21. #include <e32base.h>
  22. #endif
  23.  
  24. #include "gtypes.h"
  25.  
  26. //------------------------------------------------------------------------
  27. // FontEncoding
  28. //------------------------------------------------------------------------
  29.  
  30. #define fontEncHashSize 419
  31.  
  32. class FontEncoding: public CBase {
  33. public:
  34.  
  35.   FontEncoding() {}
  36.  
  37.   // Construct an empty encoding.
  38.   void ConstructL();
  39.  
  40.   // Construct an encoding from an array of char names.
  41.   void Construct(const char* const encoding[], int size);
  42.  
  43.   // Destructor.
  44.   ~FontEncoding();
  45.  
  46.   // Create a copy of the encoding.
  47.   FontEncoding *copyL();
  48.  
  49.   // Return number of codes in encoding, i.e., max code + 1.
  50.   int getSize() { return size; }
  51.  
  52.   // Add a char to the encoding.
  53.   void addChar(int code, const char *name);
  54.  
  55.   // Return the character name associated with <code>.
  56.   const char *getCharName(int code) { return encoding[code]; }
  57.  
  58.   // Return the code associated with <name>.
  59.   int getCharCode(const char *name) const;
  60.  
  61. private:
  62.  
  63.   void ConstructL(FontEncoding *fontEnc);
  64.  
  65.   int hash(const char *name) const;
  66.   void addChar1(int code, const char *name);
  67.  
  68.   const char **encoding;    // code --> name mapping
  69.   int size;            // number of codes
  70.   GBool freeEnc;        // should we free the encoding array?
  71.   short                // name --> code hash table
  72.     hashTab[fontEncHashSize];
  73. };
  74.  
  75. #endif
  76.