The Artima Developer Community
Sponsored Link

Java Answers Forum
Discovering fonts

2 replies on 1 page. Most recent reply: Mar 12, 2004 5:00 AM by Viswanatha Basavalingappa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Discovering fonts Posted: Mar 8, 2004 7:19 PM
Reply to this message Reply
Advertisement
I was wandering how I could dynamically discover all the FONTs available on a machine ...?

\T,


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Discovering fonts Posted: Mar 9, 2004 10:48 AM
Reply to this message Reply
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamil yNames();

Viswanatha Basavalingappa

Posts: 84
Nickname: viswagb
Registered: Nov, 2003

Re: Discovering fonts Posted: Mar 12, 2004 5:00 AM
Reply to this message Reply
Here is sample code for the same.

import java.awt.*;
class MyFonts 
{
	public static void main(String[] args) 
	{
		System.out.println("Hello World!");
		
		String[] str = new String[130];
		str = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); 
		int count = str.length;
		System.out.println("You have " + count+ "Font types in youe computer");
		for(int x=0;x<=count-1; x++)
		{
			System.out.println(x+str[x]+"\n");
		}
	}
}


Viswa
--------

Flat View: This topic has 2 replies on 1 page
Topic: Classloader limits? Previous Topic   Next Topic Topic: Question On Nesting A Class Within A Method


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us