Solved

How do I check if a font exists on the user's computer?

Posted on 2011-09-23
1
706 Views
Last Modified: 2013-12-17
I have code to install fonts, but I don't want to be running that code every time the user starts the program...only when the font does not exist.  So how do I check to see if the font is already loaded on the user's machine?
0
Comment
Question by:David L. Hansen
1 Comment
 
LVL 13

Accepted Solution

by:
StormITSolutions earned 500 total points
ID: 36590499
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Text
Imports System.Drawing

Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        ' Get the installed fonts collection.
        Dim installed_fonts As New InstalledFontCollection

        ' Get an array of the system's font familiies.
        Dim font_families() As FontFamily = installed_fonts.Families()

        ' Display the font families.
        For Each font_family As FontFamily In font_families
            Console.Write (font_family.Name & ", ")
        Next font_family
    End Sub
End Class

Open in new window


This is a way to get all the fonts installed on a system


Use something like this
InstalledFontCollection installedFontCollection = new InstalledFontCollection();

// Get the array of FontFamily objects.
FontFamily[] fontFamilies = installedFontCollection.Families;

Open in new window


Then compare the font you want to install with the array for a match

Storm
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question