- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class 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 ()
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.
oPostscriptStream & | osBody ()
| Returns stream for Postscript body.
oPostscriptStream & | osFooter ()
| Returns stream for Postscript footer.
void | write (std::ostream &os, double llx=0, double lly=0, double urx=0, double ury=0)
| 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.
void | get_dimensions (std::string s, double *lineSpacing, double *xAdvance=NULL, double *yMin=NULL, double *yMax=NULL)
| Returns the line spacing, x-advance, y-minimum and y-maximum based on the current font face and font size.
## 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)
void | accrue_dimensions (const GlyphMap::value_type &, void *contextData1)
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 * | pangoContext () const
std::string | glyphProcName () const
| Returns: name of Postscript glyph routine
double | getFontSize ()
| Returns: font size in points (1/72 in.
## Private Attributes
GlyphMap | _glyphMap
ContextMgr * | _pContextMgr
double | _fontSize
std::ostringstream | _osHeader
oPostscriptStream | _osBody
oPostscriptStream | _osFooter
## Static Private Attributes
static const unsigned int | DRAWING_SCALE = PANGO_SCALE
## Friends
class | write_glyph_routine_to_stream
class | show
## Classes
class | GlyphId
| For internal use only. More...
class | write_glyph_routine_to_stream
| For internal use only. More...

## 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 std::map<GlyphId, FreetypeGlyphMgr> LASi::PostscriptDocument::GlyphMap`[protected]`

Maps glyph routine name to FT_Glyph instance.

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.

## Constructor & Destructor Documentation

PostscriptDocument::PostscriptDocument | ( |  | ) |

PostscriptDocument::~PostscriptDocument | ( |  | ) |

## Member Function Documentation

void PostscriptDocument::setFont | ( | const char *const | family = `"sans"`,
|  | LASi::FontStyle | style = `LASi::NORMAL_STYLE`,
|  | LASi::FontWeight | weight = `LASi::NORMAL_WEIGHT`,
|  | LASi::FontVariant | variant = `LASi::NORMAL_VARIANT`,
|  | LASi::FontStretch | stretch = `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.

std::ostringstream& LASi::PostscriptDocument::osHeader | ( |  | ) | `[inline]`

Returns stream for Postscript header.

oPostscriptStream& LASi::PostscriptDocument::osBody | ( |  | ) | `[inline]`

Returns stream for Postscript body.

oPostscriptStream& LASi::PostscriptDocument::osFooter | ( |  | ) | `[inline]`

Returns stream for Postscript footer.

void PostscriptDocument::write | ( | std::ostream & | os,
|  | double | llx = `0`,
|  | double | lly = `0`,
|  | double | urx = `0`,
|  | double | ury = `0` |
| ) |  |  |

Closes all streams and writes completed Postscript document to os.

Writes out the document.

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

2006.05.01.ET Addendum: To create an EPS document, just include the the four BoundingBox coordinates llx, lly, urx, ury (dimensions in points). These are optional parameters -- When not included, you'll get a regular PS document. When included, you'll get an EPS document.

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.

Returns the line spacing, x-advance, y-minimum and y-maximum based on the current font face and font size.

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

A bounding box around the text string, s, can be constructed from the xAdvance, yMinimum, and yMaximum. yMinimum tells you the descent from the baseline. yMaximum tells you the ascent from the baseline. The line spacing provides an inter-line spacing for multi-line text layout.

This version accepts a const C-style character string.

void PostscriptDocument::get_dimensions | ( | std::string | s,
|  | double * | lineSpacing,
|  | double * | xAdvance = `NULL`,
|  | double * | yMin = `NULL`,
|  | double * | yMax = `NULL` |
| ) |  |  |

Returns the line spacing, x-advance, y-minimum and y-maximum based on the current font face and font size.

A bounding box around the text string, s, can be constructed from the xAdvance, yMinimum, and yMaximum. yMinimum tells you the descent from the baseline. yMaximum tells you the ascent from the baseline. The line spacing provides an inter-line spacing for multi-line text layout.

This version accepts an STL standard string class string.

void LASi::PostscriptDocument::invoke_glyph_routine | ( | const GlyphMap::value_type & | ,
|  | void * | contextData |
| ) |  |  | `[protected]`

void LASi::PostscriptDocument::accrue_dimensions | ( | const GlyphMap::value_type & | ,
|  | void * | contextData1 |
| ) |  |  | `[protected]`

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.

PangoContext * PostscriptDocument::pangoContext | ( |  | ) | const`[inline, protected]`

std::string LASi::PostscriptDocument::glyphProcName | ( |  | ) | const`[protected]`

Returns:
  name of Postscript glyph routine

double LASi::PostscriptDocument::getFontSize | ( |  | ) | `[inline, protected]`

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

)

## Friends And Related Function Documentation

friend class write_glyph_routine_to_stream`[friend]`

friend class show`[friend]`

## Member Data Documentation

GlyphMap LASi::PostscriptDocument::_glyphMap`[private]`

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

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

double LASi::PostscriptDocument::_fontSize`[private]`

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

oPostscriptStream LASi::PostscriptDocument::_osBody`[private]`

oPostscriptStream LASi::PostscriptDocument::_osFooter`[private]`

The documentation for this class was generated from the following files:

- LASi.h
- psDoc.cpp