1 //========================================================================
5 // Copyright 2003 Glyph & Cog, LLC
6 // Copyright 2004 Red Hat, Inc
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
36 #include "poppler-config.h"
37 #include "goo/gtypes.h"
43 class CairoFontEngine
;
48 cairo_font_face_t
*face
,
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
; }
63 cairo_font_face_t
*cairo_font_face
;
72 //------------------------------------------------------------------------
74 class CairoFreeTypeFont
: public CairoFont
{
76 static CairoFreeTypeFont
*create(GfxFont
*gfxFont
, XRef
*xref
, FT_Library lib
, GBool useCIDs
);
77 virtual ~CairoFreeTypeFont();
80 CairoFreeTypeFont(Ref ref
, cairo_font_face_t
*cairo_font_face
,
81 int *codeToGID
, Guint codeToGIDLen
, GBool substitute
);
84 //------------------------------------------------------------------------
86 class CairoType3Font
: public CairoFont
{
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
);
96 CairoType3Font(Ref ref
, PDFDoc
*doc
,
97 cairo_font_face_t
*cairo_font_face
,
98 int *codeToGID
, Guint codeToGIDLen
,
99 GBool printing
, XRef
*xref
);
103 //------------------------------------------------------------------------
105 #define cairoFontCacheSize 64
107 //------------------------------------------------------------------------
109 //------------------------------------------------------------------------
111 class CairoFontEngine
{
114 // Create a font engine.
115 CairoFontEngine(FT_Library libA
);
118 CairoFont
*getFont(GfxFont
*gfxFont
, PDFDoc
*doc
, GBool printing
, XRef
*xref
);
121 CairoFont
*fontCache
[cairoFontCacheSize
];