this class encapsulates information for how to format a text, just like the style sheets in html are doing.
More...
this class encapsulates information for how to format a text, just like the style sheets in html are doing.
This class contains a list of normal CSS rules as well as a list of font families to use for outputting text.
STLL::TextStyleSheet_c::TextStyleSheet_c |
( |
std::shared_ptr< FontCache_c > |
c = 0 | ) |
|
create an empty style sheet only with default rules
If you do not specify a default cache, the style sheet will create its own cache with its own library instance
This cache will be used for all fonts of the style sheet.
void STLL::TextStyleSheet_c::addFont |
( |
const std::string & |
family, |
|
|
const FontResource_c & |
res, |
|
|
const std::string & |
style = "normal" , |
|
|
const std::string & |
variant = "normal" , |
|
|
const std::string & |
weight = "normal" , |
|
|
const std::string & |
stretch = "normal" |
|
) |
| |
Add a font to a family.
This function will add a new font to a family within this stylesheet. If the given family doesn't exist, it will be created
The class will use the same font cache and thus the same instance of the FreeType library for all the fonts. So you can only use it from one thread.
- Parameters
-
family | The name of the font family that gets a new member |
res | The resource for the new family member |
style | See fontFamily_c::getFont() |
variant | See fontFamily_c::getFont() |
weight | See fontFamily_c::getFont() |
stretch | See fontFamily_c::getFont() |
void STLL::TextStyleSheet_c::addRule |
( |
const std::string |
sel, |
|
|
const std::string |
attr, |
|
|
const std::string |
val |
|
) |
| |
add a rule to the stylesheet
The rule will be checked as much as possible against syntactic and semantic Problems, when a problem is detected (e.g. invalid values) the XhtmlException_c is thrown.
- Parameters
-
sel | The CSS selector (see CSS for supported selectors) |
attr | The attribute this rule applies to (see CSS for supported attributes) |
val | The value for the attribute |
std::shared_ptr<FontFamily_c> STLL::TextStyleSheet_c::findFamily |
( |
const std::string & |
family | ) |
const |
|
inline |
Get a font family from the CSS.
- Parameters
-
family | The family you want to get |
- Returns
- The family of nullptr
bool STLL::TextStyleSheet_c::getHyphenate |
( |
void |
| ) |
const |
|
inline |
get status of hyphenation setting
bool STLL::TextStyleSheet_c::getUseOptimizingLayouter |
( |
void |
| ) |
const |
|
inline |
get status of optimizing layouter
template<class X >
const std::string& STLL::TextStyleSheet_c::getValue |
( |
X |
node, |
|
|
const std::string & |
attribute, |
|
|
const std::string & |
def = "" |
|
) |
| const |
|
inline |
get the value for an attribute for a given xml-node
- Parameters
-
node | The xml node that the attribute value is requested for |
attribute | The attribute the value is requested for |
def | default value that will be returned, when there is no value set |
- Returns
- The value of the attribute
- Note
- the default value is only used when it is not empty. When empty the CSS default will be used and if there is not CSS default an exception will be thrown
- Attention
- the function will return a reference to the string, when the default from the argument is returned, this will also be a reference to that argument, so the string containing the default must actually stay alive until the return value is handled
void STLL::TextStyleSheet_c::setHyphenate |
( |
bool |
on | ) |
|
|
inline |
void STLL::TextStyleSheet_c::setUseOptimizingLayouter |
( |
bool |
on | ) |
|
|
inline |
The documentation for this class was generated from the following file: