Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Font Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the Font C++ class.

Font Functions and Corresponding Wrapper Methods

Flat functionWrapper methodRemarks

GpStatus WINGDIPAPI GdipCreateFontFromDC( HDC hdc, GpFont **font )

Font::Font(IN HDC hdc) Creates a Font object based on the GDI font object that is currently selected into a specified device context. This constructor is provided for compatibility with GDI.

GpStatus WINGDIPAPI GdipCreateFontFromLogfontA( HDC hdc, GDIPCONST LOGFONTA *logfont, GpFont **font )

Font::Font(IN HDC hdc, IN const LOGFONTA* logfont) Creates a Font object directly from a GDI logical font. The GDI logical font is a LOGFONTA structure, which is the one-byte character version of a logical font. This constructor is provided for compatibility with GDI.

GpStatus WINGDIPAPI GdipCreateFontFromLogfontW( HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font )

Font::Font(IN HDC hdc, IN const LOGFONTW* logfont) Creates a Font object directly from a GDI logical font. The GDI logical font is a LOGFONTW structure, which is the one-byte character version of a logical font. This constructor is provided for compatibility with GDI.

GpStatus WINGDIPAPI GdipCloneFont(GpFont* font, GpFont** cloneFont)

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipCreateFont( GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font )

Font::Font( IN const FontFamily * family, IN REAL emSize, IN INT style, IN Unit unit ) Creates a Font object based on a font family, a size, a font style, a unit of measurement, and a FontCollection object.

GpStatus WINGDIPAPI GdipCloneFont(GpFont* font, GpFont** cloneFont)

Font::Font* Clone() const Creates a new Font object based on this Font object.

GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)

Status Font::GetFamily(OUT FontFamily *family) const Gets the font family on which this font is based.

GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)

INT Font::GetStyle() const Gets the style of this font's typeface

GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)

REAL Font::GetSize() const Returns the font size (commonly called the em size) of this Font object. The size is in the units of this Font object.

GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)

Unit Font::GetUnit() const Returns the unit of measure of this Font object.

GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)

REAL Font::GetHeight(IN const Graphics *graphics) const Gets the line spacing of this font in the current unit of a specified Graphics object. The line spacing is the vertical distance between the base lines of two consecutive lines of text. Thus, the line spacing includes the blank space between lines along with the height of the character itself.

GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)

REAL Font::GetHeight(IN REAL dpi) const Gets the line spacing, in pixels, of this font. The line spacing is the vertical distance between the base lines of two consecutive lines of text. Thus, the line spacing includes the blank space between lines along with the height of the character itself.

GpStatus WINGDIPAPI GdipGetLogFontA(GpFont * font, GpGraphics *graphics, LOGFONTA * logfontA)

Status Font::GetLogFontA(IN const Graphics *g, OUT LOGFONTA *logfontA) const Uses a LOGFONTA structure to get the attributes of this Font object.

GpStatus WINGDIPAPI GdipGetLogFontW(GpFont * font, GpGraphics *graphics, LOGFONTW * logfontW)

Status Font::GetLogFontW(IN const Graphics *g, OUT LOGFONTW *logfontW) const Uses a LOGFONTW structure to get the attributes of this Font object.

GpStatus WINGDIPAPI GdipNewInstalledFontCollection(GpFontCollection** fontCollection)

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollection)

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection** fontCollection)

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount( GpFontCollection* fontCollection, INT * numFound )

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList( GpFontCollection* fontCollection, INT numSought, GpFontFamily* gpfamilies[], INT* numFound )

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipPrivateAddFontFile( GpFontCollection* fontCollection, GDIPCONST WCHAR* filename )

Not called by wrapper methods.

Not implemented.

GpStatus WINGDIPAPI GdipPrivateAddMemoryFont( GpFontCollection* fontCollection, GDIPCONST void* memory, INT length )

Not called by wrapper methods.

Not implemented.

 

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.