PrivateFontCollection??

  • Thread starter Thread starter Alex Davis
  • Start date Start date
A

Alex Davis

Does anyone know how use fonts that are NOT installed on the system?
Alex
 
Alex,

You can add the file that the font is in through the AddFontFile method
on the PrivateFontCollection class. Once you have that, you can create a
new font class using the FontFamily that is exposed through the Families
property on the PrivateFontCollection instance.

Hope this helps.
 
I use this... following is my code:
string fontFamily = "";FontFamily[] fontFamilies;PrivateFontCollection pvtFontCollection = new PrivateFontCollection();pvtFontCollection.AddFontFile(Server.MapPath(Request.ApplicationPath) + "\\fonts\\OLDENGL.TTF");fontFamilies = pvtFontCollection.Families;fontFamily = fontFamilies[0].Name;lblMessage.Text += fontFamily; //Old English Text MTFont fancyFont = new Font(fontFamily, 50, FontStyle.Regular, GraphicsUnit.Pixel);lblMessage.Text += fancyFont.Name; //Microsoft Sans Seriftext = "Certificate of Completion";start = GetPrintStartPosition(text, fancyFont, objGraphic, objBitmap);objGraphic.DrawString(text, fancyFont, blackBrush, start + 2, _base); // This is still printing Ariel_base += 150;Am I missing something?


Nicholas Paldino said:
Alex,

You can add the file that the font is in through the AddFontFile method
on the PrivateFontCollection class. Once you have that, you can create a
new font class using the FontFamily that is exposed through the Families
property on the PrivateFontCollection instance.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Alex Davis said:
Does anyone know how use fonts that are NOT installed on the system?
Alex
 
Ok... I have the solution... instead of using the string fontName, I used
the fontFamily[] instead when building the new font.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top