Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Font information in java

Posted on 2004-08-17
5
297 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

808 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