Finalized DynamicFont implementation

-DynamicFont uses Freetype by default
-Editor fonts are now scalable thanks to this
-Cleaned up documentation browser and added fonts for this
This commit is contained in:
Juan Linietsky 2016-05-29 11:37:26 -03:00
parent a5777994cb
commit 3e8eb396d7
511 changed files with 3798 additions and 210 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ tools/editor/doc_data_compressed.h
tools/editor/certs_compressed.h
tools/editor/editor_icons.cpp
tools/editor/translations.h
tools/editor/builtin_fonts.h
-fpic
.fscache
make.bat

2636
core/hq2x.cpp Normal file

File diff suppressed because it is too large Load Diff

19
core/hq2x.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef HQ2X_H
#define HQ2X_H
#include "typedefs.h"
uint32_t *hq2x_resize(
const uint32_t *image,
uint32_t width,
uint32_t height,
uint32_t *output,
uint32_t trY = 0x30,
uint32_t trU = 0x07,
uint32_t trV = 0x06,
uint32_t trA = 0x50,
bool wrapX = false,
bool wrapY = false );
#endif // HQ2X_H

View File

@ -30,7 +30,7 @@
#include "hash_map.h"
#include "core/io/image_loader.h"
#include "core/os/copymem.h"
#include "hq2x.h"
#include "print_string.h"
#include <stdio.h>
@ -901,6 +901,44 @@ static void _generate_po2_mipmap(const uint8_t* p_src, uint8_t* p_dst, uint32_t
}
void Image::expand_x2_hq2x() {
ERR_FAIL_COND(format>=FORMAT_INDEXED);
Format current = format;
bool mipmaps=get_mipmaps();
if (mipmaps) {
clear_mipmaps();
}
if (current!=FORMAT_RGBA)
convert(FORMAT_RGBA);
DVector<uint8_t> dest;
dest.resize(width*2*height*2*4);
{
DVector<uint8_t>::Read r = data.read();
DVector<uint8_t>::Write w = dest.write();
hq2x_resize((const uint32_t*)r.ptr(),width,height,(uint32_t*)w.ptr());
}
width*=2;
height*=2;
data=dest;
if (current!=FORMAT_RGBA)
convert(current);
if (mipmaps) {
generate_mipmaps();
}
}
void Image::shrink_x2() {
ERR_FAIL_COND(format==FORMAT_INDEXED || format==FORMAT_INDEXED_ALPHA);

View File

@ -250,6 +250,7 @@ public:
void resize( int p_width, int p_height, Interpolation p_interpolation=INTERPOLATE_BILINEAR );
Image resized( int p_width, int p_height, int p_interpolation=INTERPOLATE_BILINEAR );
void shrink_x2();
void expand_x2_hq2x();
/**
* Crop the image to a specific size, if larger, then the image is filled by black
*/

View File

@ -59,6 +59,8 @@ if (env['musepack']=='yes'):
SConscript("mpc/SCsub");
if (env["squish"]=="yes" and env["tools"]=="yes"):
SConscript("squish/SCsub");
if (env["freetype"]!="no"):
SConscript("freetype/SCsub");
num = 0
cur_base = ""

View File

@ -66,4 +66,6 @@ if (env["freetype"]=="builtin"):
# lib = env.Library("freetype_builtin",ft_sources)
# env.Prepend(LIBS=[lib])
Export('env')

Some files were not shown because too many files have changed in this diff Show More