Guard Freetype reference

This commit is contained in:
Joshua Granick
2014-07-15 22:42:20 -07:00
parent 22fa6ced55
commit de9260a619
4 changed files with 24 additions and 8 deletions

View File

@@ -7,8 +7,6 @@
<section unless="display">
<haxelib name="format" if="native" />
<haxelib name="hxcpp" if="cpp" />
<ndll name="std" haxelib="hxcpp" if="cpp" />
@@ -34,8 +32,11 @@
<architecture name="armv7" if="android" />
<include haxelib="lime-tools" unless="openfl" />
<haxelib name="lime-tools" if="setup" />
<include haxelib="aether" unless="openfl" />
<haxelib name="aether" if="setup" />
<target name="wiiu" handler="lime-wiiu" />
<haxelib name="lime-wiiu" if="wiiu" />
</section>

View File

@@ -41,13 +41,14 @@
<section if="LIME_FREETYPE">
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/freetype/include" />
<compilerflag value="-DLIME_FREETYPE" />
</section>
<section if="LIME_NEKO">
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/neko/vm/" />
<compilerflag value="-DLIME_NEKO" if="LIME_NEKO" />
<compilerflag value="-DLIME_NEKO" />
<file name="src/vm/NekoVM.cpp" />

View File

@@ -10,7 +10,9 @@
#include <hx/CFFI.h>
#include <app/Application.h>
#include <app/UpdateEvent.h>
#ifdef LIME_FREETYPE
#include <graphics/Font.h>
#endif
#include <graphics/Image.h>
#include <graphics/PNG.h>
#include <graphics/JPEG.h>
@@ -75,22 +77,30 @@ namespace lime {
value lime_font_load (value fontFace) {
#ifdef LIME_FREETYPE
Font *font = new Font (val_string (fontFace));
return alloc_float ((intptr_t)font);
#else
return alloc_null ();
#endif
}
value lime_font_load_glyphs (value fontHandle, value size, value glyphs) {
#ifdef LIME_FREETYPE
Image image;
Font *font = (Font*)(intptr_t)val_float (fontHandle);
value data = alloc_empty_object ();
alloc_field (data, val_id ("glyphs"), font->LoadGlyphs (val_int (size), val_string (glyphs), &image));
alloc_field (data, val_id ("image"), image.Value ());
return data;
#else
return alloc_null ();
#endif
}

View File

@@ -1,4 +1,7 @@
#include <graphics/Font.h>
#include <ft2build.h>
#include FT_FREETYPE_H
typedef struct {
@@ -8,6 +11,7 @@ typedef struct {
} GlyphInfo;
namespace lime {