Solved

Font information in java

Posted on 2004-08-17
5
293 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks :-)
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
:)
0
 
LVL 20

Expert Comment

by:Venabili
Comment Utility
Welcome:)
0

Featured Post

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

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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 …

772 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

11 Experts available now in Live!

Get 1:1 Help Now