Solved

Random fonts?

Posted on 2003-12-11
7
993 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now