473,418 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

PrivateFontCollection??

Does anyone know how use fonts that are NOT installed on the system?
Alex
Nov 15 '05 #1
3 7574
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]
- mv*@spam.guard.caspershouse.com

"Alex Davis" <al*******@bellsouth.net> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how use fonts that are NOT installed on the system?
Alex

Nov 15 '05 #2
I use this... following is my code:
string fontFamily = "";FontFamily[] fontFamilies;PrivateFontCollection pvtFontCollection = new PrivateFontCollection();pvtFontCollection.AddFontF ile(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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:%2***************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Alex Davis" <al*******@bellsouth.net> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how use fonts that are NOT installed on the system?
Alex


Nov 15 '05 #3
Ok... I have the solution... instead of using the string fontName, I used
the fontFamily[] instead when building the new font.

"Alex Davis" <al*******@bellsouth.net> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how use fonts that are NOT installed on the system?
Alex

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Claus | last post by:
Hi all. I'm messing a bit with PrivateFontCollection. Embedding a ttf-font and streaming it into PrivateFontCollection using AddMemoryFont works like a charm. Changing the Font property on...
3
by: Jonah Olsson | last post by:
Hi guys! I'm trying to use Swedish characters with DrawString but no luck. Do I need to set the Charset somewhere?? I've been searching Google Groups for hours now, but I can't find any help or...
2
by: Alex Davis | last post by:
Does anyone know how use fonts that are NOT installed on the system? Alex
5
by: marko | last post by:
I have created a small script in ASP.NET using VB.NET for creating pictures with text inside. Now I have a problem how to use my own font directory, and not Windows system fonts directory. How...
3
by: al jones | last post by:
Okay, last go 'round for today. I'm looking at the msdn for private font collections. If I add a font to work with - let's presume I'm printing a single line in a particular font and won't use it...
7
by: al jones | last post by:
Okay, I don't have headaches enough from my toy ... If I were to ty to load several fontfiles into a PrivateFontCollection, how would I then select one to use. Let's say that I have a couple of...
0
by: al jones | last post by:
I've gotten back to this piece of code in my 'little' (disgusting) project. I've spent the weekend looking and cannot find a working example of using PrivateFontCollection and can't seem to get...
0
by: Davy | last post by:
Hi, i'm writing a .Net application for printing barcodes to my climbing club. For simplicity reasons, i've embedded my barcode font as a ressource file. When loading my font as a private font...
2
by: mercenary | last post by:
i have a textbox in which i write in bangla(Bengali). but when i try to convert the bangla text into a GIF file the image shows ????? or something like a box. By the way i used AVRO Bangla typing...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.