nanogui: Re: Fonts + rotation


Previous by date: 13 Jan 2000 20:37:15 -0000 Re: loadable JPEG + BMP support for nanox !, Greg Haerr
Next by date: 13 Jan 2000 20:37:15 -0000 Re: Fonts + rotation, Darran D. Rimron
Previous in thread:
Next in thread: 13 Jan 2000 20:37:15 -0000 Re: Fonts + rotation, Darran D. Rimron

Subject: RE: Fonts + rotation
From: Greg Haerr ####@####.####
Date: 13 Jan 2000 20:37:15 -0000
Message-Id: <C1962B36D9BBD311B0F80060083DFEFB040F93@SYS.CenSoft.COM>

: > If you want any rotation, it gets more complicated, since we
: > need to decide whether the "bounding box" for the text is also
: > rotated, etc.
: 
: Greg,
: 
: Unfortunately, we need support for *ANY* rotation angle. We have to
display
: street names on a city map ... So, yes, probably that the bounding box
will
: have to be rotated.
: 
: If you have any brilliant idea ... Meanwhile, I'll keep digging into that
: issue and see what I can do ...

Allright, here's a method that will work, but isn't ridiculously
complicated.

Both the low level driver routines gen_gettextsize and gen_gettextbits
get extended with an "orientation" parameter, which is an integer describing
the degrees rotation clockwise, say.

Now, if the value is zero, everything operates as today.  If the value
specifies rotation, then we assume that only a single character is
being passed, never a string.  This semantic can be enforced from
the upper Gd level.  Then, the gettextbits and/or gettextsize functions
get the normal bitmap, and perform 3 calculations:

	1. Create a new width/height box appropriate for the rotated 
character, assuming upper left/top is 0,0.  The new width/height
is the max required to hold all bits of the rotated glyph image.

	2. Clear all bits in the new box, and then sequentially
apply sin/cos math to each non-zero bit in the original bitmap,
and place them into the new, still square, bitmap.

	3. return this new bitmap.

The upper level can then use the following methods to get the text drawn:

	1. If non-zero orientation is requested, break up the text string
into single characters for the following

	2. turn off background drawing, so that bounding boxes aren't
displayed.

	3. Get each character bitmap (rotated), and use a bresenham-
like algorithm (stolen from GdLine) for determining the new x,y
location for each subsequent character based on the returned w/h
of the previous character.

;-) ?

Greg


Previous by date: 13 Jan 2000 20:37:15 -0000 Re: loadable JPEG + BMP support for nanox !, Greg Haerr
Next by date: 13 Jan 2000 20:37:15 -0000 Re: Fonts + rotation, Darran D. Rimron
Previous in thread:
Next in thread: 13 Jan 2000 20:37:15 -0000 Re: Fonts + rotation, Darran D. Rimron


Powered by ezmlm-browse 0.20.