]>
git.saurik.com Git - apple/icu.git/blob - icuSources/samples/layout/GnomeFontInstance.h
3 *******************************************************************************
5 * Copyright (C) 1999-2003, 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
19 #include "freetype/freetype.h"
21 #include "layout/LETypes.h"
22 #include "layout/LEFontInstance.h"
24 #include "RenderingSurface.h"
25 #include "FontTableCache.h"
28 class GnomeSurface
: public RenderingSurface
31 GnomeSurface(GtkWidget
*theWidget
);
32 virtual ~GnomeSurface();
34 virtual void drawGlyphs(const LEFontInstance
*font
, const LEGlyphID
*glyphs
, le_int32 count
,
35 const float *positions
, le_int32 x
, le_int32 y
, le_int32 width
, le_int32 height
);
37 GtkWidget
*getWidget() const;
38 void setWidget(GtkWidget
*theWidget
);
44 class GnomeFontInstance
: public LEFontInstance
, protected FontTableCache
48 TT_Instance fInstance
;
62 virtual const void *readFontTable(LETag tableTag
) const;
64 virtual LEErrorCode
initMapper();
67 GnomeFontInstance(TT_Engine engine
, const TT_Text
*fontPathName
, le_int16 pointSize
, LEErrorCode
&status
);
69 virtual ~GnomeFontInstance();
71 TT_Instance
getFont() const;
73 virtual const void *getFontTable(LETag tableTag
) const;
75 virtual le_int32
getUnitsPerEM() const;
77 virtual le_int32
getAscent() const;
79 virtual le_int32
getDescent() const;
81 virtual le_int32
getLeading() const;
83 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
85 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
87 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
89 float getXPixelsPerEm() const;
91 float getYPixelsPerEm() const;
93 float getScaleFactorX() const;
95 float getScaleFactorY() const;
97 TT_Raster_Map
*rasterizeGlyphs(const LEGlyphID
*glyphs
, le_int32 glyphCount
, const le_int32
*dx
, const le_int32
*dy
,
98 le_int32
&xOffset
, le_int32
&yOffset
) const;
100 void freeRaster(TT_Raster_Map
*raster
);
103 inline GtkWidget
*GnomeSurface::getWidget() const
108 inline void GnomeSurface::setWidget(GtkWidget
*theWidget
)
113 inline TT_Instance
GnomeFontInstance::getFont() const
118 inline le_int32
GnomeFontInstance::getUnitsPerEM() const
123 inline le_int32
GnomeFontInstance::getAscent() const
128 inline le_int32
GnomeFontInstance::getDescent() const
133 inline le_int32
GnomeFontInstance::getLeading() const
138 inline LEGlyphID
GnomeFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
140 return fMapper
->unicodeToGlyph(ch
);
143 inline float GnomeFontInstance::getXPixelsPerEm() const
145 return (float) fPointSize
;
148 inline float GnomeFontInstance::getYPixelsPerEm() const
150 return (float) fPointSize
;
153 inline float GnomeFontInstance::getScaleFactorX() const
155 return fDeviceScaleX
;
158 inline float GnomeFontInstance::getScaleFactorY() const
160 return fDeviceScaleY
;