Solved

Random fonts?

Posted on 2003-12-11
7
1,006 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 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