Display none Mono-space Text

This commit is contained in:
Edouard Dupin 2012-01-18 14:31:33 +01:00
parent 6f6b0a6f7f
commit f3bf0b557c
3 changed files with 24 additions and 20 deletions

View File

@ -306,6 +306,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
int32_t fontId = ewol::GetDefaultFontId();
int32_t letterWidth = ewol::GetWidth(fontId, "A");
int32_t spaceWidth = ewol::GetWidth(fontId, " ");
int32_t letterHeight = ewol::GetHeight(fontId);
// 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);
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) {
//EDN_DEBUG("diplay element=" << iii);
int32_t pixelX = xx*letterWidth + x_base;
int displaywidth;
uint32_t currentChar = '\0';
new_i = iii;
@ -416,7 +417,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
} else {
OOColored->SetColor(myColorSpace);
}
OOColored->Rectangle( pixelX, y, letterWidth, letterHeight);
OOColored->Rectangle( pixelX, y, spaceWidth, letterHeight);
pixelX += spaceWidth;
} else if( '\t' == currentChar
&& true == globals::IsSetDisplaySpaceChar() )
{
@ -430,7 +432,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
} else {
OOColored->SetColor(myColorTab);
}
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
OOColored->Rectangle( pixelX, y, spaceWidth*strlen(tmpDisplayOfset), letterHeight);
pixelX += spaceWidth*strlen(tmpDisplayOfset);
} else {
if( true == selHave
&& selStart <= iii
@ -441,15 +444,17 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
OOColored->SetColor(selectColor->GetBG());
OOText->SetColor(selectColor->GetFG());
if (currentChar <= 0x7F) {
OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
int32_t drawSize = OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
if (true == selectColor->HaveBg() ) {
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
}
pixelX += drawSize;
} else {
OOText->TextAdd(pixelX, y, displayChar, -1);
int32_t drawSize = OOText->TextAdd(pixelX, y, displayChar, -1);
if (true == selectColor->HaveBg() ) {
OOColored->Rectangle( pixelX, y, letterWidth*strlen(tmpDisplayOfset), letterHeight);
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
}
pixelX += drawSize;
}
}
xx+=widthToDisplay;
@ -474,6 +479,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
//drawer.Flush();
xx = 0;
idX =0;
pixelX = x_base;
y += letterHeight;
displayLines++;
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...
if (m_cursorPos == iii) {
CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
// display the cursor:
if (true == m_cursorOn) {
//Cursor(OOColored, xx*letterWidth + x_base, yy+letterHeight, letterHeight, letterWidth);

View File

@ -25,15 +25,7 @@
#ifndef __COLORIZE_H__
#define __COLORIZE_H__
/*
extern "C" {
typedef struct {
float red;
float green;
float blue;
} color_ts;
}
*/
class Colorize {
public:
@ -47,8 +39,6 @@ class Colorize {
etk::String GetName(void);
void SetFgColor(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 & GetBG(void) { return m_colorBG; };
@ -60,7 +50,7 @@ class Colorize {
bool GetItalic(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:
etk::String ColorName; //!< curent color Name

View File

@ -71,7 +71,14 @@ void APP_Init(int argc, char *argv[])
ewol::SetFontFolder("Font");
#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
//ewol::SetDefaultFont("ebtfont/Monospace", 14);
ewol::SetDefaultFont("ebtfont/Monospace", 22);