473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Installing a TT-Font

Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.StartupPath+"\\Lucon1.ttf",
this.fontDir+"\\Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf");
SendMessage((System.IntPtr)HWND_BROADCAST,
WM_FONTCHANGE, 0, 0);
}
Nov 16 '05 #1
4 6912
Johan,

Does your app include a Setup Project? Because if you build a setup project
for your app, you can add fonts to it and when the user installs it the
fonts will be automatically installed, and removed upon un-install.

JIM
"Johan" <he***@hotmail.com> wrote in message
news:5e****************************@phx.gbl...
Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.StartupPath+"\\Lucon1.ttf",
this.fontDir+"\\Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf");
SendMessage((System.IntPtr)HWND_BROADCAST,
WM_FONTCHANGE, 0, 0);
}

Nov 16 '05 #2
Yes I know I could go that way, but I was kind of hoping to just end up with
one exe-file for the application without the need for installation...

/Johan

"James" <no****@hypercon.net> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Johan,

Does your app include a Setup Project? Because if you build a setup
project for your app, you can add fonts to it and when the user installs
it the fonts will be automatically installed, and removed upon un-install.

JIM
"Johan" <he***@hotmail.com> wrote in message
news:5e****************************@phx.gbl...
Hi

How would I go about installing a font file on WinXP?

I have tried this and it won't get installed properly,

private void installFont()
{
File.Copy( Application.StartupPath+"\\Lucon1.ttf",
this.fontDir+"\\Lucon1.ttf", true );
key.SetValue( "Lucida Console ANSI
TrueType)", "Lucon1.ttf");
SendMessage((System.IntPtr)HWND_BROADCAST,
WM_FONTCHANGE, 0, 0);
}


Nov 16 '05 #3
Hi,

You should rather use the GDI Function AddFontResource by P-Invoke,
shouldn't you? I was searching for sample code demonstrating how to load
the font out of a ttf file but all i found were some functions, one of
them is AddFontResource.

This could be your signature:

[DllImport("gdi32")]
static extern int AddFontResource(string lpszFilename);
// returns the number of fonts installed
This could be your Add font function:

public static bool AddFont(string filename)
{
if (System.IO.File.Exists(filename))
{
// returns true if (>=1) font is installed
return (AddFontResource(filename) != 0);
}
return false;
}

I do not know whether it does the right thing for you, but you may givbe
it a try if it does

Greets,

AS
Nov 16 '05 #4
Oh no, it doesn't work...
Perhaps system font table is something different than system fonts or it
installs the font for the calling app only.

Andreas Schöneck schrieb:
Hi,

You should rather use the GDI Function AddFontResource by P-Invoke,
shouldn't you? I was searching for sample code demonstrating how to load
the font out of a ttf file but all i found were some functions, one of
them is AddFontResource.

This could be your signature:

[DllImport("gdi32")]
static extern int AddFontResource(string lpszFilename);
// returns the number of fonts installed
This could be your Add font function:

public static bool AddFont(string filename)
{
if (System.IO.File.Exists(filename))
{
// returns true if (>=1) font is installed
return (AddFontResource(filename) != 0);
}
return false;
}

I do not know whether it does the right thing for you, but you may givbe
it a try if it does

Greets,

AS

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jean-Christian Imbeault | last post by:
I have a user account on a RH Linux machine but no root access. I succesfully installed apache 1.3 under my /home/ account but can't get PHP to install properly. I have done the following...
1
by: SAP BASIS Consultant | last post by:
Hello, I am installing SAP R/3 on Win2000/SQL Server. There is a CD with the SQL Server RDBMS, as well as another one with SP 3A (Both are from SAP). According to the SAP installation manual,...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
5
by: Gerald Hernandez | last post by:
One of my development PC's died, and I need to have legacy VS and VS.Net installed at the same time. On the now dead PC, I had VS6 installed prior to installing VS.Net. This worked just fine. On...
0
by: Steve | last post by:
I'm posting this message here, so that someone googling here will be able to find it. I was having problems installing cx_Oracle on Solaris. The build would fail with a message: > ld: fatal:...
3
by: jaggi | last post by:
Hi all, I downloaded DB2 enterprise edition from partnerworld on ibm.com and unzipped and untarred it and copied it to CD and tried installing on AIX using SMIT. I am getting errors while...
3
by: mariantrygg | last post by:
Hi I have an app that uses the a2K run-time. I have just discovered that installing this app breaks an access2003 installation causing the user to have to repair the installation using the...
13
by: bjhartin | last post by:
All, I was working at a client's site when I installed Visual Basic 6 on a machine at their request. Existing applications on this machine had specified version 4.0 of the Jet OLEDB provider in...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
11
by: tshad | last post by:
I have a small Windows Service program that just has a timer on it and it built fine. I try to install it using InstallUtil and I get the following message: ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.