.if n .pH arch.glyph @(#)glyph	40.1
.ig
imaged dc 8/30/89
docformat -c -s4 -dqm4 fn
..
.\" turn off automatic hyphenation -- JHevelin (08-09-89)
.am RT
.nh
..
.ds S) Shapes
.BK "Shapes Internal Architecture"
.CH "The GLYPH Object" "8" 
.H 1 "The GLYPH Object" 
.H 2 "The Headers"
.nh
Glyphs are representations of text character bit maps.
Strings of glyphs (Poly_Glyphs) are constructed
using arrays of GLYPH_REF structures.
\*(S) assumes that glyphs are always allocated on
aligned 32-bit address boundaries,
and that the bit map data for a glyph immediately
follows the glyph structure in memory.
.PC
typedef struct sh_glyph
  {
   Unsgn8	gl_TYPE;	/* glyph depth and alignment */
   Unsgn8	gl_empty;	/* empty for now */
   Unsgn16	gl_WIDTH;	/* glyph width */
   Unsgn16	gl_HEIGHT;	/* glyph height */
   Unsgn16	gl_LINEBYTES;	/* struct size must be multiple of 4 bytes */
  } *GLYPH;
.SF
.H 2 gl_TYPE
.P
The gl_TYPE field of the glyph structure is
broken up as follows:
.PC
8 7 6 5 4 3 2 1
--- ----- -----
 |    |     |______ depth (1,8,4,32)
 |    |____________ alignment (8, 16, 32)
 |_________________ space/speed
.SF
Currently, Shapes only supports 1 bit depth and 16
and 32 bit alignment.
It expects all glyphs up to 16 bits wide to be 16
bit aligned except for VGA.
VGA internally uses 32 bit alignment.
Anything else over that will be converted.

.H 2 gl_WIDTH
.P
The glyph width in pixels.
.H 2 gl_HEIGHT
.P
The glyph height in pixels.
.H 2 gl_LINEBYTES
.P
The number of bytes per scanline needed to access the glyph
(including padding).
.P
The representation of glyph bit map data is
device-dependent and usually matches the bit/byte
order of the most commonly used framebuffer.
For example, the most significant bit of the
first 32 bit word of data after the GLYPH is the
first pixel in the glyph on Sun3 and Sun4
architectures while the least significant bit of
that word is the first pixel in the glyph on a
Sun386 architecture.
.PC
typedef	struct
  {
   GLYPH	gr_glyph;	/* glyph to display */
   Unsgn16	gr_x, gr_y;	/* position of glyph upper left corner */
  } GLYPH_REF;
.SF
.H 2 gr_glyph
.P
Points to the GLYPH to be displayed.
.H 2 "gr_x, gr_y"
.P
These are the raster coordinates of where the
upper left corner of that glyph should be displayed.
.P
Glyphs are rendered in Shapes as if the glyph
bitmap data represented a 2D clip mask that is
being filled:\ \&
the 1's get filled and the 0's don't.
To render the background pixels,
Shapes supports X11 image text functionality,
where the polyglyph bounding box can be filled
with the background color before glyphs are
rendered over it.
