From: Paul Wisbey Date: Fri, 20 Mar 2015 17:04:31 +0000 (+0000) Subject: Merge remote-tracking branch 'origin/tizen' into new_text X-Git-Tag: dali_1.0.38~11^2~39 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=3e17d9f63dedb5d669409301f8d9a3d8c393f979 Merge remote-tracking branch 'origin/tizen' into new_text Conflicts: build/tizen/configure.ac Change-Id: Id18adef88fdd0edca9ccb6a1225ab4def1bedf32 --- 3e17d9f63dedb5d669409301f8d9a3d8c393f979 diff --cc build/tizen/configure.ac index 7a90b2a,1e94aa3..006e192 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@@ -85,10 -90,33 +89,37 @@@ els dataReadOnlyDir=${prefix}/share/dali/ fi +DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDALI_PROFILE_${enable_profile}" +AM_CONDITIONAL([COMMON_PROFILE], [test x$enable_profile = xCOMMON]) +AM_CONDITIONAL([MOBILE_PROFILE], [test x$enable_profile = xMOBILE]) + + # v8 version 4+ requires c++11 + PKG_CHECK_MODULES(V8, v8 = 3.32.7, [ pkg_check_v8=yes ], [ pkg_check_v8=no ] ) + + # Rules for building JavaScript plugin + # If enable_javascript=yes and v8 installed = build javascript + # If enable_javascript=automatic and v8 installed = build javascript + # If enable_javascript=yes and v8 not installed = throw an error + build_javascript_plugin=no + if test x$enable_javascript = xyes; then + if test x$pkg_check_v8 = xno; then + [build_javascript_plugin=no] + AC_MSG_ERROR("V8 not found or incorrect version installed") + AC_MSG_NOTICE("To disable building of JavaScript plugin use --disable-javascript") + else + [build_javascript_plugin=yes] + AC_MSG_NOTICE(V8 library found. Building DALi JavaScript plugin) + fi + fi + if test x$enable_javascript = xautomatic && test x$pkg_check_v8 = xyes; then + [build_javascript_plugin=yes] + AC_MSG_NOTICE( V8 library found. Automatic building of JavaScript plugin. Use use --disable-javascript to disable) + fi + + + #set a variable for the makefile to force compile the JAvaSplugin + AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$build_javascript_plugin = xyes]) + AC_SUBST(dataReadWriteDir) AC_SUBST(dataReadOnlyDir) AC_SUBST(DALI_TOOLKIT_CFLAGS) diff --cc plugins/dali-script-v8/file.list index 13300ef,13300ef..ef35cf9 --- a/plugins/dali-script-v8/file.list +++ b/plugins/dali-script-v8/file.list @@@ -12,14 -12,14 +12,11 @@@ script_v8_plugin_src_files = $(v8_plugin_dir)/actors/actor-wrapper.cpp \ $(v8_plugin_dir)/actors/actor-api.cpp \ $(v8_plugin_dir)/actors/layer-api.cpp \ -- $(v8_plugin_dir)/actors/text-actor-api.cpp \ $(v8_plugin_dir)/actors/image-actor-api.cpp \ $(v8_plugin_dir)/actors/camera-actor-api.cpp \ $(v8_plugin_dir)/actors/mesh-actor-api.cpp \ $(v8_plugin_dir)/actors/renderable-actor-api.cpp \ $(v8_plugin_dir)/constants/constants-wrapper.cpp \ -- $(v8_plugin_dir)/text/font-api.cpp \ -- $(v8_plugin_dir)/text/font-wrapper.cpp \ $(v8_plugin_dir)/animation/animation-api.cpp \ $(v8_plugin_dir)/animation/animation-wrapper.cpp \ $(v8_plugin_dir)/animation/path-api.cpp \ diff --cc plugins/dali-script-v8/src/actors/actor-api.cpp index 4027a1b,d068554..c169b2a --- a/plugins/dali-script-v8/src/actors/actor-api.cpp +++ b/plugins/dali-script-v8/src/actors/actor-api.cpp @@@ -19,7 -19,7 +19,7 @@@ #include "actor-api.h" // EXTERNAL INCLUDES --#include ++#include // INTERNAL INCLUDES #include @@@ -41,11 -41,11 +41,11 @@@ Actor GetActor( v8::Isolate* isolate, c } //unanmed namespace --namespace TextViewApi ++namespace TextLabelApi { Actor New( const v8::FunctionCallbackInfo< v8::Value >& args ) { -- return Dali::Toolkit::TextView::New(); ++ return Dali::Toolkit::TextLabel::New(); } } @@@ -485,7 -485,7 +485,7 @@@ void ActorApi::IsKeyboardFocusable( con * * @for Actor * @method getActorType -- * @return {String} Actor, ImageActor, TextActor, MeshActor, Layer, CameraActor ... ++ * @return {String} Actor, ImageActor, MeshActor, Layer, CameraActor ... */ void ActorApi::GetActorType( const v8::FunctionCallbackInfo& args ) { diff --cc plugins/dali-script-v8/src/actors/actor-api.h index 9d1bb16,9d1bb16..8543f11 --- a/plugins/dali-script-v8/src/actors/actor-api.h +++ b/plugins/dali-script-v8/src/actors/actor-api.h @@@ -28,7 -28,7 +28,7 @@@ namespace Dal namespace V8Plugin { --namespace TextViewApi ++namespace TextLabelApi { /** * Temporary TextView constructor diff --cc plugins/dali-script-v8/src/actors/actor-wrapper.cpp index 6f2d6f0,6f2d6f0..5916dd2 --- a/plugins/dali-script-v8/src/actors/actor-wrapper.cpp +++ b/plugins/dali-script-v8/src/actors/actor-wrapper.cpp @@@ -25,7 -25,7 +25,6 @@@ #include #include #include --#include #include #include #include @@@ -40,11 -40,11 +39,10 @@@ namespace V8Plugi v8::Persistent ActorWrapper::mActorTemplate; v8::Persistent ActorWrapper::mImageActorTemplate; --v8::Persistent ActorWrapper::mTextActorTemplate; v8::Persistent ActorWrapper::mMeshActorTemplate; v8::Persistent ActorWrapper::mCameraActorTemplate; v8::Persistent ActorWrapper::mLayerActorTemplate; --v8::Persistent ActorWrapper::mTextViewTemplate; ++v8::Persistent ActorWrapper::mTextLabelTemplate; namespace { @@@ -65,11 -65,11 +63,10 @@@ const ActorTemplate ActorTemplateLookup { { &ActorWrapper::mActorTemplate }, // ACTOR { &ActorWrapper::mImageActorTemplate }, // IMAGE_ACTOR -- { &ActorWrapper::mTextActorTemplate }, // TEXT_ACTOR { &ActorWrapper::mMeshActorTemplate }, // MESH_ACTOR { &ActorWrapper::mLayerActorTemplate }, // LAYER_ACTOR { &ActorWrapper::mCameraActorTemplate}, // CAMERA_ACTOR -- { &ActorWrapper::mTextViewTemplate } ++ { &ActorWrapper::mTextLabelTemplate } }; /** @@@ -80,10 -80,10 +77,9 @@@ enum ActorApiBitMas ACTOR_API = 1 << 0, RENDERABLE_ACTOR_API = 1 << 1, IMAGE_ACTOR_API = 1 << 2, -- TEXT_ACTOR_API = 1 << 3, -- MESH_ACTOR_API = 1 << 4, -- LAYER_API = 1 << 5, -- CAMERA_ACTOR_API = 1 << 6, ++ MESH_ACTOR_API = 1 << 3, ++ LAYER_API = 1 << 4, ++ CAMERA_ACTOR_API = 1 << 5, }; /** @@@ -104,11 -104,11 +100,10 @@@ const ActorApiStruct ActorApiLookup[] { {"Actor", ActorWrapper::ACTOR, ActorApi::New, ACTOR_API }, {"ImageActor", ActorWrapper::IMAGE_ACTOR, ImageActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | IMAGE_ACTOR_API }, -- {"TextActor", ActorWrapper::TEXT_ACTOR, TextActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | TEXT_ACTOR_API }, {"MeshActor", ActorWrapper::MESH_ACTOR, MeshActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | MESH_ACTOR_API }, {"Layer", ActorWrapper::LAYER_ACTOR, LayerApi::New, ACTOR_API | LAYER_API }, {"CameraActor",ActorWrapper::CAMERA_ACTOR, CameraActorApi::New, ACTOR_API | CAMERA_ACTOR_API }, -- {"TextView", ActorWrapper::TEXT_VIEW, TextViewApi::New, ACTOR_API }, ++ {"TextLabel", ActorWrapper::TEXT_LABEL, TextLabelApi::New, ACTOR_API }, }; @@@ -148,7 -148,7 +143,7 @@@ Actor CreateActor( const v8::FunctionCa else { // run the constructor for this type of actor so it can pull out -- // custom parameters, e.g. new TextActor("hello world"); or ImageActor( MyImage ); ++ // custom parameters, e.g. new ImageActor( MyImage ); actor = (ActorApiLookup[actorType].constructor)( args ); } return actor; @@@ -312,40 -312,40 +307,6 @@@ const ActorFunctions ActorFunctionTable // ignore GetFadeInDuration use imageActor.fadeInDuration //{ "GetCurrentImageSize", ImageActorApi::GetCurrentImageSize, IMAGE_ACTOR_API }, -- -- /************************************** -- * Text Actor API (in order of text-actor.h) -- **************************************/ -- //ignore SetText use textActor.text -- { "SetToNaturalSize", TextActorApi::SetToNaturalSize, TEXT_ACTOR_API }, -- // ignore GetFont use textActor.font -- // ignore SetFont use textActor.font -- // ignore SetGradient use textActor.gradientColor -- // ignore GetGradient textActor.gradientColor -- // ignore SetGradientStartPoint use textActor.gradientStartPoint -- // ignore GetGradientStartPoint textActor.gradientStartPoint -- // ignore SetGradientEndPoint use textActor.gradientEndPoint -- // ignore GetGradientEndPoint textActor.gradientEndPoint -- // @todo? SetTextStyle ( can use individual properties as a work around ) -- // @todo? GetTextStyle ( can use individual properties as a work around ) -- // ignore SetTextColor use textActor.textColor -- // ignore GetTextColor use textActor.textColor -- // ignore SetSmoothEdge use textActor.smoothEdge -- // ignore SetOutline use textActor.outLineEnable, outlineColor, thicknessWidth -- // ignore SetGlow use textActor.glowEnable, glowColor, glowIntensity -- // ignore SetShadow use textActor.shadowEnable, shadowColor, shadowOffset, shadowSize -- // ignore SetItalics use textActor.italicsAngle ? -- // ignore GetItalics @todo add italics flag? or just stick with angle -- // ignore GetItalicsAngle use textActor.italicsAngle -- // ignore SetUnderline use textActor.underline -- // ignore GetUnderline use textActor.underline -- // ignore SetWeight use textActor.weight -- // ignore GetWeight use textActor.weight -- // ignore SetFontDetectionAutomatic use textActor.fontDetectionAutomatic -- // ignore IsFontDetectionAutomatic use textActor.fontDetectionAutomatic -- // ignore GetLoadingState text is loaded synchronously -- // ignore TextAvailableSignal text is loaded synchronously -- /************************************** * Mesh Actor API (in order of mesh-actor.h) **************************************/ @@@ -487,7 -487,7 +448,7 @@@ void ActorWrapper::NewActor( const v8:: return; } -- // find out the callee function name...e.g. TextActor, ImageActor, MeshActor ++ // find out the callee function name...e.g. ImageActor, MeshActor v8::Local callee = args.Callee(); v8::Local v8String = callee->GetName(); std::string typeName = V8Utils::v8StringToStdString( v8String ); diff --cc plugins/dali-script-v8/src/actors/actor-wrapper.h index 79381ba,79381ba..ab6999b --- a/plugins/dali-script-v8/src/actors/actor-wrapper.h +++ b/plugins/dali-script-v8/src/actors/actor-wrapper.h @@@ -48,12 -48,12 +48,11 @@@ public UNKNOWN_ACTOR = -1, ACTOR = 0, IMAGE_ACTOR =1, -- TEXT_ACTOR =2, -- MESH_ACTOR =3, -- LAYER_ACTOR =4, -- CAMERA_ACTOR =5, -- LIGHT_ACTOR =6, -- TEXT_VIEW =7 ++ MESH_ACTOR =2, ++ LAYER_ACTOR =3, ++ CAMERA_ACTOR =4, ++ LIGHT_ACTOR =5, ++ TEXT_LABEL =6 }; /** @@@ -91,11 -91,11 +90,10 @@@ // The Actor ObjectTemplates. static v8::Persistent mActorTemplate; static v8::Persistent mImageActorTemplate; -- static v8::Persistent mTextActorTemplate; static v8::Persistent mMeshActorTemplate; static v8::Persistent mCameraActorTemplate; static v8::Persistent mLayerActorTemplate; -- static v8::Persistent mTextViewTemplate; ++ static v8::Persistent mTextLabelTemplate; /** * @return the wrapped actor diff --cc plugins/dali-script-v8/src/actors/text-actor-api.cpp index 483b345,483b345..0000000 deleted file mode 100644,100644 --- a/plugins/dali-script-v8/src/actors/text-actor-api.cpp +++ /dev/null @@@ -1,164 -1,164 +1,0 @@@ --/* -- * Copyright (c) 2015 Samsung Electronics Co., Ltd. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- * -- */ -- --// CLASS HEADER --#include "text-actor-api.h" -- --// EXTERNAL INCLUDES --#include -- --// INTERNAL INCLUDES --#include --#include --#include --#include -- -- --namespace Dali --{ -- --namespace V8Plugin --{ -- --namespace //unnamed name space --{ -- --struct TextActorParametersInternal --{ -- TextActorParametersInternal() -- : fontDetection( true ) -- { -- } -- bool fontDetection; -- Font font; --}; -- -- --TextActor GetTextActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() ); -- return TextActor::DownCast( handleWrapper->mHandle ); --} -- -- --void GetTextOptions( v8::Isolate* isolate, -- v8::Local options, -- TextActorParametersInternal& textParams ) --{ -- // fontDetection: true / false ( default true) -- // font: dali font object -- v8::HandleScope handleScope( isolate ); -- -- if( options->IsObject() ) -- { -- v8::Local obj = options->ToObject(); -- -- v8::Local fontDetect = obj->Get( v8::String::NewFromUtf8( isolate, "fontDetection" ) ); -- if( fontDetect->IsBoolean() ) -- { -- -- textParams.fontDetection = fontDetect->ToBoolean()->Value(); -- } -- -- v8::Local fontValue = obj->Get( v8::String::NewFromUtf8( isolate, "font" ) ); -- if( fontValue->IsObject() ) -- { -- textParams.font = FontApi::GetFont( isolate, fontValue ); -- } -- -- } --} -- --} -- --/** -- * @constructor -- * @for TextActor -- * @method TextActor -- * @param {String} text -- * @param {Object} [textOptions] data -- * Options text options struct -- * @param {Boolean} [textOptions.fontDetection] -- * if true the fontDetection is used to make sure the text is displayed. -- * E.g. if the current font used by the text-actor does not support certain characters -- * it will find a new font that does. Default = true. -- * @param {Object} [textOptions.font] -- * Dali font object -- * @return {Object} TextActor -- */ --Actor TextActorApi::New( const v8::FunctionCallbackInfo& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- // -- // TextActor( text, options (optional) ) -- // -- // options = -- // { -- // font: font -- // fontDetection: true / false ( default true) -- // } -- -- // get the text (if passed in) -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- -- TextActorParametersInternal params; -- TextActor actor; -- -- GetTextOptions( isolate, args[1], params ); -- -- TextStyle style; -- -- if( params.font ) -- { -- style.SetFontName( params.font.GetName() ); -- style.SetFontStyle( params.font.GetStyle() ); -- style.SetFontPointSize( PointSize(params.font.GetPointSize())); -- -- } -- TextActorParameters textActorParameters( style, params.fontDetection? TextActorParameters::FONT_DETECTION_OFF:TextActorParameters::FONT_DETECTION_ON ); -- -- actor = TextActor::New( text, textActorParameters ); -- -- return actor; -- --} -- --/** -- * Set text to the natural size of the text string. -- * -- * After this method the text actor always uses the natural size of the text -- * when SetText is called unless SetSize is called to override the size. -- * -- * @for TextActor -- * @method setToNaturalSize -- */ --void TextActorApi::SetToNaturalSize( const v8::FunctionCallbackInfo& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- TextActor textActor = GetTextActor( isolate, args ); -- textActor.SetToNaturalSize(); --} -- --} // namespace V8Plugin -- --} // namespace Dali diff --cc plugins/dali-script-v8/src/dali-wrapper.cpp index 55df482,1bb2dfc..20fa9f6 --- a/plugins/dali-script-v8/src/dali-wrapper.cpp +++ b/plugins/dali-script-v8/src/dali-wrapper.cpp @@@ -26,7 -26,7 +26,6 @@@ #include #include #include --#include #include #include #include @@@ -59,7 -59,7 +58,6 @@@ const ApiFunction ConstructorFunctionTa { { "Rotation", PropertyValueWrapper::NewRotation}, { "Matrix", PropertyValueWrapper::NewMatrix}, -- { "Font", FontWrapper::NewFont }, { "Path", PathWrapper::NewPath }, { "Actor", ActorWrapper::NewActor }, { "TextActor", ActorWrapper::NewActor }, @@@ -214,10 -220,10 +218,6 @@@ void DaliWrapper::Initialize( v8::Local stageObject = StageWrapper::WrapStage( mIsolate, Stage::GetCurrent() ); daliObject->Set( v8::String::NewFromUtf8( mIsolate, "stage") , stageObject ); -- // fontObject provides static font functionality like GetFontList... -- v8::Local fontObject = FontWrapper::GetStaticFontObject( mIsolate ); -- daliObject->Set( v8::String::NewFromUtf8( mIsolate, "font") , fontObject ); -- // keyboard focus manager is a singleton v8::Local keyboardObject = KeyboardFocusManagerWrapper::WrapKeyboardFocusManager( mIsolate,Toolkit::KeyboardFocusManager::Get() ); daliObject->Set( v8::String::NewFromUtf8( mIsolate, "keyboardFocusManager") , keyboardObject ); diff --cc plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp index 74762f2,74762f2..a793c07 --- a/plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp +++ b/plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp @@@ -44,7 -44,7 +44,6 @@@ struct GeometryTypePai const GeometryTypePair GeometryTypeTable[]= { {"image", GEOMETRY_TYPE_IMAGE }, -- {"text", GEOMETRY_TYPE_TEXT }, {"mesh", GEOMETRY_TYPE_UNTEXTURED_MESH }, {"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH }, }; diff --cc plugins/dali-script-v8/src/text/font-api.cpp index 385f58d,385f58d..0000000 deleted file mode 100644,100644 --- a/plugins/dali-script-v8/src/text/font-api.cpp +++ /dev/null @@@ -1,458 -1,458 +1,0 @@@ --/* -- * Copyright (c) 2015 Samsung Electronics Co., Ltd. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- * -- */ -- --// CLASS HEADER --#include "font-api.h" -- --// INTERNAL INCLUDES --#include --#include --#include -- --namespace Dali --{ -- --namespace V8Plugin --{ -- --namespace // un named namespace --{ -- -- -- -- --} //un named namespace -- --/*************************************** -- * IMAGE FUNCTIONS -- * -- ****************************************/ --Font FontApi::GetFont( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::HandleScope handleScope( isolate ); -- -- v8::Local object = args.This(); -- v8::Local field = v8::Local::Cast( object->GetInternalField(0) ); -- void* ptr = field->Value(); -- -- FontWrapper* wrapper = static_cast< FontWrapper *>(ptr); -- return wrapper->GetFont(); --} --Font FontApi::GetFont( v8::Isolate* isolate, v8::Local& value ) --{ -- v8::HandleScope handleScope( isolate ); -- v8::Local object = value->ToObject(); -- v8::Local field = v8::Local::Cast( object->GetInternalField(0) ); -- void* ptr = field->Value(); -- -- FontWrapper* wrapper = static_cast< FontWrapper *>(ptr); -- return wrapper->GetFont(); --} -- --struct FontParams --{ -- typedef enum -- { -- NO_SIZE_SET, -- USE_POINT_SIZE, -- USE_PIXEL_SIZE, -- USE_CAP_SIZE, -- } SizeType; -- -- -- FontParams() -- :pointSize( 0 ), -- pixelSize( 0 ), -- capsSize( 0 ), -- sizeType( FontParams::NO_SIZE_SET ) -- { -- } -- -- std::string family; -- std::string style; -- PointSize pointSize; -- PixelSize pixelSize; -- CapsHeight capsSize; -- SizeType sizeType; -- -- --}; -- -- --void ReadFontParameters( v8::Isolate* isolate, -- v8::Local options, -- FontParams& fontParams ) --{ -- // foont options is an optional parameter passed in which holds -- // optional settings -- // var fontOptions = { -- // family: "arial", -- // style: "bold", -- // // one of the following -- // pixelSize: xx -- // pointSize: xx -- // capsHeight:xx // height of a capital letter above the baseline for a particular typeface. -- // -- // }; -- v8::HandleScope handleScope( isolate ); -- if( !options->IsObject() ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 ( font parameters)" ); -- return; -- } -- v8::Local obj = options->ToObject(); -- -- v8::Local familyValue = obj->Get( v8::String::NewFromUtf8( isolate, "family" ) ); -- if( familyValue->IsString() ) -- { -- fontParams.family = V8Utils::v8StringToStdString( familyValue ); -- } -- -- v8::Local styleValue = obj->Get( v8::String::NewFromUtf8( isolate, "style" ) ); -- if( styleValue->IsString() ) -- { -- fontParams.style = V8Utils::v8StringToStdString( styleValue ); -- } -- -- v8::Local pixelSize = obj->Get( v8::String::NewFromUtf8( isolate, "pixelSize" ) ); -- v8::Local pointSize = obj->Get( v8::String::NewFromUtf8( isolate, "pointSize" ) ); -- v8::Local capsHeight = obj->Get( v8::String::NewFromUtf8( isolate, "capsHeight" ) ); -- -- if( pixelSize->IsUint32() ) -- { -- fontParams.pixelSize.value = pixelSize->ToUint32()->Value(); -- fontParams.sizeType = FontParams::USE_PIXEL_SIZE; -- } -- else if( pointSize->IsUint32() ) -- { -- fontParams.pointSize.value = pointSize->ToUint32()->Value(); -- fontParams.sizeType = FontParams::USE_POINT_SIZE; -- } -- else if( capsHeight->IsUint32() ) -- { -- fontParams.capsSize.value = capsHeight->ToUint32()->Value(); -- fontParams.sizeType = FontParams::USE_CAP_SIZE; -- } -- --} -- --Font FontApi::New( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- // if no parameters just create a default font -- if ( args.Length() == 0) -- { -- return Font::New(); -- } -- FontParams params; -- -- ReadFontParameters( isolate, args[0], params ); -- -- FontParameters fontParams; -- // construct a dali font parameters object -- switch( params.sizeType) -- { -- case FontParams::USE_PIXEL_SIZE: -- { -- fontParams = FontParameters( params.family, params.style, params.pixelSize ); -- break; -- } -- case FontParams::USE_POINT_SIZE: -- { -- fontParams = FontParameters( params.family, params.style, params.pointSize ); -- break; -- } -- case FontParams::USE_CAP_SIZE: -- { -- fontParams = FontParameters( params.family, params.style, params.capsSize ); -- break; -- } -- default: -- { -- fontParams = FontParameters( params.family, params.style, PointSize(0.f)); -- break; -- } -- } -- return Font::New( fontParams ); -- --} -- -- --void FontApi::GetFamilyForText( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- -- bool foundString; -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, foundString, isolate, args ); -- if( !foundString ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 ( text )" ); -- return; -- } -- std::string family = Font::GetFamilyForText( text ); -- -- args.GetReturnValue().Set( v8::String::NewFromUtf8( isolate, family.c_str()) ); -- --} --void FontApi::GetLineHeightFromCapsHeight( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- FontParams params; -- ReadFontParameters( isolate, args[0], params ); -- if( params.sizeType != FontParams::USE_CAP_SIZE ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "caps height not found" ); -- return; -- } -- -- PixelSize size = Font::GetLineHeightFromCapsHeight( params.family, params.style, params.capsSize); -- args.GetReturnValue().Set( v8::Integer::New( isolate, size.value ) ); --} -- --void FontApi::GetInstalledFonts( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- bool found( false ); -- std::vector fontList; -- -- std::string mode = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- -- if( mode == "LIST_APPLICATION_FONTS" ) -- { -- fontList = Font::GetInstalledFonts( Font::LIST_APPLICATION_FONTS ); -- } -- else if( mode == "LIST_ALL_FONTS") -- { -- fontList = Font::GetInstalledFonts( Font::LIST_ALL_FONTS ); -- } -- else // default -- { -- fontList = Font::GetInstalledFonts( Font::LIST_SYSTEM_FONTS ); -- } -- // create a javascript array -- v8::Local array = v8::Array::New(isolate, fontList.size() ); -- for( std::size_t i = 0; i < fontList.size(); i++) -- { -- const char* fontName = fontList[i].c_str(); -- array->Set(v8::Integer::New(args.GetIsolate(), i), v8::String::NewFromUtf8( isolate,fontName)); -- } -- -- args.GetReturnValue().Set( array ); --} -- --void FontApi::MeasureTextWidth( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- //float MeasureTextWidth(const std::string& text, float textHeightPx) const; -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- if(! found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "text not found" ); -- return; -- } -- int height = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0 ); -- if( !found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "missing text height" ); -- return; -- } -- float width = font.MeasureTextWidth( text, height ); -- -- args.GetReturnValue().Set( v8::Integer::New( isolate, width ) ); -- --} --void FontApi::MeasureTextHeight( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- //float MeasureTextHeight(const std::string& text, float textHeightPx) const; -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- if(! found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "text not found" ); -- return; -- } -- int width= V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0 ); -- if( !found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "missing text height" ); -- return; -- } -- float height = font.MeasureTextHeight( text, width ); -- -- args.GetReturnValue().Set( v8::Integer::New( isolate, height ) ); --} --void FontApi::MeasureText( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- if(! found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "text not found" ); -- return; -- } -- -- Vector3 vec3 = font.MeasureText( text ); -- Dali::Property::Value value( vec3 ); -- v8::Local object = PropertyValueWrapper::WrapDaliProperty( isolate, value); -- args.GetReturnValue().Set( object ); -- --} --void FontApi::AllGlyphsSupported( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- if(! found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "text not found" ); -- return; -- } -- -- bool supported = font.AllGlyphsSupported( text ); -- args.GetReturnValue().Set( v8::Boolean::New( isolate, supported) ); -- --} -- --// This one function is use to create a property map, instead of the many individual property --// getters used by the C++ Dali API. --// propertyMap --// { --// name: --// style: --// pointSize: --// pixelSize: --// lineHeight: --// ascender: --// underlineThickness: --// underlinePosition: --// isDefaultSystemFont: --// isDefaultSystemSize: --// } -- --void FontApi::GetProperties( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- v8::Local keyObject = v8::Object::New( isolate ); -- -- keyObject->Set( v8::String::NewFromUtf8( isolate, "family" ), v8::String::NewFromUtf8( isolate, font.GetName().c_str() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "style" ), v8::String::NewFromUtf8( isolate, font.GetStyle().c_str() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "pointSize" ), v8::Integer::New( isolate, font.GetPointSize() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "pixelSize" ), v8::Integer::New( isolate, font.GetPixelSize() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "lineHeight" ), v8::Integer::New( isolate, font.GetLineHeight() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "ascender" ), v8::Integer::New( isolate, font.GetAscender() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "underlineThickness" ), v8::Integer::New( isolate, font.GetUnderlineThickness() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "underlinePosition" ), v8::Integer::New( isolate, font.GetUnderlinePosition()) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "isDefaultSystemFont" ), v8::Boolean::New( isolate, font.IsDefaultSystemFont() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "isDefaultSystemSize" ), v8::Boolean::New( isolate, font.IsDefaultSystemSize() ) ); -- -- args.GetReturnValue().Set( keyObject ); -- --} -- --void FontApi::GetMetrics( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- Font font = GetFont( isolate, args ); -- -- bool found( false ); -- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args ); -- -- if(! found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "character not found" ); -- return; -- } -- -- Text textObject( text ); -- -- Font::Metrics metric = font.GetMetrics( textObject[0] ); -- -- v8::Local keyObject = v8::Object::New( isolate ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "advance" ), v8::Integer::New( isolate, metric.GetAdvance() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "bearing" ), v8::Integer::New( isolate, metric.GetBearing() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "width" ), v8::Integer::New( isolate, metric.GetWidth() ) ); -- keyObject->Set( v8::String::NewFromUtf8( isolate, "height" ), v8::Integer::New( isolate, metric.GetHeight() ) ); -- -- args.GetReturnValue().Set( keyObject ); -- --} -- -- --void FontApi::PointsToPixels( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- bool found(false); -- int pointSize= V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 ); -- if( !found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "missing pointSize" ); -- return; -- } -- args.GetReturnValue().Set( v8::Integer::New( isolate, Font::PointsToPixels(pointSize) ) ); -- --} --void FontApi::PixelsToPoints( const v8::FunctionCallbackInfo< v8::Value >& args ) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate ); -- -- bool found(false); -- int pixelSize= V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 ); -- if( !found ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "missing pixelSize" ); -- return; -- } -- args.GetReturnValue().Set( v8::Integer::New( isolate, Font::PixelsToPoints(pixelSize) ) ); --} -- -- -- --} // namespace V8Plugin -- --} // namespace Dali diff --cc plugins/dali-script-v8/src/text/font-api.h index 129c240,129c240..0000000 deleted file mode 100644,100644 --- a/plugins/dali-script-v8/src/text/font-api.h +++ /dev/null @@@ -1,68 -1,68 +1,0 @@@ --#ifndef __DALI_V8PLUGIN_FONT_API_H__ --#define __DALI_V8PLUGIN_FONT_API_H__ -- --/* -- * Copyright (c) 2015 Samsung Electronics Co., Ltd. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- * -- */ -- --// EXTERNAL INCLUDES --#include --#include -- -- --namespace Dali --{ -- --namespace V8Plugin --{ -- --namespace FontApi --{ -- Font GetFont( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args ); -- Font GetFont( v8::Isolate* isolate, v8::Local& value ); -- -- Font GetFontFromParams( int paramIndex, -- bool& found, -- v8::Isolate* isolate, -- const v8::FunctionCallbackInfo< v8::Value >& args ); -- -- /** -- * Constructor -- */ -- Font New( const v8::FunctionCallbackInfo< v8::Value >& args ); -- -- /** -- * Font API see image.h for a description -- */ -- void GetFamilyForText( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void GetLineHeightFromCapsHeight( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void GetInstalledFonts( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void MeasureTextWidth( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void MeasureTextHeight( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void MeasureText( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void AllGlyphsSupported( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void GetProperties( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void GetMetrics( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void PointsToPixels( const v8::FunctionCallbackInfo< v8::Value >& args ); -- void PixelsToPoints( const v8::FunctionCallbackInfo< v8::Value >& args ); -- --}; // namespace FontApi -- --} // namespace V8Plugin -- --} // namespace Dali -- --#endif // header __DALI_V8PLUGIN_FONT_API_H__ diff --cc plugins/dali-script-v8/src/text/font-wrapper.cpp index 9760f51,9760f51..0000000 deleted file mode 100644,100644 --- a/plugins/dali-script-v8/src/text/font-wrapper.cpp +++ /dev/null @@@ -1,162 -1,162 +1,0 @@@ --/* -- * Copyright (c) 2015 Samsung Electronics Co., Ltd. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- * -- */ -- --// CLASS HEADER --#include "font-wrapper.h" -- --// INTERNAL INCLUDES --#include --#include --#include --#include --#include -- --namespace Dali --{ -- --namespace V8Plugin --{ -- --namespace // un-named name space --{ -- --/** -- * Contains a list of all functions that can be called on the font object -- */ --const ApiFunction FontFunctionTable[]= --{ -- /************************************** -- * Font API (in order of font.h) -- **************************************/ -- { "MeasureTextWidth", FontApi::MeasureTextWidth }, -- { "MeasureTextHeight", FontApi::MeasureTextHeight }, -- { "MeasureText", FontApi::MeasureText }, -- { "AllGlyphsSupported", FontApi::AllGlyphsSupported }, -- { "GetProperties", FontApi::GetProperties }, // replace all getters -- { "GetMetrics", FontApi::GetMetrics }, --}; -- --const unsigned int FontFunctionTableCount = sizeof(FontFunctionTable)/sizeof(FontFunctionTable[0]); -- --/** -- * Contains a list of all functions that can be called -- */ --const ApiFunction StaticFontFunctionTable[]= --{ -- /************************************** -- * Static font functions, called without a font object -- **************************************/ -- { "GetFamilyForText", FontApi::GetFamilyForText }, -- { "GetLineHeightFromCapsHeight", FontApi::GetLineHeightFromCapsHeight }, -- { "GetInstalledFonts", FontApi::GetInstalledFonts }, -- { "PointsToPixels", FontApi::PointsToPixels }, -- { "PixelsToPoints", FontApi::PixelsToPoints }, --}; -- --const unsigned int StaticFontFunctionTableCount = sizeof(StaticFontFunctionTable)/sizeof(FontFunctionTable[0]); -- --} //un-named space -- -- --FontWrapper::FontWrapper( const Dali::Font& font, GarbageCollectorInterface& gc ) --: BaseWrappedObject( BaseWrappedObject::FONT , gc ) --{ -- mFont = font; --} -- --v8::Handle FontWrapper::WrapFont(v8::Isolate* isolate, const Dali::Font& font ) --{ -- v8::EscapableHandleScope handleScope( isolate ); -- v8::Local objectTemplate; -- -- objectTemplate = MakeFontTemplate( isolate ); -- -- // create an instance of the template -- v8::Local localObject = objectTemplate->NewInstance(); -- -- // create the Font wrapper -- FontWrapper* pointer = new FontWrapper( font, Dali::V8Plugin::DaliWrapper::Get().GetDaliGarbageCollector() ); -- -- // assign the JavaScript object to the wrapper. -- pointer->SetJavascriptObject( isolate, localObject ); -- -- printf("Created Font!\n"); -- return handleScope.Escape( localObject ); --} -- -- --v8::Handle FontWrapper::MakeFontTemplate( v8::Isolate* isolate ) --{ -- v8::EscapableHandleScope handleScope( isolate ); -- -- v8::Local objTemplate = v8::ObjectTemplate::New(); -- -- objTemplate->SetInternalFieldCount( BaseWrappedObject::FIELD_COUNT ); -- -- // add our function properties -- ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, FontFunctionTable, FontFunctionTableCount ); -- -- return handleScope.Escape( objTemplate ); --} -- --void FontWrapper::NewFont( const v8::FunctionCallbackInfo< v8::Value >& args) --{ -- v8::Isolate* isolate = args.GetIsolate(); -- v8::HandleScope handleScope( isolate); -- -- if(!args.IsConstructCall()) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "Font constructor called without 'new'"); -- return; -- } -- -- // attribs can be passed by value -- Dali::Font font = FontApi::New( args ); -- if( !font ) -- { -- DALI_SCRIPT_EXCEPTION( isolate, "bad font parameters\n"); -- return; -- } -- -- v8::Local localObject = WrapFont( isolate, font ); -- args.GetReturnValue().Set( localObject ); --} -- --Font FontWrapper::GetFont() --{ -- return mFont; --} -- --v8::Handle FontWrapper::GetStaticFontObject(v8::Isolate* isolate) --{ -- v8::EscapableHandleScope handleScope( isolate ); -- -- v8::Local objTemplate = v8::ObjectTemplate::New(); -- -- // add our functions properties -- ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, StaticFontFunctionTable, StaticFontFunctionTableCount ); -- -- v8::Local localObject = objTemplate->NewInstance(); -- -- return handleScope.Escape( localObject ); -- -- } -- -- --} // namespace V8Plugin -- --} // namespace Dali diff --cc plugins/dali-script-v8/src/text/font-wrapper.h index 328416a,328416a..0000000 deleted file mode 100644,100644 --- a/plugins/dali-script-v8/src/text/font-wrapper.h +++ /dev/null @@@ -1,78 -1,78 +1,0 @@@ --#ifndef __DALI_V8PLUGIN_FONT_WRAPPER_H__ --#define __DALI_V8PLUGIN_FONT_WRAPPER_H__ -- --/* -- * Copyright (c) 2015 Samsung Electronics Co., Ltd. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- * -- */ -- --// EXTERNAL INCLUDES --#include --#include -- --// INTERNAL INCLUDES --#include -- --namespace Dali --{ -- --namespace V8Plugin --{ -- -- --/** -- * An Font wrapper. -- * Provides access to Font specific functionality and V8 memory handling. -- */ --class FontWrapper : public BaseWrappedObject --{ -- --public: -- -- FontWrapper( const Font& font, -- GarbageCollectorInterface& gc ); -- -- virtual ~FontWrapper() -- { -- }; -- -- /** -- * @brief Creates a new Font wrapped inside a Javascript Object. -- * @note: the actor type ie 'FontFont' is expected to be the name of the callee function. -- * @param[in] args v8 function call arguments interpreted -- */ -- static void NewFont( const v8::FunctionCallbackInfo< v8::Value >& args); -- -- /** -- * Wraps a font -- */ -- static v8::Handle WrapFont(v8::Isolate* isolate, const Dali::Font& ); -- -- Font GetFont(); -- -- static v8::Handle GetStaticFontObject(v8::Isolate* isolate); -- --private: -- -- Font mFont; -- static v8::Handle MakeFontTemplate( v8::Isolate* isolate ); -- --}; -- --} // namespace V8Plugin -- --} // namespace Dali -- --#endif // __DALI_V8PLUGIN_FONT_WRAPPER_H__ diff --cc plugins/dali-script-v8/src/toolkit/builder/builder-api.cpp index 7feb259,7feb259..3c499a4 --- a/plugins/dali-script-v8/src/toolkit/builder/builder-api.cpp +++ b/plugins/dali-script-v8/src/toolkit/builder/builder-api.cpp @@@ -32,7 -32,7 +32,6 @@@ #include #include #include --#include #include @@@ -293,11 -293,11 +292,6 @@@ void BuilderApi::Create( const v8::Func v8::Local image = ImageWrapper::WrapImage(isolate, Image::DownCast(handle) ); args.GetReturnValue().Set( image ); } -- if( typeName == "Font ") -- { -- v8::Local font = FontWrapper::WrapFont(isolate, Font::DownCast(handle) ); -- args.GetReturnValue().Set( font ); -- } if( typeName == "Shader") { v8::Local shader = ShaderEffectWrapper::WrapShaderEffect(isolate, ShaderEffect::DownCast( handle ));