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)
$(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 \
#include "actor-api.h"
// EXTERNAL INCLUDES
--#include <dali-toolkit/public-api/controls/text-view/text-view.h>
++#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
// INTERNAL INCLUDES
#include <v8-utils.h>
} //unanmed namespace
--namespace TextViewApi
++namespace TextLabelApi
{
Actor New( const v8::FunctionCallbackInfo< v8::Value >& args )
{
-- return Dali::Toolkit::TextView::New();
++ return Dali::Toolkit::TextLabel::New();
}
}
*
* @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<v8::Value>& args )
{
namespace V8Plugin
{
--namespace TextViewApi
++namespace TextLabelApi
{
/**
* Temporary TextView constructor
#include <actors/layer-api.h>
#include <actors/actor-api.h>
#include <actors/image-actor-api.h>
--#include <actors/text-actor-api.h>
#include <actors/mesh-actor-api.h>
#include <actors/camera-actor-api.h>
#include <actors/renderable-actor-api.h>
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mImageActorTemplate;
--v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mMeshActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mCameraActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mLayerActorTemplate;
--v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextViewTemplate;
++v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextLabelTemplate;
namespace
{
{
{ &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 }
};
/**
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,
};
/**
{
{"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 },
};
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;
// 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)
**************************************/
return;
}
-- // find out the callee function name...e.g. TextActor, ImageActor, MeshActor
++ // find out the callee function name...e.g. ImageActor, MeshActor
v8::Local<v8::Function> callee = args.Callee();
v8::Local<v8::Value> v8String = callee->GetName();
std::string typeName = V8Utils::v8StringToStdString( v8String );
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
};
/**
// The Actor ObjectTemplates.
static v8::Persistent<v8::ObjectTemplate> mActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mImageActorTemplate;
-- static v8::Persistent<v8::ObjectTemplate> mTextActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mMeshActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mCameraActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mLayerActorTemplate;
-- static v8::Persistent<v8::ObjectTemplate> mTextViewTemplate;
++ static v8::Persistent<v8::ObjectTemplate> mTextLabelTemplate;
/**
* @return the wrapped actor
+++ /dev/null
--/*
-- * 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 <dali/public-api/text/text-actor-parameters.h>
--
--// INTERNAL INCLUDES
--#include <object/handle-wrapper.h>
--#include <v8-utils.h>
--#include <object/property-value-wrapper.h>
--#include <text/font-api.h>
--
--
--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<v8::Value > options,
-- TextActorParametersInternal& textParams )
--{
-- // fontDetection: true / false ( default true)
-- // font: dali font object
-- v8::HandleScope handleScope( isolate );
--
-- if( options->IsObject() )
-- {
-- v8::Local<v8::Object> obj = options->ToObject();
--
-- v8::Local<v8::Value> fontDetect = obj->Get( v8::String::NewFromUtf8( isolate, "fontDetection" ) );
-- if( fontDetect->IsBoolean() )
-- {
--
-- textParams.fontDetection = fontDetect->ToBoolean()->Value();
-- }
--
-- v8::Local<v8::Value> 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<v8::Value>& 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<v8::Value>& args )
--{
-- v8::Isolate* isolate = args.GetIsolate();
-- v8::HandleScope handleScope( isolate );
--
-- TextActor textActor = GetTextActor( isolate, args );
-- textActor.SetToNaturalSize();
--}
--
--} // namespace V8Plugin
--
--} // namespace Dali
#include <stage/stage-wrapper.h>
#include <image/image-attributes-wrapper.h>
#include <image/image-wrapper.h>
--#include <text/font-wrapper.h>
#include <animation/path-wrapper.h>
#include <animation/animation-wrapper.h>
#include <events/pan-gesture-detector-wrapper.h>
{
{ "Rotation", PropertyValueWrapper::NewRotation},
{ "Matrix", PropertyValueWrapper::NewMatrix},
-- { "Font", FontWrapper::NewFont },
{ "Path", PathWrapper::NewPath },
{ "Actor", ActorWrapper::NewActor },
{ "TextActor", ActorWrapper::NewActor },
v8::Local<v8::Object> stageObject = StageWrapper::WrapStage( mIsolate, Stage::GetCurrent() );
daliObject->Set( v8::String::NewFromUtf8( mIsolate, "stage") , stageObject );
-- // fontObject provides static font functionality like GetFontList...
-- v8::Local<v8::Object> fontObject = FontWrapper::GetStaticFontObject( mIsolate );
-- daliObject->Set( v8::String::NewFromUtf8( mIsolate, "font") , fontObject );
--
// keyboard focus manager is a singleton
v8::Local<v8::Object> keyboardObject = KeyboardFocusManagerWrapper::WrapKeyboardFocusManager( mIsolate,Toolkit::KeyboardFocusManager::Get() );
daliObject->Set( v8::String::NewFromUtf8( mIsolate, "keyboardFocusManager") , keyboardObject );
const GeometryTypePair GeometryTypeTable[]=
{
{"image", GEOMETRY_TYPE_IMAGE },
-- {"text", GEOMETRY_TYPE_TEXT },
{"mesh", GEOMETRY_TYPE_UNTEXTURED_MESH },
{"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH },
};
+++ /dev/null
--/*
-- * 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 <v8-utils.h>
--#include <text/font-wrapper.h>
--#include <object/property-value-wrapper.h>
--
--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<v8::Object> object = args.This();
-- v8::Local<v8::External> field = v8::Local<v8::External>::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<v8::Value>& value )
--{
-- v8::HandleScope handleScope( isolate );
-- v8::Local<v8::Object> object = value->ToObject();
-- v8::Local<v8::External> field = v8::Local<v8::External>::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<v8::Value > 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<v8::Object> obj = options->ToObject();
--
-- v8::Local<v8::Value> familyValue = obj->Get( v8::String::NewFromUtf8( isolate, "family" ) );
-- if( familyValue->IsString() )
-- {
-- fontParams.family = V8Utils::v8StringToStdString( familyValue );
-- }
--
-- v8::Local<v8::Value> styleValue = obj->Get( v8::String::NewFromUtf8( isolate, "style" ) );
-- if( styleValue->IsString() )
-- {
-- fontParams.style = V8Utils::v8StringToStdString( styleValue );
-- }
--
-- v8::Local<v8::Value> pixelSize = obj->Get( v8::String::NewFromUtf8( isolate, "pixelSize" ) );
-- v8::Local<v8::Value> pointSize = obj->Get( v8::String::NewFromUtf8( isolate, "pointSize" ) );
-- v8::Local<v8::Value> 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<std::string> 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<v8::Array> 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 <v8::Object> 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<v8::Object> 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<v8::Object> 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
+++ /dev/null
--#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 <v8.h>
--#include <dali/public-api/text/font.h>
--
--
--namespace Dali
--{
--
--namespace V8Plugin
--{
--
--namespace FontApi
--{
-- Font GetFont( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args );
-- Font GetFont( v8::Isolate* isolate, v8::Local<v8::Value>& 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__
+++ /dev/null
--/*
-- * 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 <v8-utils.h>
--#include <dali-wrapper.h>
--#include <text/font-api.h>
--#include <shared/api-function.h>
--#include <shared/object-template-helper.h>
--
--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<v8::Object> FontWrapper::WrapFont(v8::Isolate* isolate, const Dali::Font& font )
--{
-- v8::EscapableHandleScope handleScope( isolate );
-- v8::Local<v8::ObjectTemplate> objectTemplate;
--
-- objectTemplate = MakeFontTemplate( isolate );
--
-- // create an instance of the template
-- v8::Local<v8::Object> 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<v8::ObjectTemplate> FontWrapper::MakeFontTemplate( v8::Isolate* isolate )
--{
-- v8::EscapableHandleScope handleScope( isolate );
--
-- v8::Local<v8::ObjectTemplate> 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<v8::Object> localObject = WrapFont( isolate, font );
-- args.GetReturnValue().Set( localObject );
--}
--
--Font FontWrapper::GetFont()
--{
-- return mFont;
--}
--
--v8::Handle<v8::Object> FontWrapper::GetStaticFontObject(v8::Isolate* isolate)
--{
-- v8::EscapableHandleScope handleScope( isolate );
--
-- v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New();
--
-- // add our functions properties
-- ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, StaticFontFunctionTable, StaticFontFunctionTableCount );
--
-- v8::Local<v8::Object> localObject = objTemplate->NewInstance();
--
-- return handleScope.Escape( localObject );
--
-- }
--
--
--} // namespace V8Plugin
--
--} // namespace Dali
+++ /dev/null
--#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 <v8.h>
--#include <dali/public-api/text/font.h>
--
--// INTERNAL INCLUDES
--#include <shared/base-wrapped-object.h>
--
--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<v8::Object> WrapFont(v8::Isolate* isolate, const Dali::Font& );
--
-- Font GetFont();
--
-- static v8::Handle<v8::Object> GetStaticFontObject(v8::Isolate* isolate);
--
--private:
--
-- Font mFont;
-- static v8::Handle<v8::ObjectTemplate> MakeFontTemplate( v8::Isolate* isolate );
--
--};
--
--} // namespace V8Plugin
--
--} // namespace Dali
--
--#endif // __DALI_V8PLUGIN_FONT_WRAPPER_H__
#include <actors/actor-wrapper.h>
#include <image/image-wrapper.h>
#include <animation/animation-wrapper.h>
--#include <text/font-wrapper.h>
#include <shader-effects/shader-effect-wrapper.h>
v8::Local<v8::Object> image = ImageWrapper::WrapImage(isolate, Image::DownCast(handle) );
args.GetReturnValue().Set( image );
}
-- if( typeName == "Font ")
-- {
-- v8::Local<v8::Object> font = FontWrapper::WrapFont(isolate, Font::DownCast(handle) );
-- args.GetReturnValue().Set( font );
-- }
if( typeName == "Shader")
{
v8::Local<v8::Object> shader = ShaderEffectWrapper::WrapShaderEffect(isolate, ShaderEffect::DownCast( handle ));