source: trunk/poppler/mypoppler/poppler/CairoFontEngine.h @ 277

Last change on this file since 277 was 277, checked in by rbri, 11 years ago

PDF plugin: Poppler library updated to version 0.12.3

File size: 3.3 KB
Line 
1//========================================================================
2//
3// CairoFontEngine.h
4//
5// Copyright 2003 Glyph & Cog, LLC
6// Copyright 2004 Red Hat, Inc
7//
8//========================================================================
9
10//========================================================================
11//
12// Modified under the Poppler project - http://poppler.freedesktop.org
13//
14// All changes made under the Poppler project to this file are licensed
15// under GPL version 2 or later
16//
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 Carlos Garcia Campos <carlosgc@gnome.org>
21// Copyright (C) 2008 Adrian Johnson <ajohnson@redneon.com>
22//
23// To see a description of the changes please see the Changelog file that
24// came with your tarball or type make ChangeLog if you are building from git
25//
26//========================================================================
27
28#ifndef CAIROFONTENGINE_H
29#define CAIROFONTENGINE_H
30
31#ifdef USE_GCC_PRAGMAS
32#pragma interface
33#endif
34
35#include "goo/gtypes.h"
36#include <cairo-ft.h>
37
38#include "GfxFont.h"
39#include "Catalog.h"
40
41class CairoFontEngine;
42
43class CairoFont {
44public:
45  CairoFont(Ref ref,
46            cairo_font_face_t *face,
47            Gushort *codeToGID,
48            int codeToGIDLen,
49            GBool substitute,
50            GBool printing);
51  virtual ~CairoFont();
52
53  virtual GBool matches(Ref &other, GBool printing);
54  cairo_font_face_t *getFontFace(void);
55  unsigned long getGlyph(CharCode code, Unicode *u, int uLen);
56  double getSubstitutionCorrection(GfxFont *gfxFont);
57
58  GBool isSubstitute() { return substitute; }
59protected:
60  Ref ref;
61  cairo_font_face_t *cairo_font_face;
62
63  Gushort *codeToGID;
64  int codeToGIDLen;
65
66  GBool substitute;
67  GBool printing;
68};
69
70//------------------------------------------------------------------------
71
72class CairoFreeTypeFont : public CairoFont {
73public:
74  static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs);
75  virtual ~CairoFreeTypeFont();
76
77private:
78  CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face, FT_Face face,
79            Gushort *codeToGID, int codeToGIDLen, GBool substitute);
80  FT_Face face;
81};
82
83//------------------------------------------------------------------------
84
85class CairoType3Font : public CairoFont {
86public:
87  static CairoType3Font *create(GfxFont *gfxFont, XRef *xref,
88                                Catalog *catalog, CairoFontEngine *fontEngine,
89                                GBool printing);
90  virtual ~CairoType3Font();
91
92  virtual GBool matches(Ref &other, GBool printing);
93
94private:
95  CairoType3Font(Ref ref, XRef *xref, Catalog *catalog,
96                 cairo_font_face_t *cairo_font_face,
97                 Gushort *codeToGID, int codeToGIDLen,
98                 GBool printing);
99  XRef *xref;
100  Catalog *catalog;
101};
102
103//------------------------------------------------------------------------
104
105#define cairoFontCacheSize 64
106
107//------------------------------------------------------------------------
108// CairoFontEngine
109//------------------------------------------------------------------------
110
111class CairoFontEngine {
112public:
113
114  // Create a font engine.
115  CairoFontEngine(FT_Library libA);
116  ~CairoFontEngine();
117
118  CairoFont *getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog, GBool printing);
119
120private:
121  CairoFont *fontCache[cairoFontCacheSize];
122  FT_Library lib;
123  GBool useCIDs;
124};
125
126#endif
Note: See TracBrowser for help on using the repository browser.