// Specific to load or update the data in the openGl context == > system use only void ewol::resource::Manager::updateContext() { if (m_contextHasBeenRemoved == true) { // need to update all ... m_contextHasBeenRemoved = false; if (m_resourceList.size() != 0) { for (size_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) { EWOL_INFO(" updateContext level (D) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1)); for (auto &it : m_resourceList) { std::shared_ptr<ewol::Resource> tmpRessource = it.lock(); if( tmpRessource != nullptr && jjj == tmpRessource->getResourceLevel()) { //EWOL_DEBUG("Update context named : " << l_resourceList[iii]->getName()); tmpRessource->updateContext(); } } } } } else { if (m_resourceListToUpdate.size() != 0) { for (size_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) { EWOL_INFO(" updateContext level (U) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1)); for (auto &it : m_resourceListToUpdate) { if ( it != nullptr && jjj == it->getResourceLevel()) { it->updateContext(); } } } } } // Clean the update list m_resourceListToUpdate.clear(); }
void ewol::object::Manager::displayListObject() { EWOL_INFO("List loaded object : "); for (auto &it : m_eObjectList) { std::shared_ptr<ewol::Object> element = it.lock(); if (element != nullptr) { EWOL_INFO(" [" << element->getId() << "] ref=" << element.use_count()-1 << " name='" << element->getName() << "' type=" << element->getObjectType()); } } }
ewol::context::InputManager::InputManager(ewol::Context& _context) : m_grabWidget(), m_context(_context) { setDpi(200); EWOL_INFO("Init (start)"); for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { // remove the property of this input ... cleanElement(m_eventInputSaved, iii); cleanElement(m_eventMouseSaved, iii); } EWOL_INFO("Init (end)"); }
void ewol::resource::Manager::display() { EWOL_INFO("Resources loaded : "); // remove all resources ... for (auto &it : m_resourceList) { std::shared_ptr<ewol::Resource> tmpRessource = it.lock(); if (tmpRessource != nullptr) { EWOL_INFO(" [" << tmpRessource->getId() << "]" << tmpRessource->getObjectType() << "=\"" << tmpRessource->getName() << "\" " << tmpRessource.use_count() << " elements"); } } EWOL_INFO("Resources ---"); }
void ewol::translate::autoDetectLanguage() { EWOL_INFO("Auto-detect language of system"); #if defined(__TARGET_OS__Linux) char *s = getenv("LANG"); if (s == nullptr || strlen(s) < 2) { EWOL_INFO("Try to determine system language FAIL ..."); } else { std::string lang; lang += s[0]; lang += s[1]; lang = etk::toupper(lang); getInstanceTranslation().setLanguage(lang); } #else EWOL_INFO("Can not auto-detect language ..."); #endif }
void ewol::resource::Texture::removeContext() { std11::unique_lock<std11::recursive_mutex> lock(m_mutex); if (true == m_loaded) { // Request remove texture ... EWOL_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId); glDeleteTextures(1, &m_texId); m_loaded = false; } }
void setLanguageDefault(const std::string& _lang) { if (m_languageDefault == _lang) { return; } EWOL_INFO("Change default language translation : '" << _lang << "'"); m_languageDefault = _lang; m_translateLoadad = false; m_translate.clear(); };
void ewol::resource::Manager::reLoadResources() { EWOL_INFO("------------- Resources re-loaded -------------"); // remove all resources ... if (m_resourceList.size() != 0) { for (size_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) { EWOL_INFO(" Reload level : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1)); for (auto &it : m_resourceList) { std::shared_ptr<ewol::Resource> tmpRessource = it.lock(); if(tmpRessource != nullptr) { if (jjj == tmpRessource->getResourceLevel()) { tmpRessource->reload(); EWOL_INFO(" [" << tmpRessource->getId() << "]="<< tmpRessource->getObjectType()); } } } } } // TODO : UNderstand why it is set here ... //ewol::requestUpdateSize(); EWOL_INFO("------------- Resources -------------"); }
void addPath(const std::string& _lib, const std::string& _path, bool _major) { auto it = m_listPath.find(_lib); if (it == m_listPath.end()) { m_listPath.insert(make_pair(_lib, _path)); } else { it->second = _path; } if (_major == true) { m_major = _lib; EWOL_INFO("Change major translation : '" << m_major << "'"); } m_translateLoadad = false; m_translate.clear(); };
bool ewol::resource::Texture::updateContext() { std11::unique_lock<std11::recursive_mutex> lock(m_mutex, std11::defer_lock); if (lock.try_lock() == false) { //Lock error ==> try later ... return false; } if (false == m_loaded) { // Request a new texture at openGl : glGenTextures(1, &m_texId); } EWOL_ERROR("plop : load the image:" << m_name); // in all case we set the texture properties : // TODO : check error ??? glBindTexture(GL_TEXTURE_2D, m_texId); // TODO : Check error ??? //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //--- mode nearest //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //--- Mode linear glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); EWOL_INFO("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << " OGl_Id=" <<m_texId); //egami::storeBMP("~/bbb_image.bmp", m_data); glTexImage2D(GL_TEXTURE_2D, // Target 0, // Level GL_RGBA, // Format internal m_data.getWidth(), m_data.getHeight(), 0, // Border GL_RGBA, // format GL_UNSIGNED_BYTE, // type m_data.getTextureDataPointer() ); // now the data is loaded m_loaded = true; return true; }
void ewol::widget::Parameter::init() { ewol::widget::PopUp::init(); std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr; std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr; std::shared_ptr<ewol::widget::Spacer> mySpacer = nullptr; #ifdef __TARGET_OS__Android setMinSize(ewol::Dimension(vec2(90, 90), ewol::Dimension::Pourcent)); #else setMinSize(ewol::Dimension(vec2(80, 80), ewol::Dimension::Pourcent)); #endif mySizerVert = ewol::widget::Sizer::create(widget::Sizer::modeVert); if (nullptr == mySizerVert) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { EWOL_INFO("add widget"); mySizerVert->lockExpand(bvec2(true,true)); mySizerVert->setExpand(bvec2(true,true)); // set it in the pop-up-system : setSubWidget(mySizerVert); mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori); if (nullptr == mySizerHori) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySizerVert->subWidgetAdd(mySizerHori); mySpacer = ewol::widget::Spacer::create(); if (nullptr == mySpacer) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setExpand(bvec2(true,false)); mySizerHori->subWidgetAdd(mySpacer); } std::shared_ptr<ewol::widget::Button> tmpButton = widget::Button::create(); if (nullptr == tmpButton) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String, "<composer>\n" " <sizer mode=\"hori\">\n" " <image src=\"THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <label>Save</label>\n" " </sizer>\n" "</composer>\n")); tmpButton->signalPressed.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackParameterSave); mySizerHori->subWidgetAdd(tmpButton); } mySpacer = ewol::widget::Spacer::create(); if (nullptr == mySpacer) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setExpand(bvec2(false,false)); mySpacer->setMinSize(ewol::Dimension(vec2(10,0))); mySizerHori->subWidgetAdd(mySpacer); } tmpButton = ewol::widget::Button::create(); if (nullptr == tmpButton) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String, "<composer>\n" " <sizer mode=\"hori\">\n" " <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <label>Close</label>\n" " </sizer>\n" "</composer>\n")); tmpButton->signalPressed.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuclosed); mySizerHori->subWidgetAdd(tmpButton); } } mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori); if (nullptr == mySizerHori) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySizerVert->subWidgetAdd(mySizerHori); m_paramList = ewol::widget::ParameterList::create(); if (nullptr == m_paramList) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { m_paramList->signalSelect.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuSelected); m_paramList->setFill(bvec2(false,true)); m_paramList->setExpand(bvec2(false,true)); mySizerHori->subWidgetAdd(m_paramList); } mySpacer = ewol::widget::Spacer::create(); if (nullptr == mySpacer) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setFill(bvec2(false,true)); mySpacer->setMinSize(vec2(5,5)); mySpacer->setColor(0x000000BF); mySizerHori->subWidgetAdd(mySpacer); } std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create(widget::Sizer::modeVert); if (nullptr == mySizerVert2) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySizerHori->subWidgetAdd(mySizerVert2); mySpacer = ewol::widget::Spacer::create(); if (nullptr == mySpacer) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setExpand(bvec2(true,false)); mySpacer->setMinSize(vec2(5,5)); mySpacer->setColor(0x000000BF); mySizerVert2->subWidgetAdd(mySpacer); } m_wSlider = ewol::widget::WSlider::create(); if (nullptr == m_wSlider) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { m_wSlider->setTransitionSpeed(0.5); m_wSlider->setTransitionMode(ewol::widget::WSlider::sladingTransitionVert); m_wSlider->setExpand(bvec2(true,true)); mySizerVert2->subWidgetAdd(m_wSlider); } } } mySpacer = ewol::widget::Spacer::create(); if (nullptr == mySpacer) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setExpand(bvec2(true,false)); mySpacer->setMinSize(vec2(5,5)); mySpacer->setColor(0x000000BF); mySizerVert->subWidgetAdd(mySpacer); } m_widgetTitle = ewol::widget::Label::create("File chooser ..."); if (nullptr == m_widgetTitle) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { m_widgetTitle->setExpand(bvec2(true,false)); mySizerVert->subWidgetAdd(m_widgetTitle); } } markToRedraw(); }
static void checkGlError(const char* _op) { for (GLint error = glGetError(); error; error = glGetError()) { EWOL_INFO("after " << _op << "() glError (" << error << ")"); } }
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const std::string& _filename, ivec2 _size, ivec2 _sizeRegister) { EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size << " sizeRegister=" << _sizeRegister); if (_filename == "") { ememory::SharedPtr<ewol::resource::TextureFile> object(new ewol::resource::TextureFile()); if (object == nullptr) { EWOL_ERROR("allocation error of a resource : ??TEX??"); return nullptr; } object->init(); getManager().localAdd(object); return object; } if (_size.x() == 0) { _size.setX(-1); //EWOL_ERROR("Error Request the image size.x() =0 ???"); } if (_size.y() == 0) { _size.setY(-1); //EWOL_ERROR("Error Request the image size.y() =0 ???"); } std::string tmpFilename = _filename; if (etk::end_with(_filename, ".svg") == false) { _size = ewol::resource::TextureFile::sizeAuto; } if (_size.x()>0 && _size.y()>0) { EWOL_VERBOSE(" == > specific size : " << _size); #if defined(__TARGET_OS__Android) \ || defined(__TARGET_OS__MacOs) \ || defined(__TARGET_OS__IOs) _size.setValue(nextP2(_size.x()), nextP2(_size.y())); #endif if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) { if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) { tmpFilename += ":"; tmpFilename += etk::to_string(_size.x()); tmpFilename += "x"; tmpFilename += etk::to_string(_size.y()); } } } EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size); ememory::SharedPtr<ewol::resource::TextureFile> object = nullptr; ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename); if (object2 != nullptr) { object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2); if (object == nullptr) { EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)"); return nullptr; } } if (object != nullptr) { return object; } EWOL_INFO("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size); // need to crate a new one ... object = ememory::SharedPtr<ewol::resource::TextureFile>(new ewol::resource::TextureFile()); if (object == nullptr) { EWOL_ERROR("allocation error of a resource : " << _filename); return nullptr; } object->init(tmpFilename, _filename, _size); getManager().localAdd(object); return object; }
ewol::context::InputManager::~InputManager() { EWOL_INFO("Un-Init (start)"); EWOL_INFO("Un-Init (end)"); }
void ewol::resource::DistanceFieldFont::init(const std::string& _fontName) { std11::unique_lock<std11::recursive_mutex> lock(m_mutex); ewol::resource::Texture::init(_fontName); std::string localName = _fontName; std::vector<std::string> folderList; if (true == ewol::getContext().getFontDefault().getUseExternal()) { #if defined(__TARGET_OS__Android) folderList.push_back("ROOT:system/fonts"); #elif defined(__TARGET_OS__Linux) folderList.push_back("ROOT:usr/share/fonts/truetype"); #endif } std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder(); std::vector<std::string> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont); for (auto &it : applicationBaseFontList) { folderList.push_back(it); } for (size_t folderID = 0; folderID < folderList.size() ; folderID++) { etk::FSNode myFolder(folderList[folderID]); // find the real Font name : std::vector<std::string> output; myFolder.folderGetRecursiveFiles(output); std::vector<std::string> split = etk::split(localName, ';'); EWOL_INFO("try to find font named : " << split << " in: " << myFolder); //EWOL_CRITICAL("parse string : " << split); bool hasFindAFont = false; for (size_t jjj=0; jjj<split.size(); jjj++) { EWOL_INFO(" try with : '" << split[jjj] << "'"); for (size_t iii=0; iii<output.size(); iii++) { //EWOL_DEBUG(" file : " << output[iii]); if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+".ttf", false)) { EWOL_INFO(" find Font [Regular] : " << output[iii]); m_fileName = output[iii]; hasFindAFont=true; break; } } if (hasFindAFont == true) { EWOL_INFO(" find this font : '" << split[jjj] << "'"); break; } else if (jjj == split.size()-1) { EWOL_ERROR("Find NO font in the LIST ... " << split); } } if (hasFindAFont == true) { EWOL_INFO(" find this font : '" << folderList[folderID] << "'"); break; } else if (folderID == folderList.size()-1) { EWOL_ERROR("Find NO font in the LIST ... " << folderList); } } if (m_fileName.size() == 0) { EWOL_ERROR("can not load FONT name : '" << m_fileName << "'" ); m_font = nullptr; return; } EWOL_INFO("Load FONT name : '" << m_fileName << "'"); m_font = ewol::resource::FontFreeType::create(m_fileName); if (m_font == nullptr) { EWOL_ERROR("Pb Loading FONT name : '" << m_fileName << "'" ); } // set the bassic charset: m_listElement.clear(); if (m_font == nullptr) { return; } if (importFromFile() == true) { EWOL_INFO("GET distance field from previous file"); flush(); return; } m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION)); // TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ??? setImageSize(ivec2(256,32)); // now we can acces directly on the image m_data.clear(etk::Color<>(0x00000000)); // add error glyph addGlyph(0); // by default we set only the first AINSI char availlable for (int32_t iii=0x20; iii<0x7F; iii++) { addGlyph(iii); } flush(); //exportOnFile(); }
void setLanguage(const std::string& _lang) { if (m_language == _lang) { return; } m_language = _lang; m_translateLoadad = false; m_translate.clear(); if (_lang == "EN") { EWOL_INFO("Change language translation: '" << _lang << "'=English"); } else if (_lang == "FR") { EWOL_INFO("Change language translation: '" << _lang << "'=French"); } else if (_lang == "DE") { EWOL_INFO("Change language translation: '" << _lang << "'=German"); } else if (_lang == "SP") { EWOL_INFO("Change language translation: '" << _lang << "'=Spanish"); } else if (_lang == "JA") { EWOL_INFO("Change language translation: '" << _lang << "'=Japanese"); } else if (_lang == "IT") { EWOL_INFO("Change language translation: '" << _lang << "'=Italian"); } else if (_lang == "KO") { EWOL_INFO("Change language translation: '" << _lang << "'=Korean"); } else if (_lang == "RU") { EWOL_INFO("Change language translation: '" << _lang << "'=Russian"); } else if (_lang == "PT") { EWOL_INFO("Change language translation: '" << _lang << "'=Portuguese, Brazilian"); } else if (_lang == "ZH") { EWOL_INFO("Change language translation: '" << _lang << "'=Chinese"); } else { EWOL_INFO("Change language translation: '" << _lang << "'=Unknow"); } };
void ewol::resource::TexturedFont::init(const std::string& _fontName) { std::unique_lock<std::recursive_mutex> lock(m_mutex); ewol::resource::Texture::init(_fontName); EWOL_DEBUG("Load font : '" << _fontName << "'" ); m_font[0] = nullptr; m_font[1] = nullptr; m_font[2] = nullptr; m_font[3] = nullptr; m_modeWraping[0] = ewol::font::Regular; m_modeWraping[1] = ewol::font::Regular; m_modeWraping[2] = ewol::font::Regular; m_modeWraping[3] = ewol::font::Regular; m_lastGlyphPos[0].setValue(1,1); m_lastGlyphPos[1].setValue(1,1); m_lastGlyphPos[2].setValue(1,1); m_lastGlyphPos[3].setValue(1,1); m_lastRawHeigh[0] = 0; m_lastRawHeigh[1] = 0; m_lastRawHeigh[2] = 0; m_lastRawHeigh[3] = 0; int32_t tmpSize = 0; // extarct name and size : const char * tmpData = _fontName.c_str(); const char * tmpPos = strchr(tmpData, ':'); if (tmpPos == nullptr) { m_size = 1; EWOL_CRITICAL("Can not parse the font name : \"" << _fontName << "\" ??? ':' " ); return; } else { if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) { m_size = 1; EWOL_CRITICAL("Can not parse the font name : \"" << _fontName << "\" == > size ???"); return; } } std::string localName(_fontName, 0, (tmpPos - tmpData)); if (tmpSize>400) { EWOL_ERROR("Font size too big ==> limit at 400 when exxeed ==> error : " << tmpSize << "==>30"); tmpSize = 30; } m_size = tmpSize; std::vector<std::string> folderList; if (true == ewol::getContext().getFontDefault().getUseExternal()) { #if defined(__TARGET_OS__Android) folderList.push_back("ROOT:system/fonts"); #elif defined(__TARGET_OS__Linux) folderList.push_back("ROOT:usr/share/fonts"); #endif } std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder(); std::vector<std::string> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont); for (auto &it : applicationBaseFontList) { folderList.push_back(it); } for (size_t folderID=0; folderID<folderList.size() ; folderID++) { etk::FSNode myFolder(folderList[folderID]); // find the real Font name : std::vector<std::string> output; myFolder.folderGetRecursiveFiles(output); std::vector<std::string> split = etk::split(localName, ';'); EWOL_INFO("try to find font named : " << split << " in: " << myFolder); //EWOL_CRITICAL("parse string : " << split); bool hasFindAFont = false; for (size_t jjj=0; jjj<split.size(); jjj++) { EWOL_INFO(" try with : '" << split[jjj] << "'"); for (size_t iii=0; iii<output.size(); iii++) { //EWOL_DEBUG(" file : " << output[iii]); if( true == etk::end_with(output[iii], split[jjj]+"-"+"bold"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"b"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"bd"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"bold"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"bd"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"b"+".ttf", false)) { EWOL_INFO(" find Font [Bold] : " << output[iii]); m_fileName[ewol::font::Bold] = output[iii]; hasFindAFont=true; } else if( true == etk::end_with(output[iii], split[jjj]+"-"+"oblique"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"italic"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"Light"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"i"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"oblique"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"italic"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"light"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"i"+".ttf", false)) { EWOL_INFO(" find Font [Italic] : " << output[iii]); m_fileName[ewol::font::Italic] = output[iii]; hasFindAFont=true; } else if( true == etk::end_with(output[iii], split[jjj]+"-"+"bolditalic"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"boldoblique"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"bi"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"z"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"bolditalic"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"boldoblique"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"bi"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"z"+".ttf", false)) { EWOL_INFO(" find Font [Bold-Italic] : " << output[iii]); m_fileName[ewol::font::BoldItalic] = output[iii]; hasFindAFont=true; } else if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false) || true == etk::end_with(output[iii], split[jjj]+".ttf", false)) { EWOL_INFO(" find Font [Regular] : " << output[iii]); m_fileName[ewol::font::Regular] = output[iii]; hasFindAFont=true; } } if (hasFindAFont == true) { EWOL_INFO(" find this font : '" << split[jjj] << "'"); break; } else if (jjj == split.size()-1) { EWOL_ERROR("Find NO font in the LIST ... " << split); } } if (hasFindAFont == true) { EWOL_INFO(" find this font : '" << folderList[folderID] << "'"); break; } else if (folderID == folderList.size()-1) { EWOL_ERROR("Find NO font in the LIST ... " << folderList); } } // try to find the reference mode : enum ewol::font::mode refMode = ewol::font::Regular; for(int32_t iii=3; iii >= 0; iii--) { if (m_fileName[iii].size() != 0) { refMode = (enum ewol::font::mode)iii; } } EWOL_DEBUG(" set reference mode : " << refMode); // generate the wrapping on the preventing error for(int32_t iii=3; iii >= 0; iii--) { if (m_fileName[iii].size() != 0) { m_modeWraping[iii] = (enum ewol::font::mode)iii; } else { m_modeWraping[iii] = refMode; } } for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) { if (m_fileName[iiiFontId].size() == 0) { EWOL_DEBUG("can not load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); m_font[iiiFontId] = nullptr; continue; } EWOL_INFO("Load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size); m_font[iiiFontId] = ewol::resource::FontFreeType::create(m_fileName[iiiFontId]); if (m_font[iiiFontId] == nullptr) { EWOL_DEBUG("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); } } for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) { // set the bassic charset: m_listElement[iiiFontId].clear(); if (m_font[iiiFontId] == nullptr) { continue; } m_height[iiiFontId] = m_font[iiiFontId]->getHeight(m_size); // TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ??? setImageSize(ivec2(256,32)); // now we can acces directly on the image m_data.clear(etk::Color<>(0x00000000)); } // add error glyph addGlyph(0); // by default we set only the first AINSI char availlable for (int32_t iii=0x20; iii<0x7F; iii++) { EWOL_VERBOSE("Add clyph :" << iii); addGlyph(iii); } flush(); EWOL_DEBUG("Wrapping properties : "); EWOL_DEBUG(" " << ewol::font::Regular << " == >" << getWrappingMode(ewol::font::Regular)); EWOL_DEBUG(" " << ewol::font::Italic << " == >" << getWrappingMode(ewol::font::Italic)); EWOL_DEBUG(" " << ewol::font::Bold << " == >" << getWrappingMode(ewol::font::Bold)); EWOL_DEBUG(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic)); }