Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: Fonts in Category Windows : Fonts from Total Visual SourceBook

Get the list of fonts installed on Windows, see if a font name is installed, and convert between points and height. Supports VB6 and VBA with 32 and 64 bit Windows API calls.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modFonts module
IsFontInstalled Procedure Determine if a font name is installed on the Windows Operating system
GetFonts Procedure Enumerate the fonts installed on a system, returning the list of fonts in the array
EnumFontFamProc Procedure This function should never be called directly by user code. It is used as a callback function for the Windows API EnumFontFamilies function. See the Windows SDK for more documentation on this procedure
ConvertScale Procedure Converts between pixels, twips and points
HeightToPoints Procedure Convert a font height to a font point size. The font height is measured in logical device units. Most windows API functions for dealing with fonts require the font height in logical units. This function only works correctly in the MM_TEXT mapping mode.
PointsToHeight Procedure Convert a font point size to a font height. The font height is measured in logical device units. Most windows API functions for dealing with fonts require the font height in logical units. This function only works correctly in the MM_TEXT mapping mode.

Example Code for Using Module: Fonts

' Example of modFonts
'
' To use this example, create a new module and paste this code into it.
' Then run the procedure by putting the cursor in the procedure and pressing:
'    F5 to run it, or
'    F8 to step through it line-by-line (see the Debug menu for more options)

Private Sub Example_modFonts()
  ' Comments: Example of using the modFonts module to get the collection of fonts currently installed on Windows with VBA and VB6.
  '           See the results in the Immediate Window.

  Const clngHandle As Long = 0
  Dim astrFonts() As String
  Dim intFont As Integer

  ' Get all fonts on the system
  If GetFonts(clngHandle, astrFonts()) Then
    ' Fill the list box with the enumerated fonts
    For intFont = LBound(astrFonts) To UBound(astrFonts)
      Debug.Print intFont, astrFonts(intFont)
    Next intFont

    Debug.Print
    Debug.Print "Is Calibri font installed: " & IsFontInstalled("Calibri")
    Debug.Print "Is FMS font installed    : " & IsFontInstalled("FMS")
    Debug.Print
    Debug.Print "ConvertScale()"
    Debug.Print "16 pixels is " & ConvertScale(clngHandle, 16, cvscPixels, cvscpoints) & " points."
    Debug.Print "HeightToPoints(): 96 logical units is " & HeightToPoints(clngHandle, 96) & " points."
    Debug.Print "PointsToHeight(): 12 points is " & PointsToHeight(clngHandle, 12) & " logical units."

  Else
    MsgBox "Fonts could not be retrieved"
  End If

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources