Solved

Font information in java

Posted on 2004-08-17
5
296 Views
Last Modified: 2013-12-03
Hi,
I have 2 questions about the java fonts.
 1. How to determine if a font is a fixed-width font?
 2. How to determine the language(s) supported by a given font?

Thanks!
0
Comment
Question by:shji1
  • 2
  • 2
5 Comments
 
LVL 35

Assisted Solution

by:girionis
girionis earned 60 total points
ID: 11821341
Not sure about fixed width. For your second question you might be able to do it if you read the properties of the fonts. For more info have a look here: http://java.sun.com/j2se/1.4.2/docs/guide/intl/fontprop.html
0
 
LVL 20

Accepted Solution

by:
Venabili earned 65 total points
ID: 11856851
1. Use
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/FontMetrics.html#charWidth(char)
and check the size of i and W
At least I do not know other way... (you may check all the letters also but i and W are different in any not fixed size font)

About the FontMetrics object - you will need some strange things to do .. as most of the way to take it are deprecated. *sigh*Use this for example: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/DebugGraphics.html#getFontMetrics(java.awt.Font)
Or if you have another Graphic object you have no troubles :)

2. girionis gave you the only answer I know....
0
 
LVL 1

Author Comment

by:shji1
ID: 11862731
Thanks :-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 11862982
:)
0
 
LVL 20

Expert Comment

by:Venabili
ID: 11867850
Welcome:)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 33
GUI builder for Eclipse? 8 35
nextBoolean(double p) for Random class 3 40
How do I remove an object from a 3 26
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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