PrivateFontCollection??

  • Thread starter Thread starter Alex Davis
  • Start date Start date
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.
 
Back
Top