Re: Using local font file (.ttf) in asp.net GDI+ app.

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Oct 20, 1:59 pm, Alexey Smirnov <alexey.smir...@xxxxxxxxx> wrote:
On Oct 20, 1:54 pm, Alexey Smirnov <alexey.smir...@xxxxxxxxx> wrote:





On Oct 20, 1:45 pm, deeh...@xxxxxxxxx wrote:

Hi,

I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...

Font f = new Font(Server.MapPath("somefont.ttf"), 200);

Thank you for your time.

Regards,

Hensson

Font.Font(String, Single) Constructor has a family name as a first
parameter, not a file namehttp://msdn2.microsoft.com/en-us/library/164w6x6z.aspx

P.S.

If you would need to load a font from the file, try following:

PrivateFontCollection p = new PrivateFontCollection();
p.AddFontFile(Server.MapPath("somefont.ttf"));
FontFamily ff= privateFontCollection.Families[0];
Font f = new Font(ff, 200);- Hide quoted text -

- Show quoted text -

FontFamily ff= p.Families[0];

.



Relevant Pages

  • RE: Render Image from Font
    ... /System.Drawing.Text namespace can finish the task. ... "PrivateFontCollection" class to load a ttf file from disk ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: PrivateFontCollection Quastion
    ... ' alWork2 is an arraylist of items containing information about the font in question ... object say rich text box, and at some point you want to know which font is ... either update the PrivateFontCollection item i.e the Font Item you ... So let's for argument say that I create the collection, load a font that ...
    (microsoft.public.dotnet.languages.vb)
  • PrivateFontCollection Quastion
    ... several fontfiles into a PrivateFontCollection, how would I then select one ... Creating the PrivateFontCollection is pretty self expanatory (or so it ... So let's for argument say that I create the collection, load a font that I ...
    (microsoft.public.dotnet.languages.vb)
  • Re: PrivateFontCollection Quastion
    ... FontCollection item as its own class, and then add a Boolean value to ... several fontfiles into a PrivateFontCollection, ... So let's for argument say that I create the collection, load a font that I ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using local font file (.ttf) in asp.net GDI+ app.
    ... file is located in my root folder. ... Constructor has a family name as a first ... If you would need to load a font from the file, ... PrivateFontCollection p = new PrivateFontCollection; ...
    (microsoft.public.dotnet.framework.aspnet)