Solved

Random fonts?

Posted on 2003-12-11
7
1,043 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
Suggested Courses

739 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