|
-
May 21st, 2007, 10:09 AM
#1
Thread Starter
Fanatic Member
[2005] Read Font Title
Some Background
I have an application that currently uses the Courier New font for all textboxes per a project requirement. I now want to use the Consolas font as it is much easier to read and distinguish various differences. I want my application to install this font on my XP machines so that I don't have to do it manually. I have found numerous articles on installing fonts and I have that part working.
The Problem
The only piece that I am missing is putting information about the font into the registry so that it can be reused. (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts). To add the font to the registry, I need to know the name of the font. I can get this information from the Title property of the font, but how do I read that?
- I have been reading about Alternate Data Streams and haven't found anything that appeared to be useful for anything except an Image file.
- I found information about some DSOFile.dll (or something like that) from Microsoft that allows you to view extended properties from Office-type documents.
Can someone point me in the right direction as to how to read this information from a file?
Thanks in advance!!
My.Settings.Signature = String.Empty
-
May 21st, 2007, 11:05 AM
#2
Re: [2005] Read Font Title
If you are specifically using one font, then why would you need to query data about it to add it to the registry?
You should already know exactly what strings would need to be entered shouldn't you?
On second thought though, how are you installing said font? If you install it properly, this registry entry gets auto populated...
-
May 21st, 2007, 01:27 PM
#3
Thread Starter
Fanatic Member
Re: [2005] Read Font Title
I am installing the font through my VB application (System.Deployment.Application.ApplicationDeployment.CurrentDeployment.IsFirstRun) using the CreateScalableFontResource, AddFontResource and SendMessage API calls. Prior to calling SendMessage, I need to store that information in the registry.
Yes, I do know the names of the 4 fonts and could hard-code them. But I just don't like the term hard-code. Windows does it somehow when you drop files into the Fonts folder, so it can be done.
My.Settings.Signature = String.Empty
-
May 21st, 2007, 01:28 PM
#4
Re: [2005] Read Font Title
doesn't your app have an installer? Most installers support installing fonts at installation time, which installs the font into the fonts directory via the windows API and that writes all needed registry keys.
-
May 21st, 2007, 01:29 PM
#5
Thread Starter
Fanatic Member
Re: [2005] Read Font Title
I am using Click Once deployment for this application. From what I have read, there is no support in Click Once for Font installations.
My.Settings.Signature = String.Empty
-
May 21st, 2007, 01:37 PM
#6
Re: [2005] Read Font Title
clickonce is limited on many fronts, I guess fonts is one of them...
This code is VB6, but it shows how to install a given font (aka add the registry keys) after doing what you are already doing by calling the WriteProfileString API to write to the registry...
http://www.vb-helper.com/howto_install_font.html
-
May 21st, 2007, 01:58 PM
#7
Thread Starter
Fanatic Member
Re: [2005] Read Font Title
That is exactly what I am doing. I just wanted to pull the font's name from the TTF file itself. I am going to just hard-code it and go. I have wasted too much time on this already.
My.Settings.Signature = String.Empty
-
May 21st, 2007, 03:08 PM
#8
Thread Starter
Fanatic Member
Re: [2005] Read Font Title
After I finished hard-coding everything, I started debugging a delay in the usability of the font and found this http://vbnet.mvps.org/index.html?cod...uetypename.htm. It shows how to get the font's name from the FOT file that is created by the CreateScalableFontResource API.
My.Settings.Signature = String.Empty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|