[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] RE: FreeType and Type 1C fonts
From: |
Ken Carpenter |
Subject: |
[Devel] RE: FreeType and Type 1C fonts |
Date: |
Fri, 11 May 2001 10:06:11 -0700 |
>I'd rather try to provide something that is as close as
>possible to what FT2 provides, i.e. a font service..
>Java2D seems a very interesting graphics library, and I'm
>pretty certain you'd better use it (as well as the usual
>Java high-speed containers) to perform your
>caching/blitting.
I plan to cache handles to the faces I create in Java
containers. The handles will be Java "longs" which
represent pointers to FT_Face structures on the C++ side.
I'll also cache the library pointer this way.
>Of course, if the compositing is the problem, there is
>nothing you can really do to solve that within FT2 :-)
What I see FT2 giving me is CFF (Type 1C) rasterizing
which Java does not, and the ability to write my own
compositing code on the C++ side of my JNI binding.
Basically, I would pass in all the positioning and
transformation parameters from the Java side, as well
as the byte array that holds the Java bitmap data.
I would then render each character in the string to
the glyph slot one-by-one and write my own routine to
composite the anti-aliased glyph into my bitmap,
applying the specified text color at the same time.
My plan right now is to just wrap the part of FT2 that
I need. My simple Java-side API will probably look
something like this:
class JFreeType
{
JFreeType()
{
/* Init FreeType library and store the returned library
* handle in a long value
*/
}
long createFace(String filename) {}
long createMemoryFace(byte[] fontData,
int offset,
int length) {}
void renderText(String text,
long face,
double pointSize,
AffineTransform xfm,
double x,
double y,
Color textColor,
byte[] bitmapData,
int width,
int height) {}
Rectangle2D getBoundingRect(
String text,
long face,
double pointSize,
AffineTransform xfm,
double x,
double y) {}
These
Ken Carpenter