]>
git.saurik.com Git - apple/icu.git/blob - icuSources/samples/layout/GnomeFontInstance.h
3 *******************************************************************************
5 * Copyright (C) 1999-2006, International Business Machines
6 * Corporation and others. All Rights Reserved.
8 *******************************************************************************
9 * file name: GnomeFontInstance.h
11 * created on: 08/30/2001
12 * created by: Eric R. Mader
15 #ifndef __GNOMEFONTINSTANCE_H
16 #define __GNOMEFONTINSTANCE_H
20 #include FT_FREETYPE_H
24 #include "layout/LETypes.h"
25 #include "layout/LEFontInstance.h"
27 #include "RenderingSurface.h"
28 #include "FontTableCache.h"
31 class GnomeSurface
: public RenderingSurface
34 GnomeSurface(GtkWidget
*theWidget
);
35 virtual ~GnomeSurface();
37 virtual void drawGlyphs(const LEFontInstance
*font
, const LEGlyphID
*glyphs
, le_int32 count
,
38 const float *positions
, le_int32 x
, le_int32 y
, le_int32 width
, le_int32 height
);
40 GtkWidget
*getWidget() const;
41 void setWidget(GtkWidget
*theWidget
);
48 class GnomeFontInstance
: public LEFontInstance
, protected FontTableCache
54 cairo_font_face_t
*fCairoFace
;
67 virtual const void *readFontTable(LETag tableTag
) const;
69 virtual LEErrorCode
initMapper();
72 GnomeFontInstance(FT_Library engine
, const char *fontPathName
, le_int16 pointSize
, LEErrorCode
&status
);
74 virtual ~GnomeFontInstance();
76 virtual const void *getFontTable(LETag tableTag
) const;
78 virtual le_int32
getUnitsPerEM() const;
80 virtual le_int32
getAscent() const;
82 virtual le_int32
getDescent() const;
84 virtual le_int32
getLeading() const;
86 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
88 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
90 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
92 float getXPixelsPerEm() const;
94 float getYPixelsPerEm() const;
96 float getScaleFactorX() const;
98 float getScaleFactorY() const;
100 void rasterizeGlyphs(cairo_t
*cairo
, const LEGlyphID
*glyphs
, le_int32 glyphCount
, const float *positions
,
101 le_int32 x
, le_int32 y
) const;
104 inline GtkWidget
*GnomeSurface::getWidget() const
109 inline void GnomeSurface::setWidget(GtkWidget
*theWidget
)
115 inline FT_Instance GnomeFontInstance::getFont() const
121 inline le_int32
GnomeFontInstance::getUnitsPerEM() const
126 inline le_int32
GnomeFontInstance::getAscent() const
131 inline le_int32
GnomeFontInstance::getDescent() const
136 inline le_int32
GnomeFontInstance::getLeading() const
141 inline LEGlyphID
GnomeFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
143 return fMapper
->unicodeToGlyph(ch
);
146 inline float GnomeFontInstance::getXPixelsPerEm() const
148 return (float) fPointSize
;
151 inline float GnomeFontInstance::getYPixelsPerEm() const
153 return (float) fPointSize
;
156 inline float GnomeFontInstance::getScaleFactorX() const
158 return fDeviceScaleX
;
161 inline float GnomeFontInstance::getScaleFactorY() const
163 return fDeviceScaleY
;