]>
git.saurik.com Git - apple/icu.git/blob - icuSources/samples/layout/GDIFontInstance.h
3 *******************************************************************************
5 * © 2016 and later: Unicode, Inc. and others.
6 * License & terms of use: http://www.unicode.org/copyright.html#License
8 *******************************************************************************
9 *******************************************************************************
11 * Copyright (C) 1999-2003, International Business Machines
12 * Corporation and others. All Rights Reserved.
14 *******************************************************************************
15 * file name: GDIFontInstance.h
17 * created on: 08/09/2000
18 * created by: Eric R. Mader
21 #ifndef __GDIFONTINSTANCE_H
22 #define __GDIFONTINSTANCE_H
26 #include "layout/LETypes.h"
27 #include "layout/LEFontInstance.h"
28 #include "RenderingSurface.h"
29 #include "FontTableCache.h"
32 class GDIFontInstance
;
34 class GDISurface
: public RenderingSurface
37 GDISurface(HDC theHDC
);
38 virtual ~GDISurface();
40 virtual void drawGlyphs(const LEFontInstance
*font
, const LEGlyphID
*glyphs
, le_int32 count
,
41 const float *positions
, le_int32 x
, le_int32 y
, le_int32 width
, le_int32 height
);
43 void setFont(const GDIFontInstance
*font
);
45 void setHDC(HDC theHDC
);
49 const GDIFontInstance
*fCurrentFont
;
52 inline HDC
GDISurface::getHDC() const
57 class GDIFontInstance
: public LEFontInstance
, protected FontTableCache
74 virtual const void *readFontTable(LETag tableTag
) const;
76 virtual LEErrorCode
initMapper();
79 GDIFontInstance(GDISurface
*surface
, TCHAR
*faceName
, le_int16 pointSize
, LEErrorCode
&status
);
80 GDIFontInstance(GDISurface
*surface
, const char *faceName
, le_int16 pointSize
, LEErrorCode
&status
);
81 //GDIFontInstance(GDISurface *surface, le_int16 pointSize);
83 virtual ~GDIFontInstance();
85 HFONT
getFont() const;
87 virtual const void *getFontTable(LETag tableTag
) const;
89 virtual le_int32
getUnitsPerEM() const;
91 virtual le_int32
getAscent() const;
93 virtual le_int32
getDescent() const;
95 virtual le_int32
getLeading() const;
97 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
99 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
101 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
103 float getXPixelsPerEm() const;
105 float getYPixelsPerEm() const;
107 float getScaleFactorX() const;
109 float getScaleFactorY() const;
112 inline HFONT
GDIFontInstance::getFont() const
117 inline le_int32
GDIFontInstance::getUnitsPerEM() const
122 inline le_int32
GDIFontInstance::getAscent() const
127 inline le_int32
GDIFontInstance::getDescent() const
132 inline le_int32
GDIFontInstance::getLeading() const
137 inline LEGlyphID
GDIFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
139 return fMapper
->unicodeToGlyph(ch
);
142 inline float GDIFontInstance::getXPixelsPerEm() const
144 return (float) fPointSize
;
147 inline float GDIFontInstance::getYPixelsPerEm() const
149 return (float) fPointSize
;
152 inline float GDIFontInstance::getScaleFactorX() const
154 return fDeviceScaleX
;
157 inline float GDIFontInstance::getScaleFactorY() const
159 return fDeviceScaleY
;