home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / indispensabili / utility / apdf / xpdf-0.80 / xpdf / fontoutputdev.h < prev    next >
C/C++ Source or Header  |  1999-05-18  |  2KB  |  97 lines

  1. //========================================================================
  2. //
  3. // FontOutputDev.h
  4. //
  5. // Copyright 1999 Emmanuel Lesueur
  6. //
  7. //========================================================================
  8.  
  9. #ifndef FONTOUTPUTDEV_H
  10. #define FONTOUTPUTDEV_H
  11.  
  12. #ifdef __GNUC__
  13. #pragma interface
  14. #endif
  15.  
  16. #include <stdio.h>
  17. #include "gtypes.h"
  18. #include "OutputDev.h"
  19. #include "GString.h"
  20. #include "GfxFont.h"
  21.  
  22. class GfxState;
  23. class GfxFont;
  24.  
  25. struct FontMapEntry {
  26.   char *pdfFont;
  27.   char *xFont;
  28.   int mWidth;
  29.   int style;
  30.   int encoding;
  31. };
  32.  
  33. extern FontMapEntry *userFontMap;
  34. extern const char *defFontsNames[];
  35. static const int numDefFonts = 12;//16;
  36.  
  37. void clearUserFontMap();
  38. void resetUserFontMap();
  39. const char* getAFont(GfxFont*,GfxFontEncoding*&,int&,double&,double&);
  40.  
  41.  
  42. class FontOutputDev: public OutputDev {
  43. public:
  44.  
  45.   FontOutputDev();
  46.  
  47.   // Destructor.
  48.   virtual ~FontOutputDev();
  49.  
  50.   // Check if file was successfully created.
  51.   virtual GBool isOk() { return gTrue; }
  52.  
  53.   //---- get info about output device
  54.  
  55.   // Does this device use upside-down coordinates?
  56.   // (Upside-down means (0,0) is the top left corner of the page.)
  57.   virtual GBool upsideDown() { return gTrue; }
  58.  
  59.   // Does this device use drawChar() or drawString()?
  60.   virtual GBool useDrawChar() { return gTrue; }
  61.  
  62.   //----- update text state
  63.   virtual void updateFont(GfxState *state);
  64.  
  65.   //----- special access
  66.   int size() const { return cur - beg; }
  67.  
  68.   void get(int n,const char*& pdfFont,const char*& xFont,int& m,int& style,int& encoding) {
  69.     Entry& e = beg[n];
  70.     pdfFont = e.pdfFont->getCString();
  71.     xFont = e.xFont;
  72.     m = e.m;
  73.     style = e.style;
  74.     encoding = e.encoding;
  75.   }
  76.  
  77. protected:
  78.   struct Entry {
  79.     GString* pdfFont;
  80.     const char* xFont;
  81.     int m;
  82.     int style;
  83.     int encoding;
  84.   };
  85.   Entry* beg;
  86.   Entry* cur;
  87.   Entry* end;
  88. };
  89.  
  90. class DefaultFontOutputDev : public FontOutputDev {
  91. public:
  92.   DefaultFontOutputDev();
  93. };
  94.  
  95. #endif
  96.  
  97.