class: ewol::compositing::TextBase


Description:



Constructor and Destructor:

+                                                  TextBase               (const std::string & _shaderName,
bool _loadProgram);
+ virtual ~TextBase ();

Synopsis:

#         ewol::compositing::Drawing               m_vectorialDraw;
+ virtual ewol::compositing::Drawing & getDrawing ();
# int32_t m_nbCharDisplayed;
# vec3 m_sizeDisplayStart;
# vec3 m_sizeDisplayStop;
# bool m_needDisplay;
# vec3 m_position;
# vec3 m_clippingPosStart;
# vec3 m_clippingPosStop;
# bool m_clippingEnable;
# etk::Color<> m_defaultColorFg;
# etk::Color<> m_defaultColorBg;
# etk::Color<> m_color;
# etk::Color<> m_colorBg;
# etk::Color<> m_colorCursor;
# etk::Color<> m_colorSelection;
# bool m_kerning;
# char32_t m_previousCharcode;
# float m_startTextpos;
# float m_stopTextPos;
# std::shared_ptr<ewol::resource::Program> m_GLprogram;
# int32_t m_GLPosition;
# int32_t m_GLMatrix;
# int32_t m_GLColor;
# int32_t m_GLtexture;
# int32_t m_GLtexID;
# int32_t m_GLtextWidth;
# int32_t m_GLtextHeight;
# int32_t m_selectionStartPos;
# int32_t m_cursorPos;
# std::vector<vec3> m_coord;
# std::vector<vec2> m_coordTex;
# std::vector<etk::Color<float>> m_coordColor;
+ virtual void loadProgram (const std::string & _shaderName);
+ 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);
+ virtual void drawD (bool _disableDepthTest) = 0;
+ virtual void drawMT (const mat4 & _transformationMatrix,
bool _enableDepthTest) = 0;
+ virtual void clear ();
+ virtual void reset ();
+ const vec3 & getPos ();
+ void setPos (const vec3 & _pos);
+ void setPos (const vec2 & _pos);
+ void setRelPos (const vec3 & _pos);
+ void setRelPos (const vec2 & _pos);
+ void setDefaultColorBg (const etk::Color<> & _color);
+ void setDefaultColorFg (const etk::Color<> & _color);
+ 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);
+ virtual void setFontSize (int32_t _fontSize) = 0;
+ virtual void setFontName (const std::string & _fontName) = 0;
+ virtual void setFont (std::string _fontName,
int32_t _fontSize) = 0;
+ virtual void setFontMode (enum ewol::font::mode _mode) = 0;
+ enum ewol::font::mode getFontMode ();
+ virtual float getHeight () = 0;
+ virtual float getSize () = 0;
+ virtual ewol::GlyphProperty* getGlyphPointer (char32_t _charcode) = 0;
+ void setFontBold (bool _status);
+ void setFontItalic (bool _status);
+ void setKerningMode (bool _newMode);
+ void print (const std::string & _text);
+ void print (const std::u32string & _text);
+ void printDecorated (const std::string & _text);
+ void printDecorated (const std::u32string & _text);
+ void printHTML (const std::string & _text);
+ void printHTML (const std::u32string & _text);
+ void print (const std::string & _text,
const std::vector<TextDecoration> & _decoration);
+ void print (const std::u32string & _text,
const std::vector<TextDecoration> & _decoration);
+ virtual void printChar (const char32_t & _charcode) = 0;
+ void forceLineReturn ();
# void parseHtmlNode (exml::Element* _element);
+ void setTextAlignement (float _startTextpos,
float _stopTextPos,
enum ewol::compositing::aligneMode _alignement);
+ void disableAlignement ();
+ enum ewol::compositing::aligneMode getAlignement ();
+ vec3 calculateSizeHTML (const std::string & _text);
+ vec3 calculateSizeHTML (const std::u32string & _text);
+ vec3 calculateSizeDecorated (const std::string & _text);
+ vec3 calculateSizeDecorated (const std::u32string & _text);
+ vec3 calculateSize (const std::string & _text);
+ vec3 calculateSize (const std::u32string & _text);
+ vec3 calculateSize (const char32_t & _charcode);
# virtual vec3 calculateSizeChar (const char32_t & _charcode) = 0;
+ void printCursor (bool _isInsertMode,
float _cursorSize);
# 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);
# std::u32string m_htmlCurrrentLine;
# std::vector<TextDecoration> m_htmlDecoration;
# TextDecoration m_htmlDecoTmp;
# void htmlAddData (const std::u32string & _data);
# void htmlFlush ();
+ void disableCursor ();
+ 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);

