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: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);

.



Relevant Pages

  • Re: Using local font file (.ttf) in asp.net GDI+ app.
    ... file is located in my root folder. ... If you would need to load a font from the file, ... PrivateFontCollection p = new PrivateFontCollection; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Scaling vs Font setting
    ... I do this resizing in OnInitDlg- but the getting of the original size ... >>The constructor is fed the screen resolution ... > the original size to a later time, OnInitDialog preferably? ... >>and the large font as 120ddpi. ...
    (microsoft.public.vc.mfc)
  • Re: CFont problem in release build
    ... On::Paint Handler, create it in the constructor, then delete it in the ... destructor when you are done with it. ... In the dialog's OnInitDialog handler: ... > OnInitDialog where it is set as the font in a CButton. ...
    (microsoft.public.vc.mfc)
  • Re: Changing the Font size of a Static Text control problem
    ... I am trying to set the font size for my static text and I am getting this error: ... the ClassWizard will add member initialization here ... void CPageInitDialog::DoDataExchange ... On your dialog constructor your CStatic is not yet created. ...
    (microsoft.public.vc.mfc)
  • RE: persisting font info
    ... Serializing sounds like a good way to go. ... Store values for each argument used in the font constructor and it's type ... Serialize the font object store it in a file. ... Can you suggest a better way of saving the font data? ...
    (microsoft.public.dotnet.general)