Hi !

I wonder how I can change the font of a .NET C# application ? I have a
".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
you have tutorials it will be great too.

Should I copy it to Windows System folder ?

Thanks in advance,

Regards.

Sadi.

RE: How to use a custom font by RakeshRajan

RakeshRajan
Tue Oct 19 09:07:02 CDT 2004

Hi Sadi,

Are you trying to change the font of a windows form?

Or are you trying to install a ttf file and set that as the font for your
windows form?

Regards,
Rakesh Rajan


"Sadi" wrote:

> Hi !
>
> I wonder how I can change the font of a .NET C# application ? I have a
> ".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
> you have tutorials it will be great too.
>
> Should I copy it to Windows System folder ?
>
> Thanks in advance,
>
> Regards.
>
> Sadi.

RE: How to use a custom font by Sadi

Sadi
Tue Oct 19 09:53:07 CDT 2004

Hi Rakesh,

In fact my application will run under WinCE 5.0.

I want to display some part of text (using the .DrawString() method) with a
font file "filename.ttf". I am currently emulating my application with the
WinCE emulator.

1] I have installed this font in my desktop windows font dir.
I tried to use the font with this :
>> Font fontfilename = new Font("filename",12,FontStyle.Regular);
It don't work. I think the problem is that the font file is not installed in
the emulator.

2] That's why I have attached the file to my project as an embedded ressource.
I have seen that with GDI+ I can specify the location of the font with
PrivateFontCollection. But I get an error when I type this :
>>PrivateFontCollection privateFontCollection = new PrivateFontCollection();

"The type or namespace name 'PrivateFontCollection' could not be found (are
you missing a using directive or an assembly reference?)"

I don't know what else to do.

Regards.
Sadi.

"Rakesh Rajan" wrote:

> Hi Sadi,
>
> Are you trying to change the font of a windows form?
>
> Or are you trying to install a ttf file and set that as the font for your
> windows form?
>
> Regards,
> Rakesh Rajan
>
>
> "Sadi" wrote:
>
> > Hi !
> >
> > I wonder how I can change the font of a .NET C# application ? I have a
> > ".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
> > you have tutorials it will be great too.
> >
> > Should I copy it to Windows System folder ?
> >
> > Thanks in advance,
> >
> > Regards.
> >
> > Sadi.

RE: How to use a custom font by RakeshRajan

RakeshRajan
Tue Oct 19 10:53:08 CDT 2004

Hi Sadi,

I am not sure about WinCE, but using the PrivateFontCollection is indeed the
way to use a font which our own app comes with. Specifically, you could use
the AddFontFile method of the class to accomplish this. Check out this
article in MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/_gdiplus_creating_a_private_font_collection_usecsharp.asp

Have you added the using directive to the System.Drawing.Text namespace?
This could be reason why the problem is caused.

HTH,
Rakesh Rajan

"Sadi" wrote:

> Hi Rakesh,
>
> In fact my application will run under WinCE 5.0.
>
> I want to display some part of text (using the .DrawString() method) with a
> font file "filename.ttf". I am currently emulating my application with the
> WinCE emulator.
>
> 1] I have installed this font in my desktop windows font dir.
> I tried to use the font with this :
> >> Font fontfilename = new Font("filename",12,FontStyle.Regular);
> It don't work. I think the problem is that the font file is not installed in
> the emulator.
>
> 2] That's why I have attached the file to my project as an embedded ressource.
> I have seen that with GDI+ I can specify the location of the font with
> PrivateFontCollection. But I get an error when I type this :
> >>PrivateFontCollection privateFontCollection = new PrivateFontCollection();
>
> "The type or namespace name 'PrivateFontCollection' could not be found (are
> you missing a using directive or an assembly reference?)"
>
> I don't know what else to do.
>
> Regards.
> Sadi.
>
> "Rakesh Rajan" wrote:
>
> > Hi Sadi,
> >
> > Are you trying to change the font of a windows form?
> >
> > Or are you trying to install a ttf file and set that as the font for your
> > windows form?
> >
> > Regards,
> > Rakesh Rajan
> >
> >
> > "Sadi" wrote:
> >
> > > Hi !
> > >
> > > I wonder how I can change the font of a .NET C# application ? I have a
> > > ".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
> > > you have tutorials it will be great too.
> > >
> > > Should I copy it to Windows System folder ?
> > >
> > > Thanks in advance,
> > >
> > > Regards.
> > >
> > > Sadi.