Object Hierarchy:

+ewol::Compositing
+--> ewol::compositing::TextBase
+--> ewol::compositing::TextDF
+--> ewol::compositing::Text

Detail:

m_vectorialDraw

# ewol::compositing::Drawing m_vectorialDraw;
This is used to draw background selection and other things ...


getDrawing

+ virtual ewol::compositing::Drawing & getDrawing ();



m_nbCharDisplayed

# int32_t m_nbCharDisplayed;
prevent some error in calculation size.


m_sizeDisplayStart

# vec3 m_sizeDisplayStart;
The start windows of the display.


m_sizeDisplayStop

# vec3 m_sizeDisplayStop;
The end windows of the display.


m_needDisplay

# bool m_needDisplay;
This just need the display and not the size rendering.


m_position

# vec3 m_position;
The current position to draw


m_clippingPosStart

# vec3 m_clippingPosStart;
Clipping start position


m_clippingPosStop

# vec3 m_clippingPosStop;
Clipping stop position


m_clippingEnable

# bool m_clippingEnable;
true if the clipping must be activated


m_defaultColorFg

# etk::Color<> m_defaultColorFg;
The text foreground color


m_defaultColorBg

# etk::Color<> m_defaultColorBg;
The text background color


m_color

# etk::Color<> m_color;
The text foreground color


m_colorBg

# etk::Color<> m_colorBg;
The text background color


m_colorCursor

# etk::Color<> m_colorCursor;
The text cursor color


m_colorSelection

# etk::Color<> m_colorSelection;
The text Selection color font display property : Regular/Bold/Italic/BoldItalic


m_kerning

# bool m_kerning;
Kerning enable or disable on the next elements displayed


m_previousCharcode

# char32_t m_previousCharcode;


m_startTextpos

# float m_startTextpos;
start position of the Alignement (when \n the text return at this position)


m_stopTextPos

# float m_stopTextPos;
end of the alignement (when a string is too hight it cut at the word previously this virtual line and the center is perform with this one) Current Alignement mode (justify/left/right ...)


m_GLprogram

# std::shared_ptr<ewol::resource::Program> m_GLprogram;
pointer on the opengl display program


m_GLPosition

# int32_t m_GLPosition;
openGL id on the element (vertex buffer)


m_GLMatrix

# int32_t m_GLMatrix;
openGL id on the element (transformation matrix)


m_GLColor

# int32_t m_GLColor;
openGL id on the element (color buffer)


m_GLtexture

# int32_t m_GLtexture;
openGL id on the element (Texture position)


m_GLtexID

# int32_t m_GLtexID;
openGL id on the element (texture ID)


m_GLtextWidth

# int32_t m_GLtextWidth;
openGL Id on the texture width


m_GLtextHeight

# int32_t m_GLtextHeight;
openGL Id on the texture height


m_selectionStartPos

# int32_t m_selectionStartPos;
start position of the Selection (if == m_cursorPos ==> no selection)


m_cursorPos

# int32_t m_cursorPos;
Cursor position (default no cursor == > -100)


m_coord

# std::vector<vec3> m_coord;
internal coord of the object


m_coordTex

# std::vector<vec2> m_coordTex;
internal texture coordinate for every point


m_coordColor

# std::vector<etk::Color<float>> m_coordColor;
internal color of the different point


loadProgram

+ virtual void loadProgram (const std::string & _shaderName);
load the openGL program and get all the ID needed


TextBase

