[DEV] change the internal system of register font ==> use system font
This commit is contained in:
parent
cab24c59ac
commit
c3838996f3
@ -85,17 +85,8 @@ class Buffer {
|
||||
public:
|
||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate) {};
|
||||
virtual void SetLineDisplay(uint32_t lineNumber) {};
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
|
||||
#else
|
||||
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
@ -67,25 +67,13 @@ BufferEmpty::~BufferEmpty(void)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#else
|
||||
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
// Get color :
|
||||
Colorize *myColor = NULL;
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterHeight = OOText.GetHeight();
|
||||
#else
|
||||
int32_t letterHeight = OOTextNormal.GetHeight();
|
||||
#endif
|
||||
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = 20;
|
||||
@ -100,8 +88,8 @@ int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
OOText.SetItalic(false);
|
||||
OOText.Text(textPos, tmpDisplay);
|
||||
#else
|
||||
OOTextBold.SetColor(myColor->GetFG());
|
||||
OOTextBold.Text(textPos, tmpDisplay);
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.Text(textPos, tmpDisplay, ewol::font::Bold);
|
||||
#endif
|
||||
|
||||
myColor = ColorizeManager::Get("commentDoxygen");
|
||||
@ -113,8 +101,8 @@ int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.Text(textPos, tmpDisplay);
|
||||
#else
|
||||
OOTextNormal.SetColor(myColor->GetFG());
|
||||
OOTextNormal.Text(textPos, tmpDisplay);
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.Text(textPos, tmpDisplay, ewol::font::Regular);
|
||||
#endif
|
||||
|
||||
OOColored.SetColor(draw::color::white);
|
||||
|
@ -32,18 +32,8 @@ class BufferEmpty : public Buffer {
|
||||
public:
|
||||
BufferEmpty(void);
|
||||
virtual ~BufferEmpty(void);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
#else
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -277,32 +277,18 @@ int32_t BufferText::GetNumberOfLine(void)
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY)
|
||||
#else
|
||||
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||
bool selIsRect;
|
||||
int32_t selHave;
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterWidth = OOText.GetSize("A").x;
|
||||
int32_t letterHeight = OOText.GetHeight();
|
||||
#else
|
||||
int32_t letterWidth = OOTextNormal.GetSize("A").x;
|
||||
int32_t letterHeight = OOTextNormal.GetHeight();
|
||||
#endif
|
||||
|
||||
int32_t displayStartLineId = offsetY / letterHeight - 1;
|
||||
displayStartLineId = etk_max(0, displayStartLineId);
|
||||
int32_t y = - offsetY + displayStartLineId*letterHeight;
|
||||
@ -330,9 +316,6 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
draw::Color & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE);
|
||||
draw::Color & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB);
|
||||
Colorize * selectColor = NULL;
|
||||
#ifndef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
ewol::TEXT_DISPLAY_TYPE* OOTextSelected = NULL;
|
||||
#endif
|
||||
int mylen = m_EdnBuf.Size();
|
||||
int32_t x_base=nbColoneForLineNumber*letterWidth;
|
||||
int32_t idX = 0;
|
||||
@ -362,13 +345,8 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
y -= letterHeight;
|
||||
|
||||
OOColored.clippingDisable();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.clippingDisable();
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
#else
|
||||
OOTextNormal.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
#endif
|
||||
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||
|
||||
clipping_ts drawClipping;
|
||||
@ -383,14 +361,7 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
drawClippingTextArea.w = sizeX - drawClipping.x;
|
||||
drawClippingTextArea.h = sizeY;
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.clippingSet(drawClippingTextArea);
|
||||
#else
|
||||
OOTextNormal.clippingSet(drawClippingTextArea);
|
||||
OOTextBold.clippingSet(drawClippingTextArea);
|
||||
OOTextItalic.clippingSet(drawClippingTextArea);
|
||||
OOTextBoldItalic.clippingSet(drawClippingTextArea);
|
||||
#endif
|
||||
OOColored.clippingSet(drawClippingTextArea);
|
||||
|
||||
// Clear the line intexation :
|
||||
@ -463,25 +434,26 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOText.Text(textPos, myStringToDisplay);
|
||||
#else
|
||||
ewol::font::mode_te tmpMode = ewol::font::Regular;
|
||||
if (true == selectColor->GetItalic() ) {
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBoldItalic;
|
||||
tmpMode = ewol::font::BoldItalic;
|
||||
} else {
|
||||
OOTextSelected = &OOTextItalic;
|
||||
tmpMode = ewol::font::Italic;
|
||||
}
|
||||
} else {
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBold;
|
||||
tmpMode = ewol::font::Bold;
|
||||
} else {
|
||||
OOTextSelected = &OOTextNormal;
|
||||
tmpMode = ewol::font::Regular;
|
||||
}
|
||||
}
|
||||
tmpElementProperty.m_ySize = OOTextSelected->GetHeight();
|
||||
tmpElementProperty.m_ySize = OOText.GetHeight();
|
||||
//tmpElementProperty.m_yOffset += tmpElementProperty.m_ySize;
|
||||
OOTextSelected->SetColor(selectColor->GetFG());
|
||||
OOText.SetColor(selectColor->GetFG());
|
||||
// TODO : Remove this unreallistic leak of time
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOTextSelected->Text(textPos, myStringToDisplay);
|
||||
drawSize = OOText.Text(textPos, myStringToDisplay, tmpMode);
|
||||
#endif
|
||||
//APPL_DEBUG("add element : " << tmpElementProperty.m_yOffset << "," << tmpElementProperty.m_xOffset);
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
@ -516,9 +488,9 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOText.clippingEnable();
|
||||
#else
|
||||
OOTextNormal.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOTextNormal.clippingEnable();
|
||||
OOText.clippingDisable();
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOText.clippingEnable();
|
||||
#endif
|
||||
OOColored.clippingEnable();
|
||||
// add elements :
|
||||
|
@ -54,20 +54,10 @@ class BufferText : public Buffer {
|
||||
|
||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||
void SetLineDisplay(uint32_t lineNumber);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
#else
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
#endif
|
||||
void AddChar(uniChar_t unicodeData);
|
||||
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||
void MouseSelectFromCursorTo(etk::Vector2D<float> pos);
|
||||
|
@ -78,13 +78,11 @@ void CodeView::Init(void)
|
||||
ShortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
||||
}
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
|
||||
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
|
||||
m_OObjectText(fontName, fontSize)
|
||||
{
|
||||
{
|
||||
Init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CodeView::CodeView(void)
|
||||
{
|
||||
@ -127,11 +125,7 @@ bool CodeView::CalculateMinSize(void)
|
||||
void CodeView::CalculateMaxSize(void)
|
||||
{
|
||||
m_maxSize.x = 2048;
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterHeight = m_OObjectText.GetHeight();
|
||||
#else
|
||||
int32_t letterHeight = m_OObjectTextNormal.GetHeight();
|
||||
#endif
|
||||
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
|
||||
}
|
||||
|
||||
@ -139,14 +133,7 @@ void CodeView::CalculateMaxSize(void)
|
||||
void CodeView::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
m_OObjectsColored.Draw();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.Draw();
|
||||
#else
|
||||
m_OObjectTextNormal.Draw();
|
||||
m_OObjectTextBold.Draw();
|
||||
m_OObjectTextItalic.Draw();
|
||||
m_OObjectTextBoldItalic.Draw();
|
||||
#endif
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
}
|
||||
|
||||
@ -158,14 +145,7 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
// For the scrooling windows
|
||||
CalculateMaxSize();
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.Clear();
|
||||
#else
|
||||
m_OObjectTextNormal.Clear();
|
||||
m_OObjectTextBold.Clear();
|
||||
m_OObjectTextItalic.Clear();
|
||||
m_OObjectTextBoldItalic.Clear();
|
||||
#endif
|
||||
m_OObjectsColored.Clear();
|
||||
|
||||
|
||||
@ -178,18 +158,9 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
} // else : nothing to do ...
|
||||
|
||||
// generate the objects :
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
BufferManager::Get(m_bufferID)->Display(m_OObjectText,
|
||||
m_OObjectsColored,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
#else
|
||||
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal,
|
||||
m_OObjectTextBold,
|
||||
m_OObjectTextItalic,
|
||||
m_OObjectTextBoldItalic,
|
||||
m_OObjectsColored,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
#endif
|
||||
// set the current size of the windows
|
||||
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
|
||||
|
||||
@ -435,41 +406,12 @@ void CodeView::OnLostFocus(void)
|
||||
|
||||
void CodeView::SetFontSize(int32_t size)
|
||||
{
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.SetSize(size);
|
||||
#else
|
||||
m_OObjectTextNormal.SetSize(size);
|
||||
m_OObjectTextBold.SetSize(size);
|
||||
m_OObjectTextItalic.SetSize(size);
|
||||
m_OObjectTextBoldItalic.SetSize(size);
|
||||
#endif
|
||||
SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
|
||||
}
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
void CodeView::SetFontName(etk::UString fontName)
|
||||
{
|
||||
void CodeView::SetFontName(etk::UString fontName)
|
||||
{
|
||||
m_OObjectText.SetFont(fontName);
|
||||
}
|
||||
#else
|
||||
void CodeView::SetFontNameNormal(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextNormal.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBold(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextBold.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameItalic(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextItalic.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextBoldItalic.SetFont(fontName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,7 @@ class CodeView :public ewol::WidgetScrooled
|
||||
{
|
||||
public:
|
||||
void Init(void);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
CodeView(etk::UString fontName, int32_t fontSize);
|
||||
#endif
|
||||
CodeView(void);
|
||||
virtual ~CodeView(void);
|
||||
/**
|
||||
@ -61,14 +59,7 @@ class CodeView :public ewol::WidgetScrooled
|
||||
etk::Vector<etk::Vector2D<float> > m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
// drawing elements :
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectText;
|
||||
#else
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextNormal;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBold;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextItalic;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBoldItalic;
|
||||
#endif
|
||||
ewol::OObject2DColored m_OObjectsColored;
|
||||
|
||||
public:
|
||||
@ -106,14 +97,7 @@ class CodeView :public ewol::WidgetScrooled
|
||||
virtual void OnLostFocus(void);
|
||||
public:
|
||||
void SetFontSize(int32_t size);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
void SetFontName(etk::UString fontName);
|
||||
#else
|
||||
void SetFontNameNormal(etk::UString fontName);
|
||||
void SetFontNameBold(etk::UString fontName);
|
||||
void SetFontNameItalic(etk::UString fontName);
|
||||
void SetFontNameBoldItalic(etk::UString fontName);
|
||||
#endif
|
||||
private:
|
||||
void CalculateMaxSize(void);
|
||||
protected:
|
||||
|
@ -155,22 +155,11 @@ MainWindows::MainWindows(void)
|
||||
mySizerHori->SubWidgetAdd(mySizerVert2);
|
||||
|
||||
// main buffer Area :
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
myCodeView = new CodeView("Font/freefont/FreeMono.ttf", 24);
|
||||
#else
|
||||
myCodeView = new CodeView();
|
||||
#endif
|
||||
myCodeView = new CodeView("FreeMono", 24);
|
||||
myCodeView->SetExpendX(true);
|
||||
myCodeView->SetExpendY(true);
|
||||
myCodeView->SetFillX(true);
|
||||
myCodeView->SetFillY(true);
|
||||
#ifndef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
myCodeView->SetFontSize(11);
|
||||
myCodeView->SetFontNameNormal( "Font/freefont/FreeMono.ttf");
|
||||
myCodeView->SetFontNameBold( "Font/freefont/FreeMonoBold.ttf");
|
||||
myCodeView->SetFontNameItalic( "Font/freefont/FreeMonoOblique.ttf");
|
||||
myCodeView->SetFontNameBoldItalic("Font/freefont/FreeMonoBoldOblique.ttf");
|
||||
#endif
|
||||
mySizerVert2->SubWidgetAdd(myCodeView);
|
||||
|
||||
// search area :
|
||||
|
@ -68,7 +68,8 @@ void APP_Init(void)
|
||||
ewol::ChangeSize(etk::Vector2D<int32_t>(800, 600));
|
||||
etk::InitDefaultFolder(PROJECT_NAME);
|
||||
|
||||
ewol::font::SetDefaultFont("Font/freefont/FreeSerif.ttf");
|
||||
ewol::font::SetDefaultFont("FreeSerif");
|
||||
//ewol::font::SetDefaultFont("Font/freefont/FreeSerif.ttf");
|
||||
//ewol::font::SetDefaultFont("Font/ACharmingFont.ttf");
|
||||
#ifdef __TARGET_OS__Android
|
||||
ewol::font::SetDefaultSize(19);
|
||||
|
Loading…
x
Reference in New Issue
Block a user