[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Freetype] transformed text in Graphical context
From: |
Klaas Holwerda |
Subject: |
[Freetype] transformed text in Graphical context |
Date: |
Tue, 01 Apr 2003 22:21:08 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 |
Hi,
For some time i try to figure out how to do the following.
Can someone tell me the best approach?
And maybe where in some open source it is done?
I want to have a graphics context ( i call wxDrawer) using freetype
internal for text rendering ( c++ ).
The drawing context can have a transform matrix set for it, by which all
drawing is transformed before
actually drawing it.
Something like the following should be possible, and as fast as possible.
wxDrawer MyDrawer;
MyDrawer->SetFont( "filename", face etc. );
MyDrawer->SetTransForm( MyAffineMatrix );
MyDrawer->DrawText( "blah blah", size1 );
MyDrawer->SetTransForm( MyNextAffineMatrix );
MyDrawer->DrawText( "other blah blah" );
MyDrawer->SetFont( "filename", face etc., size2 );
MyDrawer->SetTransForm( MyOtherAffineMatrix );
MyDrawer->DrawText( "other font blah blah", size3 );
Currently i store the glyphs inside the drawable objects itself, but
this is not very smart, if the
same font/glyphs are used frequently. I looks like this:
http://wxart2d.sourceforge.net/screenshots/freetypetrans.png
Therefore i want to use the wxDrawer drawing context to also be able to
draw freetype strings.
The main problem i see is that the size of the text glyphs/font to draw
will change depending on the transform
that is set for the drawing context. An object containing text can be
placed by several transforms, which
mean a constant change in the font size, or at least its transform.
So how should i cache the font inside my drawing context, in such a
manner that the size is not yet fixed,
and the transform of the drawing context can be applied on the cached
glyphs?
I studied the Caching approach, but it seems to work with more or less
fixed sizes.
Or should i use a fixed Normalized font size inside the drawing
context, and transform and scale
that font/glyhs, to have the transformed DrawText at a certain size?
( understand that my object are in Relative World coordinates, and the
canvas is in worldcoordinates,
the text eventually is transformed to device coordinates directly from
relativeworld to device.
So i have not a clear idea what font size needs to be set, since it is
not defined in any units ( pixel or points ),
this becuase any rectangle in world coordinates can be mapped to the
canvas window. )
Any advice welcome, and thanks in advance,
Klaas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freetype] transformed text in Graphical context,
Klaas Holwerda <=