Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

LASi::PostscriptDocument Class Reference

Composes Postscript document as three separate and independant streams for header, body and footer. More...

#include <LASi.h>

List of all members.

Public Member Functions

 PostscriptDocument::PostscriptDocument ()
 PostscriptDocument::~PostscriptDocument ()
void setFont (const char *const family="sans", LASi::FontStyle=LASi::NORMAL_STYLE, LASi::FontWeight=LASi::NORMAL_WEIGHT, LASi::FontVariant=LASi::NORMAL_VARIANT, LASi::FontStretch=LASi::NORMAL_STRETCH)
 Sets the font that all subsequent text written to bodyStream() or footerStream() will be rendered with.
void setFontSize (const double size)
 Sets the font size, in points, that all subsequent text written to bodyStream() or footerStream() will be rendered with.
std::ostringstream & osHeader ()
 Returns stream for Postscript header.
oPostscriptStreamosBody ()
 Returns stream for Postscript body.
oPostscriptStreamosFooter ()
 Returns stream for Postscript footer.
void write (std::ostream &os)
 Closes all streams and writes completed Postscript document to os.
void get_dimensions (const char *s, double *lineSpacing, double *xAdvance=NULL, double *yMin=NULL, double *yMax=NULL)
 Return string dimensions: lineSpacing: inter-line spacing xAdvance: width of the string yMin: y-coordinate bounding the lowest descender, Indic under-consonantal vowel, etc.

Protected Types

typedef std::map< GlyphId,
FreetypeGlyphMgr
GlyphMap
 Maps glyph routine name to FT_Glyph instance.
typedef void(PostscriptDocument::* GLYPH_FUNC )(const GlyphMap::value_type &, void *contextData)
 Pointer to a function that takes a reference to a glyph and to x and y coordinates.

Protected Member Functions

void invoke_glyph_routine (const GlyphMap::value_type &, void *contextData)
 Insert a Postscript glyph_routine call into output stream (contextData).
void accrue_dimensions (const GlyphMap::value_type &, void *contextData1)
 Add the next glyphs dimensions to the bounding box (contextData).
void for_each_glyph_do (const std::string &, const GLYPH_FUNC, void *contextData)
 Decomposes string into glyphs and applies GLYPH_FUNC to each glyph.
PangoContext * PostscriptDocument::pangoContext () const
std::string glyphProcName () const
double getFontSize ()

Private Attributes

GlyphMap _glyphMap
ContextMgr_pContextMgr
double _fontSize
std::ostringstream _osHeader
oPostscriptStream _osBody
oPostscriptStream _osFooter

Static Private Attributes

const unsigned int DRAWING_SCALE = PANGO_SCALE

Friends

class write_glyph_routine_to_stream
class show


Detailed Description

Composes Postscript document as three separate and independant streams for header, body and footer.

Body and footer streams respond to LASi::show applicator which generates Postscript commands to display a string by using glyph routines instead of a Postscript font.


Member Typedef Documentation

typedef void(PostscriptDocument::* LASi::PostscriptDocument::GLYPH_FUNC)(const GlyphMap::value_type &, void *contextData) [protected]
 

Pointer to a function that takes a reference to a glyph and to x and y coordinates.

May return new x and y coordinates.

typedef std::map<GlyphId, FreetypeGlyphMgr> LASi::PostscriptDocument::GlyphMap [protected]
 

Maps glyph routine name to FT_Glyph instance.


Constructor & Destructor Documentation

LASi::PostscriptDocument::PostscriptDocument::~PostscriptDocument  ) 
 


Member Function Documentation

void PostscriptDocument::accrue_dimensions const GlyphMap::value_type &  mapval,
void *  contextData
[protected]
 

Add the next glyphs dimensions to the bounding box (contextData).

If the advance is in the x direction (the usual case), the box grows in the x direction, yMax becomes the height of the tallest character, and yMin the descent of the most descending character.

Parameters:
mapval std::pair<GlyphId, FreetypeGlyphMgr>
contextData std::pair<double, double>, the x and y dimensions

void LASi::PostscriptDocument::for_each_glyph_do const std::string &  ,
const   GLYPH_FUNC,
void *  contextData
[protected]
 

Decomposes string into glyphs and applies GLYPH_FUNC to each glyph.

void PostscriptDocument::get_dimensions const char *  s,
double *  lineSpacing,
double *  xAdvance = NULL,
double *  yMin = NULL,
double *  yMax = NULL
 

Return string dimensions: lineSpacing: inter-line spacing xAdvance: width of the string yMin: y-coordinate bounding the lowest descender, Indic under-consonantal vowel, etc.

yMax: y-coordinate bounding the highest ascender, diacritic, Indic over-letter vowel, etc.

double LASi::PostscriptDocument::getFontSize  )  [inline, protected]
 

Returns:
font size in points (1/72 in.)

std::string LASi::PostscriptDocument::glyphProcName  )  const [protected]
 

Returns:
name of Postscript glyph routine

void PostscriptDocument::invoke_glyph_routine const GlyphMap::value_type &  mapval,
void *  contextData
[protected]
 

Insert a Postscript glyph_routine call into output stream (contextData).

oPostscriptStream& LASi::PostscriptDocument::osBody  )  [inline]
 

Returns stream for Postscript body.

oPostscriptStream& LASi::PostscriptDocument::osFooter  )  [inline]
 

Returns stream for Postscript footer.

std::ostringstream& LASi::PostscriptDocument::osHeader  )  [inline]
 

Returns stream for Postscript header.

PangoContext* LASi::PostscriptDocument::PostscriptDocument::pangoContext  )  const [protected]
 

LASi::PostscriptDocument::PostscriptDocument::PostscriptDocument  ) 
 

void PostscriptDocument::setFont const char *const   family = "sans",
LASi::FontStyle  = LASi::NORMAL_STYLE,
LASi::FontWeight  = LASi::NORMAL_WEIGHT,
LASi::FontVariant  = LASi::NORMAL_VARIANT,
LASi::FontStretch  = LASi::NORMAL_STRETCH
 

Sets the font that all subsequent text written to bodyStream() or footerStream() will be rendered with.

void LASi::PostscriptDocument::setFontSize const double  size  )  [inline]
 

Sets the font size, in points, that all subsequent text written to bodyStream() or footerStream() will be rendered with.

void PostscriptDocument::write std::ostream &  os  ) 
 

Closes all streams and writes completed Postscript document to os.

Header will include glyph routines for all text glyphs in body and footer.


Friends And Related Function Documentation

friend class show [friend]
 

friend class write_glyph_routine_to_stream [friend]
 


Member Data Documentation

double LASi::PostscriptDocument::_fontSize [private]
 

GlyphMap LASi::PostscriptDocument::_glyphMap [private]
 

oPostscriptStream LASi::PostscriptDocument::_osBody [private]
 

oPostscriptStream LASi::PostscriptDocument::_osFooter [private]
 

std::ostringstream LASi::PostscriptDocument::_osHeader [private]
 

ContextMgr* LASi::PostscriptDocument::_pContextMgr [private]
 

const unsigned int PostscriptDocument::DRAWING_SCALE = PANGO_SCALE [static, private]
 


The documentation for this class was generated from the following files:
Generated on Thu Dec 23 03:58:33 2004 for LASi by  doxygen 1.3.9.1