Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Random fonts?

Posted on 2003-12-11
7
Medium Priority
?
1,105 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 2000 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

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!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

636 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