]>
git.saurik.com Git - apple/icu.git/blob - icuSources/samples/layout/GDIFontInstance.h
3 *******************************************************************************
5 * Copyright (C) 1999-2003, International Business Machines
6 * Corporation and others. All Rights Reserved.
8 *******************************************************************************
9 * file name: GDIFontInstance.h
11 * created on: 08/09/2000
12 * created by: Eric R. Mader
15 #ifndef __GDIFONTINSTANCE_H
16 #define __GDIFONTINSTANCE_H
20 #include "layout/LETypes.h"
21 #include "layout/LEFontInstance.h"
22 #include "RenderingSurface.h"
23 #include "FontTableCache.h"
26 class GDIFontInstance
;
28 class GDISurface
: public RenderingSurface
31 GDISurface(HDC theHDC
);
32 virtual ~GDISurface();
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 void setFont(const GDIFontInstance
*font
);
39 void setHDC(HDC theHDC
);
43 const GDIFontInstance
*fCurrentFont
;
46 inline HDC
GDISurface::getHDC() const
51 class GDIFontInstance
: public LEFontInstance
, protected FontTableCache
68 virtual const void *readFontTable(LETag tableTag
) const;
70 virtual LEErrorCode
initMapper();
73 GDIFontInstance(GDISurface
*surface
, TCHAR
*faceName
, le_int16 pointSize
, LEErrorCode
&status
);
74 GDIFontInstance(GDISurface
*surface
, const char *faceName
, le_int16 pointSize
, LEErrorCode
&status
);
75 //GDIFontInstance(GDISurface *surface, le_int16 pointSize);
77 virtual ~GDIFontInstance();
79 HFONT
getFont() const;
81 virtual const void *getFontTable(LETag tableTag
) const;
83 virtual le_int32
getUnitsPerEM() const;
85 virtual le_int32
getAscent() const;
87 virtual le_int32
getDescent() const;
89 virtual le_int32
getLeading() const;
91 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
93 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
95 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
97 float getXPixelsPerEm() const;
99 float getYPixelsPerEm() const;
101 float getScaleFactorX() const;
103 float getScaleFactorY() const;
106 inline HFONT
GDIFontInstance::getFont() const
111 inline le_int32
GDIFontInstance::getUnitsPerEM() const
116 inline le_int32
GDIFontInstance::getAscent() const
121 inline le_int32
GDIFontInstance::getDescent() const
126 inline le_int32
GDIFontInstance::getLeading() const
131 inline LEGlyphID
GDIFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
133 return fMapper
->unicodeToGlyph(ch
);
136 inline float GDIFontInstance::getXPixelsPerEm() const
138 return (float) fPointSize
;
141 inline float GDIFontInstance::getYPixelsPerEm() const
143 return (float) fPointSize
;
146 inline float GDIFontInstance::getScaleFactorX() const
148 return fDeviceScaleX
;
151 inline float GDIFontInstance::getScaleFactorY() const
153 return fDeviceScaleY
;