- added packaged game fonts
- updated code to search new default font folder - added chinese language file from the fourm for testing
This commit is contained in:
parent
df178e5eb4
commit
226e8783c0
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Marti�o Figueroa
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -151,11 +151,11 @@ string getAboutString2(int i){
|
||||||
|
|
||||||
string getTeammateName(int i) {
|
string getTeammateName(int i) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0: return "Martiño Figueroa";
|
case 0: return "Marti<EFBFBD>o Figueroa";
|
||||||
case 1: return "José Luis González";
|
case 1: return "Jos<EFBFBD> Luis Gonz<6E>lez";
|
||||||
case 2: return "Tucho Fernández";
|
case 2: return "Tucho Fern<EFBFBD>ndez";
|
||||||
case 3: return "José Zanni";
|
case 3: return "Jos<EFBFBD> Zanni";
|
||||||
case 4: return "Félix Menéndez";
|
case 4: return "F<EFBFBD>lix Men<65>ndez";
|
||||||
case 5: return "Marcos Caruncho";
|
case 5: return "Marcos Caruncho";
|
||||||
case 6: return "Matthias Braun";
|
case 6: return "Matthias Braun";
|
||||||
case 7: return "Titus Tscharntke";
|
case 7: return "Titus Tscharntke";
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "cache_manager.h"
|
#include "cache_manager.h"
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include "core_data.h"
|
#include "core_data.h"
|
||||||
|
#include "font_text.h"
|
||||||
//#include "unicode/uclean.h"
|
//#include "unicode/uclean.h"
|
||||||
|
|
||||||
// For gcc backtrace on crash!
|
// For gcc backtrace on crash!
|
||||||
|
@ -1148,6 +1149,7 @@ int setupGameItemPaths(int argc, char** argv, Config *config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text::DEFAULT_FONT_PATH = pathCache[GameConstants::path_data_CacheLookupKey];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2448,6 +2450,7 @@ int glestMain(int argc, char** argv) {
|
||||||
FontGl::setDefault_fontType(config.getString("DefaultFont",FontGl::getDefault_fontType().c_str()));
|
FontGl::setDefault_fontType(config.getString("DefaultFont",FontGl::getDefault_fontType().c_str()));
|
||||||
UPNP_Tools::isUPNP = !config.getBool("DisableUPNP","false");
|
UPNP_Tools::isUPNP = !config.getBool("DisableUPNP","false");
|
||||||
Texture::useTextureCompression = config.getBool("EnableTextureCompression","false");
|
Texture::useTextureCompression = config.getBool("EnableTextureCompression","false");
|
||||||
|
|
||||||
// 256 for English
|
// 256 for English
|
||||||
// 30000 for Chinese
|
// 30000 for Chinese
|
||||||
Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());
|
Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());
|
||||||
|
|
|
@ -23,6 +23,8 @@ class Text
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static std::string DEFAULT_FONT_PATH;
|
||||||
|
|
||||||
Text();
|
Text();
|
||||||
virtual ~Text();
|
virtual ~Text();
|
||||||
|
|
||||||
|
|
|
@ -28,20 +28,15 @@ namespace Shared { namespace Graphics { namespace Gl {
|
||||||
class FontGl {
|
class FontGl {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//#ifndef USE_FTGL
|
|
||||||
GLuint handle;
|
GLuint handle;
|
||||||
//#endif
|
|
||||||
|
|
||||||
static string default_fonttype;
|
static string default_fonttype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//#ifndef USE_FTGL
|
|
||||||
GLuint getHandle() const {return handle;}
|
GLuint getHandle() const {return handle;}
|
||||||
//#endif
|
|
||||||
|
|
||||||
static string getDefault_fontType() { return default_fonttype; }
|
static string getDefault_fontType() {return default_fonttype;}
|
||||||
static void setDefault_fontType(string value) { default_fonttype = value; }
|
static void setDefault_fontType(string value) {default_fonttype = value;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
@ -19,10 +19,6 @@ namespace Shared { namespace Graphics { namespace Gl {
|
||||||
|
|
||||||
class Font2DGl;
|
class Font2DGl;
|
||||||
class Font3DGl;
|
class Font3DGl;
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// class TextFTGL;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class TextRenderer2DGl
|
// class TextRenderer2DGl
|
||||||
|
@ -33,10 +29,6 @@ private:
|
||||||
Font2DGl *font;
|
Font2DGl *font;
|
||||||
bool rendering;
|
bool rendering;
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// TextFTGL *fontFTGL;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextRenderer2DGl();
|
TextRenderer2DGl();
|
||||||
virtual ~TextRenderer2DGl();
|
virtual ~TextRenderer2DGl();
|
||||||
|
@ -55,10 +47,6 @@ private:
|
||||||
Font3DGl *font;
|
Font3DGl *font;
|
||||||
bool rendering;
|
bool rendering;
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// TextFTGL *fontFTGL;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextRenderer3DGl();
|
TextRenderer3DGl();
|
||||||
virtual ~TextRenderer3DGl();
|
virtual ~TextRenderer3DGl();
|
||||||
|
|
|
@ -28,7 +28,7 @@ using namespace Shared::Graphics::Gl;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared { namespace Graphics {
|
||||||
|
|
||||||
// Init statics
|
// Init statics
|
||||||
int Font::charCount = 256;
|
int Font::charCount = 256;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
std::string Text::DEFAULT_FONT_PATH = "";
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
Text::Text() {}
|
Text::Text() {}
|
||||||
Text::~Text() {}
|
Text::~Text() {}
|
||||||
|
|
|
@ -27,7 +27,6 @@ string FontGl::default_fonttype = "fixed";
|
||||||
|
|
||||||
void Font2DGl::init() {
|
void Font2DGl::init() {
|
||||||
if(inited == false) {
|
if(inited == false) {
|
||||||
//#ifndef USE_FTGL
|
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL) {
|
||||||
assertGl();
|
assertGl();
|
||||||
handle= glGenLists(charCount);
|
handle= glGenLists(charCount);
|
||||||
|
@ -36,21 +35,18 @@ void Font2DGl::init() {
|
||||||
createGlFontBitmaps(handle, type, size, width, charCount, metrics);
|
createGlFontBitmaps(handle, type, size, width, charCount, metrics);
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
inited= true;
|
inited= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font2DGl::end() {
|
void Font2DGl::end() {
|
||||||
if(inited) {
|
if(inited) {
|
||||||
//#ifndef USE_FTGL
|
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL) {
|
||||||
assertGl();
|
assertGl();
|
||||||
//assert(glIsList(handle));
|
//assert(glIsList(handle));
|
||||||
glDeleteLists(handle, 1);
|
glDeleteLists(handle, 1);
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
inited = false;
|
inited = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,28 +57,24 @@ void Font2DGl::end() {
|
||||||
|
|
||||||
void Font3DGl::init() {
|
void Font3DGl::init() {
|
||||||
if(inited == false) {
|
if(inited == false) {
|
||||||
//#ifndef USE_FTGL
|
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL) {
|
||||||
assertGl();
|
assertGl();
|
||||||
handle= glGenLists(charCount);
|
handle= glGenLists(charCount);
|
||||||
createGlFontOutlines(handle, type, width, depth, charCount, metrics);
|
createGlFontOutlines(handle, type, width, depth, charCount, metrics);
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
inited= true;
|
inited= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font3DGl::end() {
|
void Font3DGl::end() {
|
||||||
if(inited) {
|
if(inited) {
|
||||||
//#ifndef USE_FTGL
|
|
||||||
if(getTextHandler() == NULL) {
|
if(getTextHandler() == NULL) {
|
||||||
assertGl();
|
assertGl();
|
||||||
assert(glIsList(handle));
|
assert(glIsList(handle));
|
||||||
glDeleteLists(handle, 1);
|
glDeleteLists(handle, 1);
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ TextFTGL::TextFTGL() {
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/takao/TakaoPGothic.ttf",0); // Japanese
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew
|
||||||
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech?
|
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech?
|
||||||
|
@ -219,6 +219,11 @@ const char* TextFTGL::findFont(const char *firstFontToTry) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
string data_path = Text::DEFAULT_FONT_PATH;
|
||||||
|
const string defaultFont = data_path + "data/core/fonts/gothub__.ttf";
|
||||||
|
|
||||||
|
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf")
|
||||||
|
|
||||||
// Check a couple of common paths for Gothic Uralic/bold as a last resort
|
// Check a couple of common paths for Gothic Uralic/bold as a last resort
|
||||||
// Debian
|
// Debian
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martio Figueroa
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -15,14 +15,8 @@
|
||||||
#include "font_gl.h"
|
#include "font_gl.h"
|
||||||
|
|
||||||
#include "font_text.h"
|
#include "font_text.h"
|
||||||
//#ifdef USE_FTGL
|
|
||||||
//#include "font_textFTGL.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
//#include "string_utils.h"
|
|
||||||
//using namespace Shared::Util;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared { namespace Graphics { namespace Gl {
|
namespace Shared { namespace Graphics { namespace Gl {
|
||||||
|
@ -34,29 +28,16 @@ namespace Shared { namespace Graphics { namespace Gl {
|
||||||
TextRenderer2DGl::TextRenderer2DGl() {
|
TextRenderer2DGl::TextRenderer2DGl() {
|
||||||
rendering= false;
|
rendering= false;
|
||||||
this->font = NULL;
|
this->font = NULL;
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// fontFTGL = new TextFTGL();
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextRenderer2DGl::~TextRenderer2DGl() {
|
TextRenderer2DGl::~TextRenderer2DGl() {
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// delete fontFTGL;
|
|
||||||
// fontFTGL = NULL;
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextRenderer2DGl::begin(Font2D *font) {
|
void TextRenderer2DGl::begin(Font2D *font) {
|
||||||
assert(!rendering);
|
assert(!rendering);
|
||||||
rendering= true;
|
|
||||||
|
|
||||||
this->font= static_cast<Font2DGl*>(font);
|
rendering = true;
|
||||||
|
this->font = static_cast<Font2DGl*>(font);
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// this->font->getMetrics()->setHeight(fontFTGL->LineHeight(" "));
|
|
||||||
// this->font->getMetrics()->setWidth(i,fontFTGL->Advance(" "));
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert a narrow string to a wide string//
|
// Convert a narrow string to a wide string//
|
||||||
|
@ -89,21 +70,20 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
const unsigned char *utext = NULL;
|
const unsigned char *utext = NULL;
|
||||||
FontMetrics *metrics = NULL;
|
FontMetrics *metrics = NULL;
|
||||||
|
|
||||||
Vec2f rasterPos;
|
//printf("font->getTextHandler() [%p] centered = %d text [%s]\n",font->getTextHandler(),centered,text.c_str());
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(font->getTextHandler() != NULL) {
|
|
||||||
//font->getTextHandler()->SetFaceSize(size);
|
|
||||||
|
|
||||||
|
Vec2f rasterPos;
|
||||||
|
if(font->getTextHandler() != NULL) {
|
||||||
if(centered) {
|
if(centered) {
|
||||||
rasterPos.x= x - font->getTextHandler()->Advance(text.c_str()) / 2.f;
|
rasterPos.x= x - font->getTextHandler()->Advance(text.c_str()) / 2.f;
|
||||||
rasterPos.y= y + font->getTextHandler()->LineHeight(text.c_str()) / 2.f;
|
rasterPos.y= y + font->getTextHandler()->LineHeight(text.c_str()) / 2.f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
|
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
|
||||||
|
rasterPos.y= y + (font->getTextHandler()->LineHeight(text.c_str()) / 8.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
utext= reinterpret_cast<const unsigned char*>(text.c_str());
|
utext= reinterpret_cast<const unsigned char*>(text.c_str());
|
||||||
metrics= font->getMetrics();
|
metrics= font->getMetrics();
|
||||||
if(centered) {
|
if(centered) {
|
||||||
|
@ -114,12 +94,9 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
|
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
glRasterPos2f(rasterPos.x, rasterPos.y);
|
glRasterPos2f(rasterPos.x, rasterPos.y);
|
||||||
|
|
||||||
if(Font::fontIsMultibyte == true) {
|
if(Font::fontIsMultibyte == true) {
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(font->getTextHandler() != NULL) {
|
if(font->getTextHandler() != NULL) {
|
||||||
//String str("資料");
|
//String str("資料");
|
||||||
//WString wstr(str);
|
//WString wstr(str);
|
||||||
|
@ -228,8 +205,6 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
|
|
||||||
//setlocale(LC_CTYPE, "en_ca.UTF-8");
|
//setlocale(LC_CTYPE, "en_ca.UTF-8");
|
||||||
|
|
||||||
//wstring wText = widen(text);
|
//wstring wText = widen(text);
|
||||||
|
@ -252,11 +227,8 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
//glListBase(font->getHandle());
|
//glListBase(font->getHandle());
|
||||||
//glCallLists(utfText.length(), GL_UNSIGNED_SHORT, &utfText[0]);
|
//glCallLists(utfText.length(), GL_UNSIGNED_SHORT, &utfText[0]);
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(font->getTextHandler() != NULL) {
|
if(font->getTextHandler() != NULL) {
|
||||||
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
||||||
font->getTextHandler()->Render(text.c_str());
|
font->getTextHandler()->Render(text.c_str());
|
||||||
|
@ -314,7 +286,6 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
for (int i=0; utext[i]!='\0'; ++i) {
|
for (int i=0; utext[i]!='\0'; ++i) {
|
||||||
switch(utext[i]){
|
switch(utext[i]){
|
||||||
case '\t':
|
case '\t':
|
||||||
|
@ -331,7 +302,6 @@ void TextRenderer2DGl::render(const string &text, int x, int y, bool centered, V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(color != NULL) {
|
if(color != NULL) {
|
||||||
|
@ -352,16 +322,9 @@ void TextRenderer2DGl::end() {
|
||||||
TextRenderer3DGl::TextRenderer3DGl() {
|
TextRenderer3DGl::TextRenderer3DGl() {
|
||||||
rendering= false;
|
rendering= false;
|
||||||
this->font = NULL;
|
this->font = NULL;
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// fontFTGL = new TextFTGL();
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextRenderer3DGl::~TextRenderer3DGl() {
|
TextRenderer3DGl::~TextRenderer3DGl() {
|
||||||
//#ifdef USE_FTGL
|
|
||||||
// delete fontFTGL;
|
|
||||||
// fontFTGL = NULL;
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextRenderer3DGl::begin(Font3D *font) {
|
void TextRenderer3DGl::begin(Font3D *font) {
|
||||||
|
@ -390,10 +353,7 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
float scale= size / 10.f;
|
float scale= size / 10.f;
|
||||||
Vec3f translatePos;
|
Vec3f translatePos;
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(font->getTextHandler() != NULL) {
|
if(font->getTextHandler() != NULL) {
|
||||||
//font->getTextHandler()->SetFaceSize(size);
|
|
||||||
|
|
||||||
if(centered) {
|
if(centered) {
|
||||||
translatePos.x = x - scale * font->getTextHandler()->Advance(text.c_str()) / 2.f;
|
translatePos.x = x - scale * font->getTextHandler()->Advance(text.c_str()) / 2.f;
|
||||||
translatePos.y = y - scale * font->getTextHandler()->LineHeight(text.c_str()) / 2.f;
|
translatePos.y = y - scale * font->getTextHandler()->LineHeight(text.c_str()) / 2.f;
|
||||||
|
@ -406,7 +366,6 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
utext= reinterpret_cast<const unsigned char*>(text.c_str());
|
utext= reinterpret_cast<const unsigned char*>(text.c_str());
|
||||||
if(centered) {
|
if(centered) {
|
||||||
FontMetrics *metrics= font->getMetrics();
|
FontMetrics *metrics= font->getMetrics();
|
||||||
|
@ -422,14 +381,11 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
translatePos.z = 0;
|
translatePos.z = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
|
|
||||||
glTranslatef(translatePos.x, translatePos.y, translatePos.z);
|
glTranslatef(translatePos.x, translatePos.y, translatePos.z);
|
||||||
glScalef(scale, scale, scale);
|
glScalef(scale, scale, scale);
|
||||||
|
|
||||||
if(Font::fontIsMultibyte == true) {
|
if(Font::fontIsMultibyte == true) {
|
||||||
|
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(font->getTextHandler() != NULL) {
|
if(font->getTextHandler() != NULL) {
|
||||||
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
||||||
font->getTextHandler()->Render(text.c_str());
|
font->getTextHandler()->Render(text.c_str());
|
||||||
|
@ -488,7 +444,6 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
//setlocale(LC_CTYPE, "en_ca.UTF-8");
|
//setlocale(LC_CTYPE, "en_ca.UTF-8");
|
||||||
|
|
||||||
//wstring wText = widen(text);
|
//wstring wText = widen(text);
|
||||||
|
@ -511,12 +466,10 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
//glListBase(font->getHandle());
|
//glListBase(font->getHandle());
|
||||||
//glCallLists(utfText.length(), GL_UNSIGNED_SHORT, &utfText[0]);
|
//glCallLists(utfText.length(), GL_UNSIGNED_SHORT, &utfText[0]);
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(font->getTextHandler() != NULL) {
|
if(font->getTextHandler() != NULL) {
|
||||||
//#ifdef USE_FTGL
|
|
||||||
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
if(text.find("\n") == text.npos && text.find("\t") == text.npos) {
|
||||||
font->getTextHandler()->Render(text.c_str());
|
font->getTextHandler()->Render(text.c_str());
|
||||||
}
|
}
|
||||||
|
@ -574,12 +527,10 @@ void TextRenderer3DGl::render(const string &text, float x, float y, float size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//#else
|
|
||||||
for (int i=0; utext[i]!='\0'; ++i) {
|
for (int i=0; utext[i]!='\0'; ++i) {
|
||||||
glCallList(font->getHandle()+utext[i]);
|
glCallList(font->getHandle()+utext[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
|
@ -35,7 +35,6 @@ namespace Shared { namespace Platform {
|
||||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
int charCount, FontMetrics &metrics) {
|
int charCount, FontMetrics &metrics) {
|
||||||
|
|
||||||
//#ifndef USE_FTGL
|
|
||||||
Display* display = glXGetCurrentDisplay();
|
Display* display = glXGetCurrentDisplay();
|
||||||
if(display == 0) {
|
if(display == 0) {
|
||||||
throw std::runtime_error("Couldn't create font: display is 0");
|
throw std::runtime_error("Couldn't create font: display is 0");
|
||||||
|
@ -146,7 +145,6 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
|
|
||||||
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
||||||
XFreeFont(display, fontInfo);
|
XFreeFont(display, fontInfo);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void createGlFontOutlines(uint32 &base, const string &type, int width,
|
void createGlFontOutlines(uint32 &base, const string &type, int width,
|
||||||
|
|
|
@ -27,7 +27,6 @@ using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Platform{
|
namespace Shared{ namespace Platform{
|
||||||
|
|
||||||
//#ifndef USE_FTGL
|
|
||||||
// ======================================
|
// ======================================
|
||||||
// Global Fcs
|
// Global Fcs
|
||||||
// ======================================
|
// ======================================
|
||||||
|
@ -40,13 +39,11 @@ int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe,
|
||||||
systemFontList->push_back((char *)lpelfe->elfFullName);
|
systemFontList->push_back((char *)lpelfe->elfFullName);
|
||||||
return 1; // I want to get all fonts
|
return 1; // I want to get all fonts
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
|
|
||||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
int charCount, FontMetrics &metrics) {
|
int charCount, FontMetrics &metrics) {
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
//#ifndef USE_FTGL
|
|
||||||
// -adecw-screen-medium-r-normal--18-180-75-75-m-160-gb2312.1980-1 this is a Chinese font
|
// -adecw-screen-medium-r-normal--18-180-75-75-m-160-gb2312.1980-1 this is a Chinese font
|
||||||
|
|
||||||
std::string useRealFontName = type;
|
std::string useRealFontName = type;
|
||||||
|
@ -173,7 +170,6 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
//}
|
//}
|
||||||
|
|
||||||
assert(err);
|
assert(err);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void createGlFontOutlines(uint32 &base, const string &type, int width,
|
void createGlFontOutlines(uint32 &base, const string &type, int width,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user