diff --git a/build b/build index 78d74b12..6c1649f3 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 78d74b125f820fbeed698ddde87904fd99757c71 +Subproject commit 6c1649f36f63f6ab5d8c99ed1aa566d2ecec627c diff --git a/external/etk b/external/etk index 46b81ecb..6d94d06e 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 46b81ecbbf1a907cfc1c629af848d1b0aeadd7dc +Subproject commit 6d94d06efa8df92fe002f411118797ed6679e956 diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index afb74a8f..1b74252e 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -769,12 +769,16 @@ void ewol::Text::Print(const etk::UString& text, const etk::VectorGetGlyphPointer(charcode, m_mode); + if (NULL==myGlyph) { + EWOL_ERROR(" font does not really existed ..."); + return; + } int32_t fontSize = m_font->GetFontSize(); int32_t fontHeigh = m_font->GetHeight(m_mode); diff --git a/sources/ewol/ewol.cpp b/sources/ewol/ewol.cpp index 05305db3..dc4a8db7 100644 --- a/sources/ewol/ewol.cpp +++ b/sources/ewol/ewol.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -17,6 +18,10 @@ #undef __class__ #define __class__ "ewol" +void ewol::SetFontSourcesFolder(bool inOsSystem) +{ + ewol::font::SetFontPropety(inOsSystem); +} int32_t ewol::Run(int32_t argc, const char* argv[]) { diff --git a/sources/ewol/ewol.h b/sources/ewol/ewol.h index 5ea0f1cc..4dddaba9 100644 --- a/sources/ewol/ewol.h +++ b/sources/ewol/ewol.h @@ -105,6 +105,11 @@ namespace ewol * @note Does not work on Andoid */ void SetIcon(etk::UString icon); + /** + * @brief Select the position of the font folder (in the OS path or in the DATA: path) + * @param[in] inOsSystem Set at true if you want to select the os system folder. + */ + void SetFontSourcesFolder(bool inOsSystem); }; #endif diff --git a/sources/ewol/renderer/resources/TexturedFont.cpp b/sources/ewol/renderer/resources/TexturedFont.cpp index 469b4c4d..6f3ffce4 100644 --- a/sources/ewol/renderer/resources/TexturedFont.cpp +++ b/sources/ewol/renderer/resources/TexturedFont.cpp @@ -45,6 +45,16 @@ static int32_t simpleSQRT(int32_t value) return val; } +static bool& GetFontInSystem(void) +{ + static bool fontInOs = true; + return fontInOs; +} + +void ewol::font::SetFontPropety(bool inOSSystem) +{ + GetFontInSystem() = inOSSystem; +} ewol::TexturedFont::TexturedFont(etk::UString fontName) : ewol::Texture(fontName) @@ -89,17 +99,18 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : m_name = fontName.Extract(0, (tmpPos - tmpData)); m_size = tmpSize; + etk::UString fontBaseFolder("DATA:fonts"); + if (true==GetFontInSystem()) { + #if defined(__TARGET_OS__Android) + fontBaseFolder = "/system/font"; + #elif defined(__TARGET_OS__Linux) + fontBaseFolder = "/usr/share/fonts/truetype"; + #endif + } + etk::FSNode myFolder(fontBaseFolder); + EWOL_INFO("try to find font named : '" << m_name << "' in : '" << myFolder <<"'"); // find the real Font name : etk::Vector output; - #ifdef __EWOL_INTEGRATED_FONT__ - etk::FSNode myFolder("DATA:fonts"); - #else - #if defined(__TARGET_OS__Android) - etk::FSNode myFolder("/system/font"); - #elif defined(__TARGET_OS__Linux) - etk::FSNode myFolder("/usr/share/fonts/truetype"); - #endif - #endif myFolder.FolderGetRecursiveFiles(output); for (int32_t iii=0; iii m_kerning; //!< kerning values of link of all elements + etk::Vector m_kerning; //!< kerning values of link of all elements public: float KerningGet(const uniChar_t charcode) { diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 3ca0b96d..2d421977 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -2,6 +2,7 @@ import lutinModule import lutinTools import os +import datetime def Create(target): # set the ewol folder for Android basic sources ... @@ -141,10 +142,11 @@ def Create(target): #endif myModule.AddExportPath(lutinTools.GetCurrentPath(__file__)) - + now = datetime.datetime.now() myModule.CompileFlags_CC([ '-Wno-write-strings', '-DEWOL_VERSION_TAG_NAME="\\"TAG-build\\""', + "-DBUILD_TIME=\"\\\""+str(now.day)+"/"+str(now.month)+"/"+str(now.year)+"\\\"\"", '-Wall']) if target.name=="Linux": @@ -196,7 +198,6 @@ def Create(target): elif target.name=="Windows": myModule.AddModuleDepend("glew") myModule.AddSrcFile("ewol/renderer/os/gui.Windows.cpp") - myModule.CompileFlags_CC('-D__EWOL_INTEGRATED_FONT__') else: debug.error("unknow mode...")