STLL  0.0
Simple Text Layouting Library
STLL Namespace Reference

The namespace for the library. Every function and class is within this namespace. More...

Classes

class  AttributeIndex_c
 collection of codepointAttributes for the layouter. More...
 
class  CodepointAttributes_c
 this structure contains all attributes that a single glyph can get assigned More...
 
class  Color_c
 a little class representing an RGBA colour value, an a value of 255 is assumed to be opaque More...
 
class  CommandData_c
 This structure encapsulates a drawing command. More...
 
class  Font_c
 contains all the FontFaces_c of one FontRessource_c More...
 
class  FontCache_c
 this class encapsulates open fonts of a single library, it makes sure that each font is open only once More...
 
class  FontFace_c
 This class represents one font, made out of one font file resource with a certain size. More...
 
class  FontFamily_c
 a class contains all resources for a family of fonts More...
 
class  FontResource_c
 This class represents a font resource. More...
 
class  FreetypeException_c
 This class is thrown on problems with the FreeType library. More...
 
class  FreeTypeLibrary_c
 This class encapsulates an instance of the FreeType library. More...
 
class  LayoutProperties_c
 this structure contains information for the layouter how to layout the text More...
 
class  RectangleShape_c
 concrete implementation of the shape that will allow layouting inside a rectangular with a certain width More...
 
class  Shape_c
 base class to define the shape to layout text into More...
 
class  showOpenGL
 a class to output layouts using OpenGL More...
 
class  showSDL
 a class to output layouts using SDL More...
 
class  TextLayout_c
 encapsulates a finished layout. More...
 
class  TextStyleSheet_c
 this class encapsulates information for how to format a text, just like the style sheets in html are doing. More...
 
class  XhtmlException_c
 exception thrown on XHTML and CSS problems More...
 

Typedefs

typedef uint32_t glyphIndex_t
 type used for all glyph indices. Right now there is no font with more than 2^16 fonts, so 2^32 should be on the safe side. Also HarfBuzz also uses only 2^32 codepoints. More...
 

Enumerations

enum  SubPixelArrangement {
  SUBP_NONE, SUBP_RGB, SUBP_BGR, SUBP_RGB_V,
  SUBP_BGR_V
}
 define, which sub-pixel arrangement you want to use for sub-pixel output More...
 

Functions

void addHyphenDictionary (const std::vector< std::string > &langs, std::istream &str)
 register a hyphen dictionary for a given set of languages More...
 
void addHyphenDictionary (const std::vector< std::string > &langs, std::istream &&str)
 see the other addHyphenDictionary function More...
 
TextLayout_c layoutParagraph (const std::u32string &txt32, const AttributeIndex_c &attr, const Shape_c &shape, const LayoutProperties_c &prop, int32_t ystart=0)
 
TextLayout_c layoutXML (pugi::xml_node txt, const TextStyleSheet_c &rules, const Shape_c &shape)
 layout the given preparsed XML tree as an HTML dom tree More...
 
TextLayout_c layoutXML (const xmlNode *txt, const TextStyleSheet_c &rules, const Shape_c &shape)
 
TextLayout_c layoutXHTMLPugi (const std::string &txt, const TextStyleSheet_c &rules, const Shape_c &shape)
 layout the given XHTML code More...
 
TextLayout_c layoutXHTMLLibXML2 (const std::string &txt, const TextStyleSheet_c &rules, const Shape_c &shape)
 

Detailed Description

The namespace for the library. Every function and class is within this namespace.

Typedef Documentation

typedef uint32_t STLL::glyphIndex_t

type used for all glyph indices. Right now there is no font with more than 2^16 fonts, so 2^32 should be on the safe side. Also HarfBuzz also uses only 2^32 codepoints.

Enumeration Type Documentation

define, which sub-pixel arrangement you want to use for sub-pixel output

Enumerator
SUBP_NONE 

don't use sub-pixel output (e.g. non LCD)

SUBP_RGB 

use horizontal RGB

SUBP_BGR 

use horizontal BGR

SUBP_RGB_V 

use vertical RGB (top to bottom)

SUBP_BGR_V 

use vertical BGR (top to bottom)

Function Documentation

void STLL::addHyphenDictionary ( const std::vector< std::string > &  langs,
std::istream &  str 
)

register a hyphen dictionary for a given set of languages

Parameters
langsa vector of language strings. The language strings are the ones that you use in the lang xml attributes or in the lang member of the AttributeIndex class. If the language to be looked for when looking for a dictionary to do the hyphenation contains an dash stll will also look for a dictionary with the text just before that dash. So if you register a dictionary for the language "en" and use "en-US" in your language tag it will use your hyphenation dictionary
strmust point to an input stream of a hyphen dictionary, the file must be an UTF-8 encoded Open Office hyphen dictionary, nothing else is not supported
void STLL::addHyphenDictionary ( const std::vector< std::string > &  langs,
std::istream &&  str 
)

see the other addHyphenDictionary function

TextLayout_c STLL::layoutParagraph ( const std::u32string &  txt32,
const AttributeIndex_c attr,
const Shape_c shape,
const LayoutProperties_c prop,
int32_t  ystart = 0 
)

paragraph layouting function

Parameters
txt32the utf-32 encoded text to layout, no control sequences exist, use "\n" for newlines
attrthe attributes (colours, ...) for all the characters in the text
shapethe shape that the final result is supposed to have
propsome parameters that the line breaking algorithm needs to give the result the expected shape (centre or justified, ...)
ystartthe vertical starting point (in 1/64th pixels) of your output, the baseline of the first line of text will be shifted down from this position by the ascender of the line
Returns
the resulting layout
Note
: bidi control characters supported, are RLE, RLE, PDF, those don't need to have a valid attribute entry all other characters in txt32 need to have one, or the function will behave wrongly

TODO: instead of crashing, rather throw an exception in that case.

TextLayout_c STLL::layoutXHTMLLibXML2 ( const std::string &  txt,
const TextStyleSheet_c rules,
const Shape_c shape 
)
TextLayout_c STLL::layoutXHTMLPugi ( const std::string &  txt,
const TextStyleSheet_c rules,
const Shape_c shape 
)

layout the given XHTML code

Parameters
libthe library to use, currently supported as Pugi and LibXML2
txtthe html text to parse, is must be utf-8. The text must be a proper XHTML document (see also HTML)
rulesthe stylesheet to use for layouting
shapethe shape to layout into
Attention
it is not checked that txt is proper utf-8. If you have unsafe sources for your text to layout, use the check function from the utf-8 module
TextLayout_c STLL::layoutXML ( pugi::xml_node  txt,
const TextStyleSheet_c rules,
const Shape_c shape 
)

layout the given preparsed XML tree as an HTML dom tree

Parameters
xmlthe xml tree to layout
rulesthe stylesheet to use for layouting
shapethe shape to layout into
TextLayout_c STLL::layoutXML ( const xmlNode *  txt,
const TextStyleSheet_c rules,
const Shape_c shape 
)