[DEV] segfault correction and dynamic management of the font position
This commit is contained in:
parent
6533b8af29
commit
150df589e6
2
build
2
build
@ -1 +1 @@
|
|||||||
Subproject commit 78d74b125f820fbeed698ddde87904fd99757c71
|
Subproject commit 6c1649f36f63f6ab5d8c99ed1aa566d2ecec627c
|
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 46b81ecbbf1a907cfc1c629af848d1b0aeadd7dc
|
Subproject commit 6d94d06efa8df92fe002f411118797ed6679e956
|
@ -769,12 +769,16 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
|||||||
|
|
||||||
void ewol::Text::Print(const uniChar_t charcode)
|
void ewol::Text::Print(const uniChar_t charcode)
|
||||||
{
|
{
|
||||||
if (m_font == NULL) {
|
if (NULL==m_font) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// get a pointer on the glyph property :
|
// get a pointer on the glyph property :
|
||||||
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(charcode, m_mode);
|
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(charcode, m_mode);
|
||||||
|
if (NULL==myGlyph) {
|
||||||
|
EWOL_ERROR(" font does not really existed ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int32_t fontSize = m_font->GetFontSize();
|
int32_t fontSize = m_font->GetFontSize();
|
||||||
int32_t fontHeigh = m_font->GetHeight(m_mode);
|
int32_t fontHeigh = m_font->GetHeight(m_mode);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
|
#include <ewol/renderer/resources/TexturedFont.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
#include <ewol/renderer/os/gui.h>
|
||||||
#include <ewol/commandLine.h>
|
#include <ewol/commandLine.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
@ -17,6 +18,10 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol"
|
#define __class__ "ewol"
|
||||||
|
|
||||||
|
void ewol::SetFontSourcesFolder(bool inOsSystem)
|
||||||
|
{
|
||||||
|
ewol::font::SetFontPropety(inOsSystem);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t ewol::Run(int32_t argc, const char* argv[])
|
int32_t ewol::Run(int32_t argc, const char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,11 @@ namespace ewol
|
|||||||
* @note Does not work on Andoid
|
* @note Does not work on Andoid
|
||||||
*/
|
*/
|
||||||
void SetIcon(etk::UString icon);
|
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
|
#endif
|
||||||
|
@ -45,6 +45,16 @@ static int32_t simpleSQRT(int32_t value)
|
|||||||
return val;
|
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::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||||
ewol::Texture(fontName)
|
ewol::Texture(fontName)
|
||||||
@ -89,17 +99,18 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
|||||||
m_name = fontName.Extract(0, (tmpPos - tmpData));
|
m_name = fontName.Extract(0, (tmpPos - tmpData));
|
||||||
m_size = tmpSize;
|
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 :
|
// find the real Font name :
|
||||||
etk::Vector<etk::UString> output;
|
etk::Vector<etk::UString> 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);
|
myFolder.FolderGetRecursiveFiles(output);
|
||||||
for (int32_t iii=0; iii<output.Size(); iii++) {
|
for (int32_t iii=0; iii<output.Size(); iii++) {
|
||||||
//EWOL_DEBUG(" file : " << output[iii]);
|
//EWOL_DEBUG(" file : " << output[iii]);
|
||||||
|
@ -17,6 +17,7 @@ namespace ewol
|
|||||||
{
|
{
|
||||||
namespace font
|
namespace font
|
||||||
{
|
{
|
||||||
|
void SetFontPropety(bool inOSSystem);
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Regular=0,
|
Regular=0,
|
||||||
Italic,
|
Italic,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import lutinModule
|
import lutinModule
|
||||||
import lutinTools
|
import lutinTools
|
||||||
import os
|
import os
|
||||||
|
import datetime
|
||||||
|
|
||||||
def Create(target):
|
def Create(target):
|
||||||
# set the ewol folder for Android basic sources ...
|
# set the ewol folder for Android basic sources ...
|
||||||
@ -141,10 +142,11 @@ def Create(target):
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
myModule.AddExportPath(lutinTools.GetCurrentPath(__file__))
|
myModule.AddExportPath(lutinTools.GetCurrentPath(__file__))
|
||||||
|
now = datetime.datetime.now()
|
||||||
myModule.CompileFlags_CC([
|
myModule.CompileFlags_CC([
|
||||||
'-Wno-write-strings',
|
'-Wno-write-strings',
|
||||||
'-DEWOL_VERSION_TAG_NAME="\\"TAG-build\\""',
|
'-DEWOL_VERSION_TAG_NAME="\\"TAG-build\\""',
|
||||||
|
"-DBUILD_TIME=\"\\\""+str(now.day)+"/"+str(now.month)+"/"+str(now.year)+"\\\"\"",
|
||||||
'-Wall'])
|
'-Wall'])
|
||||||
|
|
||||||
if target.name=="Linux":
|
if target.name=="Linux":
|
||||||
@ -196,7 +198,6 @@ def Create(target):
|
|||||||
elif target.name=="Windows":
|
elif target.name=="Windows":
|
||||||
myModule.AddModuleDepend("glew")
|
myModule.AddModuleDepend("glew")
|
||||||
myModule.AddSrcFile("ewol/renderer/os/gui.Windows.cpp")
|
myModule.AddSrcFile("ewol/renderer/os/gui.Windows.cpp")
|
||||||
myModule.CompileFlags_CC('-D__EWOL_INTEGRATED_FONT__')
|
|
||||||
else:
|
else:
|
||||||
debug.error("unknow mode...")
|
debug.error("unknow mode...")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user