+  TextBase (const std::string & _shaderName,
bool _loadProgram);
generic constructor


~TextBase

+ virtual  ~TextBase ();
generic destructor


translate

+ void translate (const vec3 & _vect);
translate the current display of this element


rotate

+ void rotate (const vec3 & _vect,
float _angle);
rotate the curent display of this element


scale

+ void scale (const vec3 & _vect);
scale the current diaplsy of this element


draw

+ void draw (bool _disableDepthTest);
+ void draw (const mat4 & _transformationMatrix,
bool _enableDepthTest);
draw All the refistered text in the current element on openGL


drawD

+ virtual void drawD (bool _disableDepthTest) = 0;
+ virtual void drawMT (const mat4 & _transformationMatrix,
bool _enableDepthTest) = 0;
draw All the refistered text in the current element on openGL


clear

+ virtual void clear ();
clear all the registered element in the current element


reset

+ virtual void reset ();
clear all the intermediate result detween 2 prints


getPos

+ const vec3 & getPos ();
get the current display position (sometime needed in the gui control)


setPos

+ void setPos (const vec3 & _pos);
+ void setPos (const vec2 & _pos);
set position for the next text writen


setRelPos

+ void setRelPos (const vec3 & _pos);
+ void setRelPos (const vec2 & _pos);
set relative position for the next text writen


setDefaultColorBg

+ void setDefaultColorBg (const etk::Color<> & _color);
set the default background color of the font (when reset, set this value ...)


setDefaultColorFg

+ void setDefaultColorFg (const etk::Color<> & _color);
set the default Foreground color of the font (when reset, set this value ...)


setColor

+ void setColor (const etk::Color<> & _color);
set the Color of the current foreground font


setColorBg

+ void setColorBg (const etk::Color<> & _color);
set the background color of the font (for selected Text (not the global BG))


setClippingWidth

+ void setClippingWidth (const vec3 & _pos,
const vec3 & _width);
+ void setClippingWidth (const vec2 & _pos,
const vec2 & _width);
Request a clipping area for the text (next draw only)


setClipping

+ void setClipping (const vec3 & _pos,
const vec3 & _posEnd);
+ void setClipping (const vec2 & _pos,
const vec2 & _posEnd);
Request a clipping area for the text (next draw only)


setClippingMode

+ void setClippingMode (bool _newMode);
enable/Disable the clipping (without lose the current clipping position)
_newMode The new status of the clipping


setFontSize

