Display none Mono-space Text
This commit is contained in:
parent
6f6b0a6f7f
commit
f3bf0b557c
@ -306,6 +306,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
|
|
||||||
int32_t fontId = ewol::GetDefaultFontId();
|
int32_t fontId = ewol::GetDefaultFontId();
|
||||||
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
||||||
|
int32_t spaceWidth = ewol::GetWidth(fontId, " ");
|
||||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||||
|
|
||||||
// update the number of element that can be displayed
|
// update the number of element that can be displayed
|
||||||
@ -365,9 +366,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
EDN_DEBUG("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos);
|
EDN_DEBUG("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos);
|
||||||
|
|
||||||
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
|
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
|
||||||
|
int32_t pixelX = x_base;
|
||||||
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
||||||
//EDN_DEBUG("diplay element=" << iii);
|
//EDN_DEBUG("diplay element=" << iii);
|
||||||
int32_t pixelX = xx*letterWidth + x_base;
|
|
||||||
int displaywidth;
|
int displaywidth;
|
||||||
uint32_t currentChar = '\0';
|
uint32_t currentChar = '\0';
|
||||||
new_i = iii;
|
new_i = iii;
|
||||||
@ -416,7 +417,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
} else {
|
} else {
|
||||||
OOColored->SetColor(myColorSpace);
|
OOColored->SetColor(myColorSpace);
|
||||||
}
|
}
|
||||||
OOColored->Rectangle( pixelX, y, letterWidth, letterHeight);
|
OOColored->Rectangle( pixelX, y, spaceWidth, letterHeight);
|
||||||
|
pixelX += spaceWidth;
|
||||||
} else if( '\t' == currentChar
|
} else if( '\t' == currentChar
|
||||||
&& true == globals::IsSetDisplaySpaceChar() )
|
&& true == globals::IsSetDisplaySpaceChar() )
|
||||||
{
|
{
|
||||||
@ -430,7 +432,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
} else {
|
} else {
|
||||||
OOColored->SetColor(myColorTab);
|
OOColored->SetColor(myColorTab);
|
||||||
}
|
}
|
||||||
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
|
OOColored->Rectangle( pixelX, y, spaceWidth*strlen(tmpDisplayOfset), letterHeight);
|
||||||
|
pixelX += spaceWidth*strlen(tmpDisplayOfset);
|
||||||
} else {
|
} else {
|
||||||
if( true == selHave
|
if( true == selHave
|
||||||
&& selStart <= iii
|
&& selStart <= iii
|
||||||
@ -441,15 +444,17 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
OOColored->SetColor(selectColor->GetBG());
|
OOColored->SetColor(selectColor->GetBG());
|
||||||
OOText->SetColor(selectColor->GetFG());
|
OOText->SetColor(selectColor->GetFG());
|
||||||
if (currentChar <= 0x7F) {
|
if (currentChar <= 0x7F) {
|
||||||
OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
|
int32_t drawSize = OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
|
||||||
if (true == selectColor->HaveBg() ) {
|
if (true == selectColor->HaveBg() ) {
|
||||||
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
|
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
|
||||||
}
|
}
|
||||||
|
pixelX += drawSize;
|
||||||
} else {
|
} else {
|
||||||
OOText->TextAdd(pixelX, y, displayChar, -1);
|
int32_t drawSize = OOText->TextAdd(pixelX, y, displayChar, -1);
|
||||||
if (true == selectColor->HaveBg() ) {
|
if (true == selectColor->HaveBg() ) {
|
||||||
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
|
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
|
||||||
}
|
}
|
||||||
|
pixelX += drawSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xx+=widthToDisplay;
|
xx+=widthToDisplay;
|
||||||
@ -474,6 +479,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
//drawer.Flush();
|
//drawer.Flush();
|
||||||
xx = 0;
|
xx = 0;
|
||||||
idX =0;
|
idX =0;
|
||||||
|
pixelX = x_base;
|
||||||
y += letterHeight;
|
y += letterHeight;
|
||||||
displayLines++;
|
displayLines++;
|
||||||
currentLineID++;
|
currentLineID++;
|
||||||
@ -482,6 +488,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
}
|
}
|
||||||
// special case : the cursor is at the end of the buffer...
|
// special case : the cursor is at the end of the buffer...
|
||||||
if (m_cursorPos == iii) {
|
if (m_cursorPos == iii) {
|
||||||
|
CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
|
||||||
// display the cursor:
|
// display the cursor:
|
||||||
if (true == m_cursorOn) {
|
if (true == m_cursorOn) {
|
||||||
//Cursor(OOColored, xx*letterWidth + x_base, yy+letterHeight, letterHeight, letterWidth);
|
//Cursor(OOColored, xx*letterWidth + x_base, yy+letterHeight, letterHeight, letterWidth);
|
||||||
|
@ -25,15 +25,7 @@
|
|||||||
|
|
||||||
#ifndef __COLORIZE_H__
|
#ifndef __COLORIZE_H__
|
||||||
#define __COLORIZE_H__
|
#define __COLORIZE_H__
|
||||||
/*
|
|
||||||
extern "C" {
|
|
||||||
typedef struct {
|
|
||||||
float red;
|
|
||||||
float green;
|
|
||||||
float blue;
|
|
||||||
} color_ts;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Colorize {
|
class Colorize {
|
||||||
public:
|
public:
|
||||||
@ -47,8 +39,6 @@ class Colorize {
|
|||||||
etk::String GetName(void);
|
etk::String GetName(void);
|
||||||
void SetFgColor(const char *myColor);
|
void SetFgColor(const char *myColor);
|
||||||
void SetBgColor(const char *myColor);
|
void SetBgColor(const char *myColor);
|
||||||
//void ApplyFG(cairo_t * cr) { cairo_set_source_rgba(cr, m_colorFG.red, m_colorFG.green, m_colorFG.blue, 1); };
|
|
||||||
//void ApplyBG(cairo_t * cr) { cairo_set_source_rgba(cr, m_colorBG.red, m_colorBG.green, m_colorBG.blue, 1); };
|
|
||||||
|
|
||||||
color_ts & GetFG(void) { return m_colorFG; };
|
color_ts & GetFG(void) { return m_colorFG; };
|
||||||
color_ts & GetBG(void) { return m_colorBG; };
|
color_ts & GetBG(void) { return m_colorBG; };
|
||||||
@ -60,7 +50,7 @@ class Colorize {
|
|||||||
bool GetItalic(void);
|
bool GetItalic(void);
|
||||||
bool GetBold(void);
|
bool GetBold(void);
|
||||||
|
|
||||||
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" /*<< " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
|
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
etk::String ColorName; //!< curent color Name
|
etk::String ColorName; //!< curent color Name
|
||||||
|
@ -71,7 +71,14 @@ void APP_Init(int argc, char *argv[])
|
|||||||
|
|
||||||
ewol::SetFontFolder("Font");
|
ewol::SetFontFolder("Font");
|
||||||
#ifdef EWOL_USE_FREE_TYPE
|
#ifdef EWOL_USE_FREE_TYPE
|
||||||
ewol::SetDefaultFont("freefont/FreeMono", 14);
|
//ewol::SetDefaultFont("freefont/FreeMono.ttf", 12);
|
||||||
|
ewol::SetDefaultFont("ACharmingFont.ttf", 45);
|
||||||
|
//ewol::SetDefaultFont("DeutscheZierschrift.ttf", 40);
|
||||||
|
//ewol::SetDefaultFont("Dragon_Order_v2.ttf", 40);
|
||||||
|
//ewol::SetDefaultFont("Alien_lines_1.9.ttf", 40);
|
||||||
|
//ewol::SetDefaultFont("freefont/FreeMonoBold.ttf", 12);
|
||||||
|
//ewol::SetDefaultFont("Monospace/Monospace", 40);
|
||||||
|
//ewol::SetDefaultFont("UniSpace/unispace.ttf", 12);
|
||||||
#else
|
#else
|
||||||
//ewol::SetDefaultFont("ebtfont/Monospace", 14);
|
//ewol::SetDefaultFont("ebtfont/Monospace", 14);
|
||||||
ewol::SetDefaultFont("ebtfont/Monospace", 22);
|
ewol::SetDefaultFont("ebtfont/Monospace", 22);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user