beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / poppler / CairoFontEngine.h
blob8c0dba116d542296859f5847b20663deee9d26e7
1 //========================================================================
2 //
3 // CairoFontEngine.h
4 //
5 // Copyright 2003 Glyph & Cog, LLC
6 // Copyright 2004 Red Hat, Inc
7 //
8 //========================================================================
10 //========================================================================
12 // Modified under the Poppler project - http://poppler.freedesktop.org
14 // All changes made under the Poppler project to this file are licensed
15 // under GPL version 2 or later
17 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
18 // Copyright (C) 2005 Albert Astals Cid <aacid@kde.org>
19 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net>
20 // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org>
21 // Copyright (C) 2008 Adrian Johnson <ajohnson@redneon.com>
22 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
24 // To see a description of the changes please see the Changelog file that
25 // came with your tarball or type make ChangeLog if you are building from git
27 //========================================================================
29 #ifndef CAIROFONTENGINE_H
30 #define CAIROFONTENGINE_H
32 #ifdef USE_GCC_PRAGMAS
33 #pragma interface
34 #endif
36 #include "poppler-config.h"
37 #include "goo/gtypes.h"
38 #include <cairo-ft.h>
40 #include "GfxFont.h"
41 #include "PDFDoc.h"
43 class CairoFontEngine;
45 class CairoFont {
46 public:
47 CairoFont(Ref ref,
48 cairo_font_face_t *face,
49 int *codeToGID,
50 Guint codeToGIDLen,
51 GBool substitute,
52 GBool printing);
53 virtual ~CairoFont();
55 virtual GBool matches(Ref &other, GBool printing);
56 cairo_font_face_t *getFontFace(void);
57 unsigned long getGlyph(CharCode code, Unicode *u, int uLen);
58 double getSubstitutionCorrection(GfxFont *gfxFont);
60 GBool isSubstitute() { return substitute; }
61 protected:
62 Ref ref;
63 cairo_font_face_t *cairo_font_face;
65 int *codeToGID;
66 Guint codeToGIDLen;
68 GBool substitute;
69 GBool printing;
72 //------------------------------------------------------------------------
74 class CairoFreeTypeFont : public CairoFont {
75 public:
76 static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs);
77 virtual ~CairoFreeTypeFont();
79 private:
80 CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face,
81 int *codeToGID, Guint codeToGIDLen, GBool substitute);
84 //------------------------------------------------------------------------
86 class CairoType3Font : public CairoFont {
87 public:
88 static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc,
89 CairoFontEngine *fontEngine,
90 GBool printing, XRef *xref);
91 virtual ~CairoType3Font();
93 virtual GBool matches(Ref &other, GBool printing);
95 private:
96 CairoType3Font(Ref ref, PDFDoc *doc,
97 cairo_font_face_t *cairo_font_face,
98 int *codeToGID, Guint codeToGIDLen,
99 GBool printing, XRef *xref);
100 PDFDoc *doc;
103 //------------------------------------------------------------------------
105 #define cairoFontCacheSize 64
107 //------------------------------------------------------------------------
108 // CairoFontEngine
109 //------------------------------------------------------------------------
111 class CairoFontEngine {
112 public:
114 // Create a font engine.
115 CairoFontEngine(FT_Library libA);
116 ~CairoFontEngine();
118 CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xref);
120 private:
121 CairoFont *fontCache[cairoFontCacheSize];
122 FT_Library lib;
123 GBool useCIDs;
124 #if MULTITHREADED
125 GooMutex mutex;
126 #endif
129 #endif