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

Last change on this file since 461 was 461, checked in by Silvan Scherrer, 11 years ago

poppler update to 0.14.2

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, 2010 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,
79            Gushort *codeToGID, int codeToGIDLen, GBool substitute);
80};
81
82//------------------------------------------------------------------------
83
84class CairoType3Font : public CairoFont {
85public:
86  static CairoType3Font *create(GfxFont *gfxFont, XRef *xref,
87                                Catalog *catalog, CairoFontEngine *fontEngine,
88                                GBool printing);
89  virtual ~CairoType3Font();
90
91  virtual GBool matches(Ref &other, GBool printing);
92
93private:
94  CairoType3Font(Ref ref, XRef *xref, Catalog *catalog,
95                 cairo_font_face_t *cairo_font_face,
96                 Gushort *codeToGID, int codeToGIDLen,
97                 GBool printing);
98  XRef *xref;
99  Catalog *catalog;
100};
101
102//------------------------------------------------------------------------
103
104#define cairoFontCacheSize 64
105
106//------------------------------------------------------------------------
107// CairoFontEngine
108//------------------------------------------------------------------------
109
110class CairoFontEngine {
111public:
112
113  // Create a font engine.
114  CairoFontEngine(FT_Library libA);
115  ~CairoFontEngine();
116
117  CairoFont *getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog, GBool printing);
118
119private:
120  CairoFont *fontCache[cairoFontCacheSize];
121  FT_Library lib;
122  GBool useCIDs;
123};
124
125#endif
Note: See TracBrowser for help on using the repository browser.