Solved

Random fonts?

Posted on 2003-12-11
7
1,031 Views
Last Modified: 2013-12-03
Alright. I'm generating Test Data for this OCR Thing, I have a program that writes random numbers and characters to a specified number of images in a sequential order. I'd like to add a bit more to it, anyone know how I can make something do Random Fonts?
0
Comment
Question by:derekthornton
7 Comments
 
LVL 7

Accepted Solution

by:
jj819430 earned 500 total points
ID: 9921016
sure just create a list of the fonts you want to choose from in an array.
{Times New Roman, Blah, Font3, blah, blah....., blah};

item.Font = Random(ArrayofFonts);
where Random returns the random font from the array.
0
 
LVL 2

Author Comment

by:derekthornton
ID: 9921031
Is there any way I can pipe all the system fonts into an array?
0
 
LVL 11

Expert Comment

by:Agarici
ID: 9921188
you can get all the fonts asociated with a specified graphics from the static member 'Families' of the FontFamily class

A.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:smegghead
ID: 9921256
     foreach (FontFamily ff in FontFamily.Families)
      {
            Console.WriteLine(ff.Name);
      }

HTH
Smg.
0
 
LVL 10

Expert Comment

by:smegghead
ID: 9921266
oops, sorry, hadn't seen your post when I submitted.
0
 
LVL 7

Expert Comment

by:TransBind
ID: 9921494
I think you can load all system fonts into array this way
private void button1_Click(object sender, System.EventArgs e)
{
    string[] ArrFont;
    InstalledFontCollection ifc = new InstalledFontCollection();
    FontFamily[] ffs = ifc.Families;
    //Font f;
    foreach(FontFamily ff in ffs)
    {
       ArrFont[ff.ToString()];
    }
}
0
 
LVL 2

Author Comment

by:derekthornton
ID: 9921542
Wow.That worked very well too, TransBind.
Go Here
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20823173.html

for some more Points, Trans.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question