+ virtual void setFontSize (int32_t _fontSize) = 0;
Specify the font size (this reset the internal element of the current text (system requirement)


setFontName

+ virtual void setFontName (const std::string & _fontName) = 0;
Specify the font name (this reset the internal element of the current text (system requirement)


setFont

+ virtual void setFont (std::string _fontName,
int32_t _fontSize) = 0;
Specify the font property (this reset the internal element of the current text (system requirement)


setFontMode

+ virtual void setFontMode (enum ewol::font::mode _mode) = 0;
Specify the font mode for the next @ref print


getFontMode

+ enum ewol::font::mode getFontMode ();
get the current font mode


getHeight

+ virtual float getHeight () = 0;



getSize

+ virtual float getSize () = 0;



getGlyphPointer

+ virtual ewol::GlyphProperty* getGlyphPointer (char32_t _charcode) = 0;



setFontBold

+ void setFontBold (bool _status);
enable or disable the bold mode


setFontItalic

+ void setFontItalic (bool _status);
enable or disable the italic mode


setKerningMode

+ void setKerningMode (bool _newMode);
set the activation of the Kerning for the display (if it existed)


print

+ void print (const std::string & _text);
+ void print (const std::u32string & _text);
display a compleat string in the current element.


printDecorated

+ void printDecorated (const std::string & _text);
+ void printDecorated (const std::u32string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
<br/>
<br/><br/><br/>
<center>
	text exemple <b>in bold</b> other text <b>bold part <i>boldItalic part</i></b> an other thext
	<font color="#FF0000">colored text <b>bold color text</b> <i>bold italic text</i> normal color text</font> the end of the string<br/>
	an an other thext
</center>
<br/><br/><br/>
<left>
	plop 1
</left>
<br/><br/><br/>
<right>
	plop 2
</right>
<br/><br/><br/>
<justify>
	Un exemple de text
</justify>

Note: 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


printHTML

+ void printHTML (const std::string & _text);
+ void printHTML (const std::u32string & _text);
display a compleat string in the current element with the generic decoration specification. (basic html data)
<html>
	<body>
		<br/>
		<br/><br/><br/>
		<center>
			text exemple <b>in bold</b> other text <b>bold part <i>boldItalic part</i></b> an other thext
			<font color="#FF0000">colored text <b>bold color text</b> <i>bold italic text</i> normal color text</font> the end of the string<br/>
			an an other thext
		</center>
		<br/><br/><br/>
		<left>
			plop 1
		</left>
		<br/><br/><br/>
		<right>
			plop 2
		</right>
		<br/><br/><br/>
		<justify>
			Un exemple de text
		</justify>
	</body>
</html>

Note: 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


print

+ void print (const std::string & _text,
const std::vector<TextDecoration> & _decoration);
+ void print (const std::u32string & _text,
const std::vector<TextDecoration> & _decoration);
display a compleat string in the current element whith specific decorations (advence mode).


printChar

+ virtual void printChar (const char32_t & _charcode) = 0;
display the current char in the current element (note that the kerning is availlable if the position is not changed)


forceLineReturn

+ void forceLineReturn ();
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


parseHtmlNode

# void parseHtmlNode (exml::Element* _element);
This parse a tinyXML node (void pointer to permit to hide tiny XML in include).


setTextAlignement

+ void setTextAlignement (float _startTextpos,
float _stopTextPos,
enum
ewol::compositing::aligneMode _alignement);
This generate the possibility to generate the big text property
Note: The text align in center change of line every display done (even if it was just a char)


disableAlignement

+ void disableAlignement ();
disable the alignement system


getAlignement

+ enum ewol::compositing::aligneMode getAlignement ();
get the current alignement property


calculateSizeHTML

+ vec3 calculateSizeHTML (const std::string & _text);
+ vec3 calculateSizeHTML (const std::u32string & _text);
calculate a theoric text size


calculateSizeDecorated

+ vec3 calculateSizeDecorated (const std::string & _text);
+ vec3 calculateSizeDecorated (const std::u32string & _text);
calculate a theoric text size


calculateSize

+ vec3 calculateSize (const std::string & _text);
+ vec3 calculateSize (const std::u32string & _text);
calculate a theoric text size


calculateSize

+ vec3 calculateSize (const char32_t & _charcode);
# virtual vec3 calculateSizeChar (const char32_t & _charcode) = 0;
calculate a theoric charcode size


printCursor

+ void printCursor (bool _isInsertMode,
float _cursorSize);
draw a cursor at the specify position


extrapolateLastId

# 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);
calculate the element number that is the first out the alignement range (start at the specify ID, and use start pos with current one)


m_htmlCurrrentLine

# std::u32string m_htmlCurrrentLine;
current line for HTML display


m_htmlDecoration

# std::vector<TextDecoration> m_htmlDecoration;
current decoration for the HTML display


m_htmlDecoTmp

# TextDecoration m_htmlDecoTmp;
current decoration


htmlAddData

# void htmlAddData (const std::u32string & _data);
add a line with the current m_htmlDecoTmp decoration


htmlFlush

# void htmlFlush ();
draw the current line


disableCursor

+ void disableCursor ();
remove the cursor display


setCursorPos

+ void setCursorPos (int32_t _cursorPos);
set a cursor at a specific position:


setCursorSelection

+ void setCursorSelection (int32_t _cursorPos,
int32_t _selectionStartPos);
set a cursor at a specific position with his associated selection:


setSelectionColor

+ void setSelectionColor (const etk::Color<> & _color);
change the selection color


setCursorColor

+ void setCursorColor (const etk::Color<> & _color);
change the cursor color