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

  1. //========================================================================
  2. //
  3. // FontFile.h
  4. //
  5. // Copyright 1999 Derek B. Noonburg
  6. //
  7. //========================================================================
  8. //
  9. // Ported to EPOC by Sander van der Wal
  10. //
  11. // $Id: FontFile.h 1.2 2000-09-17 13:38:18+02 svdwal Exp svdwal $
  12.  
  13. #ifndef FONTFILE_H
  14. #define FONTFILE_H
  15.  
  16. #ifdef __GNUC__
  17. #pragma interface
  18. #endif
  19.  
  20. #ifndef __E32BASE_H__
  21. #include <e32base.h>
  22. #endif
  23.  
  24. #include <stdio.h>
  25.  
  26. #include "gtypes.h"
  27. #include "GString.h"
  28.  
  29. #include "FontEncoding.h"
  30.  
  31. //------------------------------------------------------------------------
  32. // FontFile
  33. //------------------------------------------------------------------------
  34.  
  35. class FontFile: public CBase {
  36. public:
  37.  
  38.   FontFile();
  39.   virtual ~FontFile();
  40.  
  41.   // Returns the font name, as specified internally by the font file.
  42.   // Returns NULL if no name is available.
  43.   virtual char *getName() = 0;
  44.  
  45.   // Returns the custom font encoding, or NULL if the encoding is
  46.   // not available.  If <taken> is set, the caller of this function
  47.   // will be responsible for freeing the encoding object.
  48.   virtual FontEncoding *getEncoding(GBool taken) = 0;
  49. };
  50.  
  51. //------------------------------------------------------------------------
  52. // Type1FontFile
  53. //------------------------------------------------------------------------
  54.  
  55. class Type1FontFile: public FontFile {
  56. public:
  57.  
  58.   Type1FontFile();
  59.   void ConstructL(char *file, int len);
  60.   static Type1FontFile* NewL(char *file, int len);
  61.   static Type1FontFile* NewLC(char *file, int len);
  62.   virtual ~Type1FontFile();
  63.   virtual char *getName() { return name; }
  64.   virtual FontEncoding *getEncoding(GBool taken);
  65.  
  66. private:
  67.  
  68.   char *name;
  69.   FontEncoding *encoding;
  70.   GBool freeEnc;
  71. };
  72.  
  73. //------------------------------------------------------------------------
  74. // Type1CFontFile
  75. //------------------------------------------------------------------------
  76.  
  77. class Type1CFontFile: public FontFile {
  78. public:
  79.  
  80.   Type1CFontFile();
  81.   void ConstructL(char *file, int len);
  82.   static Type1CFontFile* NewL(char *file, int len);
  83.   static Type1CFontFile* NewLC(char *file, int len);
  84.   virtual ~Type1CFontFile();
  85.   virtual char *getName() { return name; }
  86.   virtual FontEncoding *getEncoding(GBool taken);
  87.  
  88. private:
  89.  
  90.   char *name;
  91.   FontEncoding *encoding;
  92.   GBool freeEnc;
  93. };
  94.  
  95. //------------------------------------------------------------------------
  96. // Type1CFontConverter
  97. //------------------------------------------------------------------------
  98.  
  99. class Type1CFontConverter {
  100. public:
  101.  
  102.   Type1CFontConverter(char *file, int len, FILE *out);
  103.   ~Type1CFontConverter();
  104.   void convert();
  105.  
  106. private:
  107.  
  108.   void eexecWrite(char *s);
  109.   void cvtGlyph(char *name, Guchar *s, int n);
  110.   void cvtGlyphWidth(GBool useOp);
  111.   void eexecDumpNum(double x, GBool fp);
  112.   void eexecDumpOp1(int op);
  113.   void eexecDumpOp2(int op);
  114.   void eexecWriteCharstring(Guchar *s, int n);
  115.   void getDeltaInt(char *buf, char *name, double *op, int n);
  116.   void getDeltaReal(char *buf, char *name, double *op, int n);
  117.  
  118.   char *file;
  119.   int len;
  120.   FILE *out;
  121.   double op[48];        // operands
  122.   GBool fp[48];            // true if operand is fixed point
  123.   int nOps;            // number of operands
  124.   double defaultWidthX;        // default glyph width
  125.   double nominalWidthX;        // nominal glyph width
  126.   GBool defaultWidthXFP;    // true if defaultWidthX is fixed point
  127.   GBool nominalWidthXFP;    // true if nominalWidthX is fixed point
  128.   Gushort r1;            // eexec encryption key
  129.   GString *charBuf;        // charstring output buffer
  130.   int line;            // number of eexec chars on current line
  131. };
  132.  
  133. #endif
  134.