Update license, fixes for harfbuzz

This commit is contained in:
Joshua Granick
2014-08-04 11:03:56 -07:00
parent 35b8ffc87a
commit 850ce2f269
6 changed files with 145 additions and 127 deletions

2
.gitmodules vendored
View File

@@ -30,4 +30,4 @@
url = https://github.com/native-toolkit/freetype
[submodule "project/lib/harfbuzz"]
path = project/lib/harfbuzz
url = https://github.com/MattTuttle/harfbuzz
url = https://github.com/native-toolkit/harfbuzz

View File

@@ -3,22 +3,40 @@ License
The MIT License (MIT)
Copyright (c) 2007-2014 OpenFL Technologies, LLC, underscorediscovery and contributors
Copyright (c) 2013-2014 OpenFL Technologies and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-------
Portions of other MIT-license projects are also used, including content that is
Copyright (c) 2007-2014 NME contributors
Copyright (c) 2013-2014 Mathew Groves
Copyright (c) 2013-2014 James Simpson and GoldFire Studios, Inc.
-------
Native dependencies include unrestrictive licenses, such as the Zlib, MIT, or BSD
license. The full text of each license is included in each sub-repository. The
notable exception is OpenAL Soft, which is LGPL-licensed.
When Lime is compiled to a shared binary, the LGPL "copy-left" clause will apply
to Lime's C++ source-code, but not to other aspects of a project. When Lime
is statically linked to project code, OpenAL Soft is not included.

View File

@@ -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,39 +93,18 @@ namespace lime {
}
value lime_image_load (value data) {
ImageBuffer imageBuffer;
Resource resource;
if (val_is_string (data)) {
resource = Resource (val_string (data));
} else {
ByteArray bytes (data);
resource = Resource (&bytes);
}
#ifdef LIME_PNG
if (PNG::Decode (&resource, &imageBuffer)) {
return imageBuffer.Value ();
}
#endif
#ifdef LIME_JPEG
if (JPEG::Decode (&resource, &imageBuffer)) {
return imageBuffer.Value ();
}
#endif
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
}
@@ -179,54 +158,39 @@ namespace lime {
}
value lime_font_create_image (value fontHandle) {
value lime_image_load (value data) {
#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 ();
ImageBuffer imageBuffer;
Resource resource;
if (val_is_string (data)) {
resource = Resource (val_string (data));
} else {
ByteArray bytes (data);
resource = Resource (&bytes);
}
#ifdef LIME_PNG
if (PNG::Decode (&resource, &imageBuffer)) {
return imageBuffer.Value ();
}
#endif
}
#ifdef LIME_JPEG
if (JPEG::Decode (&resource, &imageBuffer)) {
return imageBuffer.Value ();
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
}
@@ -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);