RE: How to use a custom font by Sadi

Sadi
Wed Oct 20 02:59:02 CDT 2004

Hi Rakesh,

The problem came from .NET compact framework, I am not sure that it support
the System.Drawing.Text.dll. I cannnot add an assembly reference to this
library. I will try to get confirmation in .NET Compact Framework neewsgroup.

Regards.

Sadi.

"Rakesh Rajan" wrote:

> Hi Sadi,
>
> I am not sure about WinCE, but using the PrivateFontCollection is indeed the
> way to use a font which our own app comes with. Specifically, you could use
> the AddFontFile method of the class to accomplish this. Check out this
> article in MSDN:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/_gdiplus_creating_a_private_font_collection_usecsharp.asp
>
> Have you added the using directive to the System.Drawing.Text namespace?
> This could be reason why the problem is caused.
>
> HTH,
> Rakesh Rajan
>
> "Sadi" wrote:
>
> > Hi Rakesh,
> >
> > In fact my application will run under WinCE 5.0.
> >
> > I want to display some part of text (using the .DrawString() method) with a
> > font file "filename.ttf". I am currently emulating my application with the
> > WinCE emulator.
> >
> > 1] I have installed this font in my desktop windows font dir.
> > I tried to use the font with this :
> > >> Font fontfilename = new Font("filename",12,FontStyle.Regular);
> > It don't work. I think the problem is that the font file is not installed in
> > the emulator.
> >
> > 2] That's why I have attached the file to my project as an embedded ressource.
> > I have seen that with GDI+ I can specify the location of the font with
> > PrivateFontCollection. But I get an error when I type this :
> > >>PrivateFontCollection privateFontCollection = new PrivateFontCollection();
> >
> > "The type or namespace name 'PrivateFontCollection' could not be found (are
> > you missing a using directive or an assembly reference?)"
> >
> > I don't know what else to do.
> >
> > Regards.
> > Sadi.
> >
> > "Rakesh Rajan" wrote:
> >
> > > Hi Sadi,
> > >
> > > Are you trying to change the font of a windows form?
> > >
> > > Or are you trying to install a ttf file and set that as the font for your
> > > windows form?
> > >
> > > Regards,
> > > Rakesh Rajan
> > >
> > >
> > > "Sadi" wrote:
> > >
> > > > Hi !
> > > >
> > > > I wonder how I can change the font of a .NET C# application ? I have a
> > > > ".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
> > > > you have tutorials it will be great too.
> > > >
> > > > Should I copy it to Windows System folder ?
> > > >
> > > > Thanks in advance,
> > > >
> > > > Regards.
> > > >
> > > > Sadi.

RE: How to use a custom font by Sadi

Sadi
Fri Oct 22 04:45:02 CDT 2004

I have not received an answer from the .NET Compact framework neewsgroup, I
am quite sure that System.Drawing.Text is not available.

Does anyone have an idea to use custom font without System.Drawing.Text
PrivateFontCollection

Thanks in advance,
Regards.

Sadi

"Sadi" wrote:

> Hi !
>
> I wonder how I can change the font of a .NET C# application ? I have a
> ".ttf", I suppose it's a TrueType font file. I will appreciate any help, if
> you have tutorials it will be great too.
>
> Should I copy it to Windows System folder ?
>
> Thanks in advance,
>
> Regards.
>
> Sadi.