Update license, fixes for harfbuzz
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
#include <graphics/Font.h>
|
||||
#ifdef LIME_HARFBUZZ
|
||||
#include <graphics/Text.h>
|
||||
#endif // LIME_HARFBUZZ
|
||||
#endif
|
||||
#include <graphics/ImageBuffer.h>
|
||||
#include <graphics/Renderer.h>
|
||||
#include <graphics/RenderEvent.h>
|
||||
@@ -93,6 +93,71 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_font_create_image (value fontHandle) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
ImageBuffer image;
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
value data = alloc_empty_object ();
|
||||
alloc_field (data, val_id ("glyphs"), font->RenderToImage (&image));
|
||||
alloc_field (data, val_id ("image"), image.Value ());
|
||||
return data;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_font_destroy (value fontHandle) {
|
||||
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
delete font;
|
||||
font = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load (value fontFace) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = new Font (val_string (fontFace));
|
||||
value v = alloc_float ((intptr_t)font);
|
||||
val_gc (v, lime_font_destroy);
|
||||
return v;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load_glyphs (value fontHandle, value size, value glyphs) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
font->SetSize (val_int (size));
|
||||
font->LoadGlyphs (val_string (glyphs));
|
||||
#endif
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load_range (value fontHandle, value size, value start, value end) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
font->SetSize (val_int (size));
|
||||
font->LoadRange (val_int (start), val_int (end));
|
||||
#endif
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_image_load (value data) {
|
||||
|
||||
ImageBuffer imageBuffer;
|
||||
@@ -130,107 +195,6 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_font_destroy (value fontHandle) {
|
||||
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
delete font;
|
||||
font = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load (value fontFace) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = new Font (val_string (fontFace));
|
||||
value v = alloc_float ((intptr_t)font);
|
||||
val_gc (v, lime_font_destroy);
|
||||
return v;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load_glyphs (value fontHandle, value size, value glyphs) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
font->SetSize (val_int (size));
|
||||
font->LoadGlyphs (val_string (glyphs));
|
||||
#endif
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_load_range (value fontHandle, value size, value start, value end) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
font->SetSize (val_int (size));
|
||||
font->LoadRange (val_int (start), val_int (end));
|
||||
#endif
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_font_create_image (value fontHandle) {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
ImageBuffer image;
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
value data = alloc_empty_object ();
|
||||
alloc_field (data, val_id ("glyphs"), font->RenderToImage (&image));
|
||||
alloc_field (data, val_id ("image"), image.Value ());
|
||||
return data;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_text_destroy (value textHandle) {
|
||||
|
||||
Text *text = (Text*)(intptr_t)val_float (textHandle);
|
||||
delete text;
|
||||
text = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_text_create (value direction, value script, value language) {
|
||||
|
||||
#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
|
||||
Text *text = new Text (val_int (direction), val_string (script), val_string (language));
|
||||
value v = alloc_float ((intptr_t)text);
|
||||
val_gc (v, lime_text_destroy);
|
||||
return v;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_text_from_string (value textHandle, value fontHandle, value size, value textString) {
|
||||
|
||||
#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
|
||||
Text *text = (Text*)(intptr_t)val_float (textHandle);
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
return text->FromString(font, val_int (size), val_string (textString));
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_key_event_manager_register (value callback, value eventObject) {
|
||||
|
||||
KeyEvent::callback = new AutoGCRoot (callback);
|
||||
@@ -317,6 +281,42 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_text_destroy (value textHandle) {
|
||||
|
||||
Text *text = (Text*)(intptr_t)val_float (textHandle);
|
||||
delete text;
|
||||
text = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_text_create (value direction, value script, value language) {
|
||||
|
||||
#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
|
||||
Text *text = new Text (val_int (direction), val_string (script), val_string (language));
|
||||
value v = alloc_float ((intptr_t)text);
|
||||
val_gc (v, lime_text_destroy);
|
||||
return v;
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_text_from_string (value textHandle, value fontHandle, value size, value textString) {
|
||||
|
||||
#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
|
||||
Text *text = (Text*)(intptr_t)val_float (textHandle);
|
||||
Font *font = (Font*)(intptr_t)val_float (fontHandle);
|
||||
return text->FromString(font, val_int (size), val_string (textString));
|
||||
#else
|
||||
return alloc_null ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_touch_event_manager_register (value callback, value eventObject) {
|
||||
|
||||
TouchEvent::callback = new AutoGCRoot (callback);
|
||||
@@ -374,13 +374,11 @@ namespace lime {
|
||||
DEFINE_PRIM (lime_application_exec, 1);
|
||||
DEFINE_PRIM (lime_application_get_ticks, 0);
|
||||
DEFINE_PRIM (lime_audio_load, 1);
|
||||
DEFINE_PRIM (lime_image_load, 1);
|
||||
DEFINE_PRIM (lime_font_create_image, 1);
|
||||
DEFINE_PRIM (lime_font_load, 1);
|
||||
DEFINE_PRIM (lime_font_load_glyphs, 3);
|
||||
DEFINE_PRIM (lime_font_load_range, 4);
|
||||
DEFINE_PRIM (lime_font_create_image, 1);
|
||||
DEFINE_PRIM (lime_text_create, 3);
|
||||
DEFINE_PRIM (lime_text_from_string, 4);
|
||||
DEFINE_PRIM (lime_image_load, 1);
|
||||
DEFINE_PRIM (lime_key_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_lzma_encode, 1);
|
||||
DEFINE_PRIM (lime_lzma_decode, 1);
|
||||
@@ -390,6 +388,8 @@ namespace lime {
|
||||
DEFINE_PRIM (lime_renderer_flip, 1);
|
||||
DEFINE_PRIM (lime_render_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_system_get_timestamp, 0);
|
||||
DEFINE_PRIM (lime_text_create, 3);
|
||||
DEFINE_PRIM (lime_text_from_string, 4);
|
||||
DEFINE_PRIM (lime_touch_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_update_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_window_create, 5);
|
||||
@@ -405,4 +405,4 @@ extern "C" int lime_register_prims () {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user