Java Font and CMAP

K

keepa

I am writing a charmap application that shows all the characters
defined in a font. The problem is there is no way to know, at least
from Java's Font class, what those characters are. It seems that the
CMAP table in a TTF font file is not exposed by the Font class.

Is there any way to determine what characters are present in a Font?
 
T

Thomas Weidenfeller

keepa said:
I am writing a charmap application that shows all the characters
defined in a font. The problem is there is no way to know, at least
from Java's Font class, what those characters are. It seems that the
CMAP table in a TTF font file is not exposed by the Font class.

Is there any way to determine what characters are present in a Font?

See the various Font.canDisplay...() methods. However, there are two
issues with them:

1) They tend not to work properly at all.

2) The methods' way of working is BS. Either one has to loop (from 0 to
0x10FFFF), or they loop over a range. Both ways are not really suitable
for figuring out all available glyphs.

Maybe you can have a look at apache fop. I seem to remember they have
own TrueType/OpenType font file reading classes and maybe they provide
the information you need.

/Thomas
 
R

Roedy Green

Maybe you can have a look at apache fop. I seem to remember they have
own TrueType/OpenType font file reading classes and maybe they provide
the information you need.

http://xmlgraphics.apache.org/fop/0.20.5/fonts.html#type1-metrics
I read it they have TrueType and Type 1 but not OpenType support.

That project needs an overview section. So many of those projects leap
into the detail without giving you the tiniest clue what the project
is for or generally how it works.
 
T

Thomas Weidenfeller

Roedy said:
http://xmlgraphics.apache.org/fop/0.20.5/fonts.html#type1-metrics
I read it they have TrueType and Type 1 but not OpenType support.

I didn't check it. But since OpenType is basically TrueType plus Type 1
encapsulated in a TrueType format there might still be hope.
That project needs an overview section. So many of those projects leap
into the detail without giving you the tiniest clue what the project
is for or generally how it works.

Yep. Many web sites, not only many software sites, behave as if every
visitor is supposed to exactly know what the site is about. I have given
up counting the number of times where I ended up on some site (e.g. via
Google), and couldn't for the life of me figure out what it was about,
if it might potentially be useful for me.

Even more annoying is that the owners of such sites are very often
absolutely clue-resistant and can't be bothered to add two or three
simple sentences to their main page :-( They live in their on little
universe and simply can't understand it.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top