> does anyone have any experience creating an openFont object? openfont
> being a different type of font then truetype fonts.
> I know that in the api there is an openFont interface,
Do you mean "OpenType", or is OpenFont a font type that I haven't heard of ?
There is an java.awt.font.OpenType interface, and a MultipleMaster interface,
but I don't think there's anything matching *OpenFont*.
> however I have
> not been able to find any resources online about how to implement the
> openfont interface.
Assuming you do mean OpenType, as far as I can tell that interface is never
used -- no class implements it or refers to it, not even any of the private
classes in a JRE distribution.
What do you want to do with the interface ?
(FWIW -- this may be completely irrelevant -- it appears that Java's font-file
handling can open OpenType fonts. However the resulting object does not
implement the java.font.OpenType interface. I'm not sure how much use Java's
default font engine can make of the "advanced" features in OpenType)
-- chris
tiewknvc9 - 05 Apr 2006 16:29 GMT
Im trying to use the opentype fonts in a graphics object in my
application... Basically I want to try and give the user the
flexibility to use as many font types as possible.
Basically in the end they are creating something, so more options means
a better program...
Chris Uppal - 06 Apr 2006 10:53 GMT
> Im trying to use the opentype fonts in a graphics object in my
> application... Basically I want to try and give the user the
> flexibility to use as many font types as possible.
The picture with OpenType turns out to be pretty complicated, and I don't claim
to know much about it. It's essentially two independent formats "magically"
bundled into one. One of those is PostScript CFF format, and the Sun font
handling can't decode those (which is a bit strange since it /can/ handle Type1
fonts...). The other is (a generalisation of) TrueType, and it appears that
the Sun stuff can handle (at least in some cases) those.
OpenType fonts are (according to MS) given various suffixes, including .TTF and
.OTF. TTF can be used for either OpenType or TrueType. CFF fonts should
always be named .OTF.
So if you have a .otf file, then you don't know which format it's in. You can
try to open it with
Font.createFont(aFile, Font.TRUETYPE_FONT);
which will throw an exception if the data turns out to be CFF (or if the font
machinery is otherwise unable to cope with it).
FWIW, OpenType font files containing CFF data always start with:
{ 0x4F, 0x54, 0x54, 0x4F }
(the string 'OTTO' in many character encodings) which might be of some use in
pre-filterning lists of font files to offer to the user.
-- chris
tiewknvc9 - 07 Apr 2006 16:30 GMT