A few minor bugfixes, a little cleanup in TTF font code. Add Ubuntu font for latin languages since it generally looks better than Freesans for a game
This commit is contained in:
parent
1a58df0696
commit
6d365032f3
@ -1,9 +1,10 @@
|
|||||||
GNU FreeFont (FreeSans, FreeSansBold, FreeMono) is released under the GPLv3
|
GNU FreeFont (FreeSans, FreeSansBold, FreeMono) is released under the GPLv3
|
||||||
|
|
||||||
wqyMicroHei is released under the GPLv3 with font embedding exception and Apache-2.0 licenses
|
wqyMicroHei is released under the GPLv3 with font embedding exception and Apache-2.0 licenses
|
||||||
|
By Qianqian Fang and The WenQuanYi Project Contributors
|
||||||
By Qianqian Fang and The WenQuanYi Project Contributors
|
Copyright (C) 2008-2009 The WenQuanYi Project Board of Trustees
|
||||||
Copyright (C) 2008-2009 The WenQuanYi Project Board of Trustees
|
Copyright (C) 2007 Google Corporation
|
||||||
Copyright (C) 2007 Google Corporation
|
|
||||||
|
|
||||||
Noto Naskh Arabic UI is released under Apache-2.0 license
|
Noto Naskh Arabic UI is released under Apache-2.0 license
|
||||||
|
|
||||||
|
Ubuntu font is released under the ubuntu font license (http://font.ubuntu.com/licence/)
|
||||||
|
BIN
data/ttf/Ubuntu-B.ttf
Normal file
BIN
data/ttf/Ubuntu-B.ttf
Normal file
Binary file not shown.
BIN
data/ttf/Ubuntu-R.ttf
Normal file
BIN
data/ttf/Ubuntu-R.ttf
Normal file
Binary file not shown.
96
data/ttf/ubuntu-font-licence-1.0.txt
Normal file
96
data/ttf/ubuntu-font-licence-1.0.txt
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
-------------------------------
|
||||||
|
UBUNTU FONT LICENCE Version 1.0
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
This licence allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely. The fonts, including any derivative works, can be
|
||||||
|
bundled, embedded, and redistributed provided the terms of this licence
|
||||||
|
are met. The fonts and derivatives, however, cannot be released under
|
||||||
|
any other licence. The requirement for fonts to remain under this
|
||||||
|
licence does not require any document created using the fonts or their
|
||||||
|
derivatives to be published under this licence, as long as the primary
|
||||||
|
purpose of the document is not to be a vehicle for the distribution of
|
||||||
|
the fonts.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this licence and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components
|
||||||
|
as received under this licence.
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to
|
||||||
|
a new environment.
|
||||||
|
|
||||||
|
"Copyright Holder(s)" refers to all individuals and companies who have a
|
||||||
|
copyright ownership of the Font Software.
|
||||||
|
|
||||||
|
"Substantially Changed" refers to Modified Versions which can be easily
|
||||||
|
identified as dissimilar to the Font Software by users of the Font
|
||||||
|
Software comparing the Original Version with the Modified Version.
|
||||||
|
|
||||||
|
To "Propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification and with or without charging
|
||||||
|
a redistribution fee), making available to the public, and in some
|
||||||
|
countries other activities as well.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
This licence does not grant any rights under trademark law and all such
|
||||||
|
rights are reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of the Font Software, to propagate the Font Software, subject to
|
||||||
|
the below conditions:
|
||||||
|
|
||||||
|
1) Each copy of the Font Software must contain the above copyright
|
||||||
|
notice and this licence. These can be included either as stand-alone
|
||||||
|
text files, human-readable headers or in the appropriate machine-
|
||||||
|
readable metadata fields within text or binary files as long as those
|
||||||
|
fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
2) The font name complies with the following:
|
||||||
|
(a) The Original Version must retain its name, unmodified.
|
||||||
|
(b) Modified Versions which are Substantially Changed must be renamed to
|
||||||
|
avoid use of the name of the Original Version or similar names entirely.
|
||||||
|
(c) Modified Versions which are not Substantially Changed must be
|
||||||
|
renamed to both (i) retain the name of the Original Version and (ii) add
|
||||||
|
additional naming elements to distinguish the Modified Version from the
|
||||||
|
Original Version. The name of such Modified Versions must be the name of
|
||||||
|
the Original Version, with "derivative X" where X represents the name of
|
||||||
|
the new work, appended to that name.
|
||||||
|
|
||||||
|
3) The name(s) of the Copyright Holder(s) and any contributor to the
|
||||||
|
Font Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except (i) as required by this licence, (ii) to
|
||||||
|
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
|
||||||
|
their explicit written permission.
|
||||||
|
|
||||||
|
4) The Font Software, modified or unmodified, in part or in whole, must
|
||||||
|
be distributed entirely under this licence, and must not be distributed
|
||||||
|
under any other licence. The requirement for fonts to remain under this
|
||||||
|
licence does not affect any document created using the Font Software,
|
||||||
|
except any version of the Font Software extracted from a document
|
||||||
|
created using the Font Software may only be distributed under this
|
||||||
|
licence.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This licence becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
||||||
|
DEALINGS IN THE FONT SOFTWARE.
|
@ -35,7 +35,7 @@ FTEnvironment::FTEnvironment()
|
|||||||
|
|
||||||
FTEnvironment::~FTEnvironment()
|
FTEnvironment::~FTEnvironment()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < FONTNUM; ++i)
|
for (int i = 0; i < F_COUNT; ++i)
|
||||||
FTEnvironment::ft_err += FT_Done_Face((FTEnvironment::ft_face[i]));
|
FTEnvironment::ft_err += FT_Done_Face((FTEnvironment::ft_face[i]));
|
||||||
|
|
||||||
FTEnvironment::ft_err += FT_Done_FreeType(FTEnvironment::ft_lib);
|
FTEnvironment::ft_err += FT_Done_FreeType(FTEnvironment::ft_lib);
|
||||||
@ -48,9 +48,13 @@ FTEnvironment::~FTEnvironment()
|
|||||||
|
|
||||||
void FTEnvironment::loadFont()
|
void FTEnvironment::loadFont()
|
||||||
{
|
{
|
||||||
|
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
||||||
|
(FileManager::TTF, "Ubuntu-R.ttf", true)).c_str(),
|
||||||
|
0, &(FTEnvironment::ft_face[F_DEFAULT]));
|
||||||
|
|
||||||
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
||||||
(FileManager::TTF, "FreeSans.ttf",true)).c_str(),
|
(FileManager::TTF, "FreeSans.ttf",true)).c_str(),
|
||||||
0, &(FTEnvironment::ft_face[F_DEFAULT]));
|
0, &(FTEnvironment::ft_face[F_DEFAULT_FALLBACK]));
|
||||||
|
|
||||||
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
||||||
(FileManager::TTF, "wqy-microhei.ttf",true)).c_str(),
|
(FileManager::TTF, "wqy-microhei.ttf",true)).c_str(),
|
||||||
@ -61,15 +65,15 @@ void FTEnvironment::loadFont()
|
|||||||
0, &(FTEnvironment::ft_face[F_AR]));
|
0, &(FTEnvironment::ft_face[F_AR]));
|
||||||
|
|
||||||
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
||||||
(FileManager::TTF, "FreeSansBold.ttf",true)).c_str(),
|
(FileManager::TTF, "Ubuntu-B.ttf", true)).c_str(),
|
||||||
0, &(FTEnvironment::ft_face[F_BOLD]));
|
0, &(FTEnvironment::ft_face[F_BOLD]));
|
||||||
|
|
||||||
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked
|
||||||
(FileManager::TTF, "FreeMonoBold.ttf",true)).c_str(),
|
(FileManager::TTF, "Ubuntu-B.ttf",true)).c_str(),
|
||||||
0, &(FTEnvironment::ft_face[F_DIGIT]));
|
0, &(FTEnvironment::ft_face[F_DIGIT]));
|
||||||
|
|
||||||
//Set charmap
|
//Set charmap
|
||||||
for (int h = 0; h < FONTNUM; ++h)
|
for (int h = 0; h < F_COUNT; ++h)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < FTEnvironment::ft_face[h]->num_charmaps; ++i)
|
for (int i = 0; i < FTEnvironment::ft_face[h]->num_charmaps; ++i)
|
||||||
{
|
{
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
|
#include "guiengine/get_font_properties.hpp"
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
#define FONTNUM 5
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup guiengine
|
* \ingroup guiengine
|
||||||
*/
|
*/
|
||||||
@ -33,7 +32,7 @@ namespace GUIEngine
|
|||||||
public:
|
public:
|
||||||
FTEnvironment();
|
FTEnvironment();
|
||||||
~FTEnvironment();
|
~FTEnvironment();
|
||||||
FT_Face ft_face[FONTNUM];
|
FT_Face ft_face[irr::gui::F_COUNT];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Load font face into memory, but don't create glyph yet.
|
/** Load font face into memory, but don't create glyph yet.
|
||||||
|
@ -78,10 +78,10 @@ void getFontProperties::loadChar(const core::stringc langname, FontUse& fu, floa
|
|||||||
usedchar.insert((wchar_t)215); //Used on resolution selection screen (X).
|
usedchar.insert((wchar_t)215); //Used on resolution selection screen (X).
|
||||||
|
|
||||||
//There's specific handling for some language, we may need more after more translation are added or problems found out.
|
//There's specific handling for some language, we may need more after more translation are added or problems found out.
|
||||||
if (langname == "el" || langname == "fr" || langname == "gd")
|
//if (langname == "el" || langname == "fr" || langname == "gd")
|
||||||
size = (int)(27*scale); //Lower scale for them as they're space-consuming.
|
size = (int)(27*scale); //Lower scale for them as they're space-consuming.
|
||||||
else
|
//else
|
||||||
size = (int)(29*scale); //Set to default size
|
// size = (int)(29*scale); //Set to default size
|
||||||
}
|
}
|
||||||
|
|
||||||
void getFontProperties::loadNumber(float scale)
|
void getFontProperties::loadNumber(float scale)
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#ifndef HEADER_GET_FONT_PROPERTIES_HPP
|
||||||
|
#define HEADER_GET_FONT_PROPERTIES_HPP
|
||||||
|
|
||||||
#include <irrlicht.h>
|
#include <irrlicht.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@ -23,7 +26,16 @@ namespace irr
|
|||||||
namespace gui
|
namespace gui
|
||||||
{
|
{
|
||||||
|
|
||||||
enum FontUse {F_DEFAULT, F_CJK, F_AR, F_BOLD, F_DIGIT};
|
enum FontUse
|
||||||
|
{
|
||||||
|
F_DEFAULT = 0,
|
||||||
|
F_DEFAULT_FALLBACK = 1,
|
||||||
|
F_CJK = 2,
|
||||||
|
F_AR = 3,
|
||||||
|
F_BOLD = 4,
|
||||||
|
F_DIGIT = 5,
|
||||||
|
F_COUNT = 6
|
||||||
|
};
|
||||||
|
|
||||||
enum TTFLoadingType {T_NORMAL, T_DIGIT, T_BOLD};
|
enum TTFLoadingType {T_NORMAL, T_DIGIT, T_BOLD};
|
||||||
|
|
||||||
@ -57,3 +69,5 @@ private:
|
|||||||
|
|
||||||
} // end namespace gui
|
} // end namespace gui
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -599,7 +599,7 @@ bool ScalableFont::lazyLoadChar()
|
|||||||
//Lite-Fontconfig for stk
|
//Lite-Fontconfig for stk
|
||||||
int idx;
|
int idx;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (count < FONTNUM - 2) //Exclude bold and digit font
|
while (count < irr::gui::F_COUNT - 2) //Exclude bold and digit font
|
||||||
{
|
{
|
||||||
m_font_use = (FontUse)count;
|
m_font_use = (FontUse)count;
|
||||||
err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi);
|
err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user