Class: ewol::Text
Synopsis:
+ ewol::Drawing & getDrawing (void);
+ Text (const std::string & _fontName,
int32_t _fontSize);
+ ~Text (void);
+ void translate (const vec3 & _vect);
+ void rotate (const vec3 & _vect,
float _angle);
+ void scale (const vec3 & _vect);
+ void draw (bool _disableDepthTest);
+ void draw (const mat4 & _transformationMatrix,
bool _enableDepthTest);
+ void clear (void);
+ void reset (void);
+ const vec3 & getPos (void);
+ void setPos (const vec3 & _pos);
+ void setPos (const vec2 & _pos);
+ void setRelPos (const vec3 & _pos);
+ void setRelPos (const vec2 & _pos);
+ void setColor (const etk::Color<> & _color);
+ void setColorBg (const etk::Color<> & _color);
+ void setClippingWidth (const vec3 & _pos,
const vec3 & _width);
+ void setClippingWidth (const vec2 & _pos,
const vec2 & _width);
+ void setClipping (const vec3 & _pos,
const vec3 & _posEnd);
+ void setClipping (const vec2 & _pos,
const vec2 & _posEnd);
+ void setClippingMode (bool _newMode);
+ void setFontSize (int32_t _fontSize);
+ void setFontName (const std::string & _fontName);
+ void setFont (std::string _fontName,
int32_t _fontSize);
+ void setFontMode (enum ewol::font::mode _mode);
+ void setFontBold (bool _status);
+ void setFontItalic (bool _status);
+ void setKerningMode (bool _newMode);
+ void setDistanceFieldMode (bool _newMode);
+ void print (const std::string & _text);
+ void print (const std::u32string & _text);
+ void printDecorated (const std::string & _text);
+ void printHTML (const std::string & _text);
+ void print (const std::string & _text,
const std::vector& _decoration);
+ void print (const std::u32string & _text,
const std::vector& _decoration);
+ void print (const char32_t & _charcode);
+ void forceLineReturn (void);
+ void setTextAlignement (float _startTextpos,
float _stopTextPos,
enum ewol::Text::aligneMode _alignement);
+ void disableAlignement (void);
+ vec3 calculateSizeHTML (const std::string & _text);
+ vec3 calculateSizeDecorated (const std::string & _text);
+ vec3 calculateSize (const std::string & _text);
+ vec3 calculateSize (const char32_t & _charcode);
+ void printCursor (bool _isInsertMode,
float _cursorSize);
+ void disableCursor (void);
+ void setCursorPos (int32_t _cursorPos);
+ void setCursorSelection (int32_t _cursorPos,
int32_t _selectionStartPos);
+ void setSelectionColor (const etk::Color<> & _color);
+ void setCursorColor (const etk::Color<> & _color);
- void loadProgram (void);
- void parseHtmlNode (exml::Element * _element);
- bool extrapolateLastId (const std::string & _text,
const int32_t _start,
int32_t & _stop,
int32_t & _space,
int32_t & _freeSpace);
- bool extrapolateLastId (const std::u32string & _text,
const int32_t _start,
int32_t & _stop,
int32_t & _space,
int32_t & _freeSpace);
- void htmlAddData (const std::string & _data);
- void htmlFlush (void);
Object Hierarchy:
ewol::Compositing +--> ewol::Text
Detail:
getDrawing ()
ewol::Drawing & getDrawing(void);
ewol::Text ()
Text(const std::string & _fontName,
int32_t _fontSize);
generic constructor
Parameter [input]: _fontName Name of the font that might be loaded
Parameter [input]: _fontSize size of the font that might be loaded
ewol::~Text ()
~Text(void);
generic destructor
translate ()
void translate(const vec3 & _vect);
rotate ()
void rotate(const vec3 & _vect,
float _angle);
scale ()
void scale(const vec3 & _vect);
draw ()
void draw(bool _disableDepthTest);
draw All the refistered text in the current element on openGL
draw ()
void draw(const mat4 & _transformationMatrix,
bool _enableDepthTest);
clear ()
void clear(void);
clear all the registered element in the current element
reset ()
void reset(void);
clear all the intermediate result detween 2 prints
getPos ()
const vec3 & getPos(void);
get the current display position (sometime needed in the gui control)
Return: the current position.
setPos ()
void setPos(const vec3 & _pos);
set position for the next text writen
Parameter [input]: _pos Position of the text (in 3D)
setPos ()
void setPos(const vec2 & _pos);
setRelPos ()
void setRelPos(const vec3 & _pos);
set relative position for the next text writen
Parameter [input]: _pos ofset apply of the text (in 3D)
setRelPos ()
void setRelPos(const vec2 & _pos);
setColor ()
void setColor(const etk::Color<> & _color);
set the Color of the current foreground font
Parameter [input]: _color Color to set on foreground (for next print)
setColorBg ()
void setColorBg(const etk::Color<> & _color);
set the background color of the font (for selected Text (not the global BG))
Parameter [input]: _color Color to set on background (for next print)
setClippingWidth ()
void setClippingWidth(const vec3 & _pos,
const vec3 & _width);
Request a clipping area for the text (next draw only)
Parameter [input]: _pos Start position of the clipping
Parameter [input]: _width Width size of the clipping
setClippingWidth ()
void setClippingWidth(const vec2 & _pos,
const vec2 & _width);
setClipping ()
void setClipping(const vec3 & _pos,
const vec3 & _posEnd);
Request a clipping area for the text (next draw only)
Parameter [input]: _pos Start position of the clipping
Parameter [input]: _posEnd End position of the clipping
setClipping ()
void setClipping(const vec2 & _pos,
const vec2 & _posEnd);
setClippingMode ()
void setClippingMode(bool _newMode);
enable/Disable the clipping (without lose the current clipping position)
_newMode The new status of the clipping
setFontSize ()
void setFontSize(int32_t _fontSize);
Specify the font size (this reset the internal element of the current text (system requirement)
Parameter [input]: _fontSize New font size
setFontName ()
void setFontName(const std::string & _fontName);
Specify the font name (this reset the internal element of the current text (system requirement)
Parameter [input]: _fontName Current name of the selected font
setFont ()
void setFont(std::string _fontName,
int32_t _fontSize);
Specify the font property (this reset the internal element of the current text (system requirement)
Parameter [input]: fontName Current name of the selected font
Parameter [input]: fontSize New font size
setFontMode ()
void setFontMode(enum ewol::font::mode _mode);
Specify the font mode for the next
Parameter [input]: mode The font mode requested
setFontBold ()
void setFontBold(bool _status);
enable or disable the bold mode
Parameter [input]: _status The new status for this display property
setFontItalic ()
void setFontItalic(bool _status);
enable or disable the italic mode
Parameter [input]: _status The new status for this display property
setKerningMode ()
void setKerningMode(bool _newMode);
set the activation of the Kerning for the display (if it existed)
Parameter [input]: _newMode enable/Diasable the kerning on this font.
setDistanceFieldMode ()
void setDistanceFieldMode(bool _newMode);
Request the distance field mode for this text display
Parameter [input]: _newMode enable/Diasable the Distance Field on this font.
print ()
void print(const std::string & _text);
display a compleat string in the current element.
Parameter [input]: _text The string to display.
print ()
void print(const std::u32string & _text);
printDecorated ()
void printDecorated(const std::string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
text exemple in bold other text bold part boldItalic part an other thext
colored text bold color text bold italic text normal color text the end of the string
an an other thext
plop 1
plop 2
Un exemple de text
Notes: This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
Parameter [input]: _text The string to display.
printHTML ()
void printHTML(const std::string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
text exemple in bold other text bold part boldItalic part an other thext
colored text bold color text bold italic text normal color text the end of the string
an an other thext
plop 1
plop 2
Un exemple de text
Notes: This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
Parameter [input]: _text The string to display.
print ()
void print(const std::string & _text,
const std::vector & _decoration);
display a compleat string in the current element whith specific decorations (advence mode).
Parameter [input]: _text The string to display.
Parameter [input]: _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
print ()
void print(const std::u32string & _text,
const std::vector & _decoration);
print ()
void print(const char32_t & _charcode);
display the current char in the current element (note that the kerning is availlable if the position is not changed)
Parameter [input]: _charcode Char that might be dispalyed
forceLineReturn ()
void forceLineReturn(void);
This generate the line return == > it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
setTextAlignement ()
void setTextAlignement(float _startTextpos,
float _stopTextPos,
enum ewol::Text::aligneMode _alignement);
This generate the possibility to generate the big text property
Notes: The text align in center change of line every display done (even if it was just a char)
Parameter [input]: _startTextpos The x text start position of the display.
Parameter [input]: _stopTextPos The x text stop position of the display.
Parameter [input]: _alignement mode of alignement for the Text.
disableAlignement ()
void disableAlignement(void);
disable the alignement system
calculateSizeHTML ()
vec3 calculateSizeHTML(const std::string & _text);
calculate a theoric text size
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSizeDecorated ()
vec3 calculateSizeDecorated(const std::string & _text);
calculate a theoric text size
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSize ()
vec3 calculateSize(const std::string & _text);
calculate a theoric text size
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSize ()
vec3 calculateSize(const char32_t & _charcode);
calculate a theoric charcode size
Parameter [input]: _charcode The ľUnicode value to calculate dimention.
Return: The theoric size used.
printCursor ()
void printCursor(bool _isInsertMode,
float _cursorSize);
draw a cursor at the specify position
Parameter [input]: _isInsertMode True if the insert mode is activated
Parameter [input]: _cursorSize The sizae of the cursor that might be set when insert mode is set [default 20]
disableCursor ()
void disableCursor(void);
remove the cursor display
setCursorPos ()
void setCursorPos(int32_t _cursorPos);
set a cursor at a specific position:
Parameter [input]: _cursorPos id of the cursor position
setCursorSelection ()
void setCursorSelection(int32_t _cursorPos,
int32_t _selectionStartPos);
set a cursor at a specific position with his associated selection:
Parameter [input]: _cursorPos id of the cursor position
Parameter [input]: _selectionStartPos id of the starting of the selection
setSelectionColor ()
void setSelectionColor(const etk::Color<> & _color);
change the selection color
Parameter [input]: _color New color for the Selection
setCursorColor ()
void setCursorColor(const etk::Color<> & _color);
change the cursor color
Parameter [input]: _color New color for the Selection
loadProgram ()
void loadProgram(void);
load the openGL program and get all the ID needed
parseHtmlNode ()
void parseHtmlNode(exml::Element * _element);
This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
Parameter [input]: _element the exml element.
extrapolateLastId ()
bool extrapolateLastId(const std::string & _text,
const int32_t _start,
int32_t & _stop,
int32_t & _space,
int32_t & _freeSpace);
calculate the element number that is the first out the alignement range
(start at the specify ID, and use start pos with current one)
Parameter [input]: _text The string that might be parsed.
Parameter [input]: _start The first elemnt that might be used to calculate.
Parameter [output]: _stop The last Id availlable in the current string.
Parameter [output]: _space Number of space in the string.
Return: true if the rifht has free space that can be use for jystify (return false if we find \n
extrapolateLastId ()
bool extrapolateLastId(const std::u32string & _text,
const int32_t _start,
int32_t & _stop,
int32_t & _space,
int32_t & _freeSpace);
htmlAddData ()
void htmlAddData(const std::string & _data);
add a line with the current m_htmlDecoTmp decoration
Parameter [input]: _data The cuurent data to add.
htmlFlush ()
void htmlFlush(void);
draw the current line
getDrawing ()
ewol::Drawing & getDrawing(void);
ewol::Text ()
Text(const std::string & _fontName, int32_t _fontSize);
generic constructor
-
Parameter [input]: _fontName Name of the font that might be loaded
Parameter [input]: _fontSize size of the font that might be loaded
ewol::~Text ()
~Text(void);
generic destructor
translate ()
void translate(const vec3 & _vect);
rotate ()
void rotate(const vec3 & _vect, float _angle);
scale ()
void scale(const vec3 & _vect);
draw ()
void draw(bool _disableDepthTest);
draw All the refistered text in the current element on openGL
draw ()
void draw(const mat4 & _transformationMatrix, bool _enableDepthTest);
clear ()
void clear(void);
clear all the registered element in the current element
reset ()
void reset(void);
clear all the intermediate result detween 2 prints
getPos ()
const vec3 & getPos(void);
get the current display position (sometime needed in the gui control)
-
Return: the current position.
setPos ()
void setPos(const vec3 & _pos);
set position for the next text writen
-
Parameter [input]: _pos Position of the text (in 3D)
setPos ()
void setPos(const vec2 & _pos);
setRelPos ()
void setRelPos(const vec3 & _pos);
set relative position for the next text writen
-
Parameter [input]: _pos ofset apply of the text (in 3D)
setRelPos ()
void setRelPos(const vec2 & _pos);
setColor ()
void setColor(const etk::Color<> & _color);
set the Color of the current foreground font
-
Parameter [input]: _color Color to set on foreground (for next print)
setColorBg ()
void setColorBg(const etk::Color<> & _color);
set the background color of the font (for selected Text (not the global BG))
-
Parameter [input]: _color Color to set on background (for next print)
setClippingWidth ()
void setClippingWidth(const vec3 & _pos, const vec3 & _width);
Request a clipping area for the text (next draw only)
-
Parameter [input]: _pos Start position of the clipping
Parameter [input]: _width Width size of the clipping
setClippingWidth ()
void setClippingWidth(const vec2 & _pos, const vec2 & _width);
setClipping ()
void setClipping(const vec3 & _pos, const vec3 & _posEnd);
Request a clipping area for the text (next draw only)
-
Parameter [input]: _pos Start position of the clipping
Parameter [input]: _posEnd End position of the clipping
setClipping ()
void setClipping(const vec2 & _pos, const vec2 & _posEnd);
setClippingMode ()
void setClippingMode(bool _newMode);
enable/Disable the clipping (without lose the current clipping position)
_newMode The new status of the clipping
setFontSize ()
void setFontSize(int32_t _fontSize);
Specify the font size (this reset the internal element of the current text (system requirement)
-
Parameter [input]: _fontSize New font size
setFontName ()
void setFontName(const std::string & _fontName);
Specify the font name (this reset the internal element of the current text (system requirement)
-
Parameter [input]: _fontName Current name of the selected font
setFont ()
void setFont(std::string _fontName, int32_t _fontSize);
Specify the font property (this reset the internal element of the current text (system requirement)
-
Parameter [input]: fontName Current name of the selected font
Parameter [input]: fontSize New font size
setFontMode ()
void setFontMode(enum ewol::font::mode _mode);
Specify the font mode for the next
-
Parameter [input]: mode The font mode requested
setFontBold ()
void setFontBold(bool _status);
enable or disable the bold mode
-
Parameter [input]: _status The new status for this display property
setFontItalic ()
void setFontItalic(bool _status);
enable or disable the italic mode
-
Parameter [input]: _status The new status for this display property
setKerningMode ()
void setKerningMode(bool _newMode);
set the activation of the Kerning for the display (if it existed)
-
Parameter [input]: _newMode enable/Diasable the kerning on this font.
setDistanceFieldMode ()
void setDistanceFieldMode(bool _newMode);
Request the distance field mode for this text display
-
Parameter [input]: _newMode enable/Diasable the Distance Field on this font.
print ()
void print(const std::string & _text);
display a compleat string in the current element.
-
Parameter [input]: _text The string to display.
print ()
void print(const std::u32string & _text);
printDecorated ()
void printDecorated(const std::string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
text exemple in bold other text bold part boldItalic part an other thext colored text bold color text bold italic text normal color text the end of the string
an an other thext
plop 1
plop 2
Un exemple de text
Notes: This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
-
Parameter [input]: _text The string to display.
printHTML ()
void printHTML(const std::string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
text exemple in bold other text bold part boldItalic part an other thext colored text bold color text bold italic text normal color text the end of the string
an an other thext
plop 1
plop 2
Un exemple de text
Notes: This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
-
Parameter [input]: _text The string to display.
print ()
void print(const std::string & _text, const std::vector& _decoration);
display a compleat string in the current element whith specific decorations (advence mode).
-
Parameter [input]: _text The string to display.
Parameter [input]: _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
print ()
void print(const std::u32string & _text, const std::vector& _decoration);
print ()
void print(const char32_t & _charcode);
display the current char in the current element (note that the kerning is availlable if the position is not changed)
-
Parameter [input]: _charcode Char that might be dispalyed
forceLineReturn ()
void forceLineReturn(void);
This generate the line return == > it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
setTextAlignement ()
void setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement);
This generate the possibility to generate the big text property
Notes: The text align in center change of line every display done (even if it was just a char)
-
Parameter [input]: _startTextpos The x text start position of the display.
Parameter [input]: _stopTextPos The x text stop position of the display.
Parameter [input]: _alignement mode of alignement for the Text.
disableAlignement ()
void disableAlignement(void);
disable the alignement system
calculateSizeHTML ()
vec3 calculateSizeHTML(const std::string & _text);
calculate a theoric text size
-
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSizeDecorated ()
vec3 calculateSizeDecorated(const std::string & _text);
calculate a theoric text size
-
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSize ()
vec3 calculateSize(const std::string & _text);
calculate a theoric text size
-
Parameter [input]: _text The string to calculate dimention.
Return: The theoric size used.
calculateSize ()
vec3 calculateSize(const char32_t & _charcode);
calculate a theoric charcode size
-
Parameter [input]: _charcode The ľUnicode value to calculate dimention.
Return: The theoric size used.
printCursor ()
void printCursor(bool _isInsertMode, float _cursorSize);
draw a cursor at the specify position
-
Parameter [input]: _isInsertMode True if the insert mode is activated
Parameter [input]: _cursorSize The sizae of the cursor that might be set when insert mode is set [default 20]
disableCursor ()
void disableCursor(void);
remove the cursor display
setCursorPos ()
void setCursorPos(int32_t _cursorPos);
set a cursor at a specific position:
-
Parameter [input]: _cursorPos id of the cursor position
setCursorSelection ()
void setCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos);
set a cursor at a specific position with his associated selection:
-
Parameter [input]: _cursorPos id of the cursor position
Parameter [input]: _selectionStartPos id of the starting of the selection
setSelectionColor ()
void setSelectionColor(const etk::Color<> & _color);
change the selection color
-
Parameter [input]: _color New color for the Selection
setCursorColor ()
void setCursorColor(const etk::Color<> & _color);
change the cursor color
-
Parameter [input]: _color New color for the Selection
loadProgram ()
void loadProgram(void);
load the openGL program and get all the ID needed
parseHtmlNode ()
void parseHtmlNode(exml::Element * _element);
This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
-
Parameter [input]: _element the exml element.
extrapolateLastId ()
bool extrapolateLastId(const std::string & _text, const int32_t _start, int32_t & _stop, int32_t & _space, int32_t & _freeSpace);
calculate the element number that is the first out the alignement range (start at the specify ID, and use start pos with current one)
-
Parameter [input]: _text The string that might be parsed.
Parameter [input]: _start The first elemnt that might be used to calculate.
Parameter [output]: _stop The last Id availlable in the current string.
Parameter [output]: _space Number of space in the string.
Return: true if the rifht has free space that can be use for jystify (return false if we find \n
extrapolateLastId ()
bool extrapolateLastId(const std::u32string & _text, const int32_t _start, int32_t & _stop, int32_t & _space, int32_t & _freeSpace);
htmlAddData ()
void htmlAddData(const std::string & _data);
add a line with the current m_htmlDecoTmp decoration
-
Parameter [input]: _data The cuurent data to add.
htmlFlush ()
void htmlFlush(void);
draw the current line