Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application, I am currently using the Segoe UI font as my default text font. If a user decides to use my application and hasn't got the Segoe UI font installed on their system that the font is automatically changed, however its a font that is used instead doesn't look right for the particular application.

I wonder if there is a way of using the Segoe UI font with my application so the end users see it with or without the font installed or is there a way of detecting whether the user has the Segoe UI font installed and if not change it to a more suitable font?

Thanks
Regards
William



..............

Okay, so say if you were to do that William, would you be breaking any terms of Microsoft, since I am using Microsoft's Segoe UI font which is not installed on Windows XP and below OS?

Thanks :-)
Regards
William
Posted
Updated 3-Jul-10 14:38pm
v2

Public Function CheckFontPresence(ByVal s_fontname As String) As Integer
Dim allfonts As New InstalledFontCollection
For Each s_font As FontFamily In allfonts.Families
If UCase(s_font.Name) = UCase(s_fontname) Then
'found the wanted font
Return 1
End If
Next
Return 0 'no match
End Function
 
Share this answer
 
So, tiggerc gave you a start to check if your font is installed, but that wasn't really your question.

Have a look here:

Embedding fonts into your application.[^]

What that page shows you is that you can embed your font as a Resource, and then it gives you code on how to add the font to the user's system.

You can use tiggerc's answer, though, to first check to see if you need to add it. Then, if you do, then, you'll need to set the fonts to the first font in your newly created PrivateFontCollection.

Not the most direct way, but that's how I know to do it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900