Font

A Font object specifies a wrapper around a Microsoft Windows font. Microsoft defines this standard Font object implementation in the Object Linking and Embedding (OLE) Automation version 2.0 type library file, stdole2.tlb . Refer to Microsoft documentation for more information about this interface.

The Font interface specifies the following properties and methods:

Properties

  • Name —Name for the font.
  • Size —Point size for the font.
  • Bold —Bold property for the font.
  • Italic —Italic property for the font.
  • Underline —Underline property for the font.
  • Strikethrough —Strikethrough property for the font.
  • Weight —Weight (bold) for the font.
  • Charset —Character set of the font.
  • hFont —Returns a Windows HFONT handle for the font this Font object describes.

Methods

  • Clone —Creates a duplicate Font object with a state identical to the current font.
  • IsEqual —Compares this Font object to another for equality.
  • SetRatio —Converts the scaling factor for this font between logical units and HIMETRIC units, which the point size in the Size property specifies.
  • QueryTextMetrics —Fills a TEXTMETRIC structure describing the font.
  • AddRefHfont —Notifies the Font object that the previously realized font hFont identified remains valid until the ReleaseHfont method is called or the Font object itself is released.
  • ReleaseHfont —Notifies the Font object that the caller that previously locked this font in the cache with AddRefHfont no longer requires the lock.
  • SetHdc —Provides a device context handle to the font that describes the logical mapping mode.

LabVIEW

The LabVIEW development environment automatically recognizes Font ActiveX references. Use the Invoke Node and Property Node VIs to access the methods and properties of a Font ActiveX reference.

Note A VI must specify the user interface thread as the preferred execution system if the VI contains a Property Node that returns a Font ActiveX reference. Otherwise, LabVIEW returns an error.

LabWindows/CVI

LabWindows/CVI creates and accesses ActiveX objects using functions in a LabWindows/CVI-generated driver. You must create a driver for the OLE Automation ActiveX server using the ActiveX Controller Wizard. Select Tools»Create ActiveX Controller to launch the wizard. Select OLE Automation in the ActiveX Server list control and proceed to build the driver. Use the functions for the Font class to access the methods and properties.

Microsoft Visual Basic .NET

In Microsoft Visual Basic .NET, you can access Font objects by first adding the OLE Automation COM component as a reference in a project and then adding the following directive at the top of the source file:

Imports stdole.StdFontClass

The IFontDisp class methods and properties are available in the Microsoft Visual Studio object browser and are accessible from the Visual Basic .NET source code.

C#

In C#, you can access Font objects by first adding the OLE Automation COM component as a reference in a project and then adding the following directive at the top of the source file:

using stdole.StdFontClass;

The IFontDisp class methods and properties are available in the Visual Studio object browser and are accessible from the C# source code.

Microsoft Visual C++/#import

In C++, you can access Font objects by adding the include file ocidl.h and using the CComPtr template to manage IFontDisp COM interface pointers.