Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/SFont.h
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 20:32:18 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 20:32:18 (GMT)
commit7aac8dc8533347e21311b15186e0af82f1b22fd6 (patch)
tree02650bb02c8a1d8468c22f50ff151885d233016b /pdf/xpdf/SFont.h
parentd99fb4f4acd14fcdbda968abd907547dcc7af40c (diff)
Synched with Xpdf 0.92
this adds "decryption" support testing this code after six weeks immediately gives me segfaults (image drawing) :-O must have fixed that later without knowing :-O
Diffstat (limited to 'pdf/xpdf/SFont.h')
-rw-r--r--pdf/xpdf/SFont.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/pdf/xpdf/SFont.h b/pdf/xpdf/SFont.h
new file mode 100644
index 0000000..4758664
--- /dev/null
+++ b/pdf/xpdf/SFont.h
@@ -0,0 +1,127 @@
+//========================================================================
+//
+// SFont.h
+//
+// Base class for font rasterizers.
+//
+//========================================================================
+
+#ifndef SFONT_H
+#define SFONT_H
+
+#ifdef __GNUC__
+#pragma interface
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "gtypes.h"
+
+//------------------------------------------------------------------------
+
+class SFontEngine {
+public:
+
+ SFontEngine(Display *display, Visual *visual, int depth,
+ Colormap colormap);
+ virtual ~SFontEngine();
+
+ // Use a TrueColor visual. Pixel values are computed as:
+ //
+ // (r << rShift) + (g << gShift) + (b << bShift)
+ //
+ // where r, g, and b are scaled to the ranges [0,rMax], [0,gMax],
+ // and [0,bMax], respectively.
+ virtual void useTrueColor(int rMax, int rShift, int gMax, int gShift,
+ int bMax, int bShift);
+
+ // Use an RGB color cube. <colors> is an array containing
+ // <nRGB>*<nRGB>*<nRGB> pixel values in red,green,blue order, e.g.,
+ // for <nRGB>=2, there will be 8 entries:
+ //
+ // |--- colors[i] ---|
+ // i red green blue
+ // - ----- ----- -----
+ // 0 0000 0000 0000
+ // 1 0000 0000 ffff
+ // 2 0000 ffff 0000
+ // 3 0000 ffff ffff
+ // 4 ffff 0000 0000
+ // 5 ffff 0000 ffff
+ // 6 ffff ffff 0000
+ // 7 ffff ffff ffff
+ //
+ // The <colors> array is not copied and must remain valid for the
+ // lifetime of this SFont object.
+ virtual void useColorCube(Gulong *colors, int nRGB);
+
+protected:
+
+ // Find the closest match to (<r>,<g>,<b>).
+ Gulong findColor(int r, int g, int b);
+
+ //----- X parameters
+ Display *display;
+ Visual *visual;
+ int depth;
+ Colormap colormap;
+
+ GBool trueColor; // true for TrueColor, false for RGB cube
+
+ //----- TrueColor parameters
+ int rMax, gMax, bMax;
+ int rShift, gShift, bShift;
+
+ //----- RGB color cube parameters
+ Gulong *colors;
+ int nRGB;
+};
+
+//------------------------------------------------------------------------
+
+class SFontFile {
+public:
+
+ // A typical subclass will provide a constructor along the lines of:
+ //
+ // SomeFontFile(SomeFontEngine *engine, char *fontFileName);
+ SFontFile();
+
+ virtual ~SFontFile();
+
+private:
+};
+
+//------------------------------------------------------------------------
+
+class SFont {
+public:
+
+ // A typical subclass will provide a constructor along the lines of:
+ //
+ // SomeFont(SomeFontFile *fontFile, double *m);
+ //
+ // where <m> is a transform matrix consisting of four elements,
+ // using the PostScript ordering conventions (without any
+ // translation):
+ //
+ // [x' y'] = [x y] * [m0 m1]
+ // [m2 m3]
+ //
+ // This is the level at which fonts are cached, and so the font
+ // cannot be transformed after it is created.
+ SFont();
+
+ virtual ~SFont();
+
+ // Draw a character <c> at <x>,<y> in color (<r>,<g>,<b>). The RGB
+ // values should each be in the range [0,65535]. Draws into <d>,
+ // clipped to the rectangle (0,0)-(<w>-1,<h>-1). Returns true if
+ // the character was drawn successfully.
+ virtual GBool drawChar(Drawable d, int w, int h, GC gc,
+ int x, int y, int r, int g, int b, Gushort c) = 0;
+
+protected:
+};
+
+#endif