From 850ce2f269a02a4ca30218e6d471fc10325082d8 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 4 Aug 2014 11:03:56 -0700 Subject: [PATCH] Update license, fixes for harfbuzz --- .gitmodules | 2 +- LICENSE.md | 44 ++++-- project/Build.xml | 8 +- project/lib/harfbuzz | 2 +- project/lib/png | 2 +- project/src/ExternalInterface.cpp | 214 +++++++++++++++--------------- 6 files changed, 145 insertions(+), 127 deletions(-) diff --git a/.gitmodules b/.gitmodules index adce07b4c..ecb89c509 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/LICENSE.md b/LICENSE.md index 8f955fd75..e5c9851f1 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/project/Build.xml b/project/Build.xml index 9dd99fc40..1dce92c8b 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -50,14 +50,14 @@
- + - + - +
- +
diff --git a/project/lib/harfbuzz b/project/lib/harfbuzz index 036bc344b..d00933177 160000 --- a/project/lib/harfbuzz +++ b/project/lib/harfbuzz @@ -1 +1 @@ -Subproject commit 036bc344b456ac28ee962ae15b67b81338db16b1 +Subproject commit d0093317735aa7e411fc335cdce89ad0ae28da6e diff --git a/project/lib/png b/project/lib/png index 456bc0cf6..3f1fe354b 160000 --- a/project/lib/png +++ b/project/lib/png @@ -1 +1 @@ -Subproject commit 456bc0cf64305b5394e9c65dfc5a7a8f2afb6045 +Subproject commit 3f1fe354bc7939d6e44fb775c86470ca410a7673 diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index bfaac0ea2..8f526080d 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -18,7 +18,7 @@ #include #ifdef LIME_HARFBUZZ #include -#endif // LIME_HARFBUZZ +#endif #include #include #include @@ -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; -} +} \ No newline at end of file