# List of test case sources (Only these get parsed for test cases)
SET(TC_SOURCES
utc-Dali-PushButton.cpp
- utc-Dali-TextView-HelperAndDebug.cpp
- utc-Dali-TextView-Processor-Types.cpp
- utc-Dali-TextView-Processor.cpp
- utc-Dali-TextView-Relayout-Utilities.cpp
- utc-Dali-TextView.cpp
)
# Append list of test harness files (Won't get parsed for test cases)
INCLUDE_DIRECTORIES(
${${CAPI_LIB}_INCLUDE_DIRS}
../dali-toolkit/dali-toolkit-test-utils
- ../../../base
- ../../../optional
+ ../../../
)
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
PKG_CHECK_MODULES(DALICORE, dali-core)
PKG_CHECK_MODULES(DALI, dali)
-PKG_CHECK_MODULES(FRIBIDI, fribidi)
DALI_TOOLKIT_CFLAGS=-DPLATFORM_TIZEN
[dali_profile=$enableval],
[dali_profile=COMMON])
- # Different platforms use either the full Toolkit or the basic version
- # The basic version excludes components under dali-toolkit/optional
- AM_CONDITIONAL([TOOLKIT_BASIC_VERSION], [test x$dali_profile = xLITE])
-
if test x$DALI_DATA_RW_DIR != x; then
dataReadWriteDir=${DALI_DATA_RW_DIR}/
else
# Build the Dali Toolkit library
- # Base files
- toolkit_base_images_dir = ../../../base/dali-toolkit/images
- toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds
- toolkit_base_styles_dir = ../../../base/dali-toolkit/styles
- toolkit_base_src_dir = ../../../base/dali-toolkit/internal
- public_api_base_src_dir = ../../../base/dali-toolkit/public-api
-
- include ../../../base/dali-toolkit/images/file.list
- include ../../../base/dali-toolkit/sounds/file.list
- include ../../../base/dali-toolkit/styles/file.list
- include ../../../base/dali-toolkit/internal/file.list
- include ../../../base/dali-toolkit/public-api/file.list
-
- # Optional files
- toolkit_optional_images_dir = ../../../optional/dali-toolkit/images
- toolkit_optional_src_dir = ../../../optional/dali-toolkit/internal
- public_api_optional_src_dir = ../../../optional/dali-toolkit/public-api
-
- include ../../../optional/dali-toolkit/images/file.list
- include ../../../optional/dali-toolkit/internal/file.list
- include ../../../optional/dali-toolkit/public-api/file.list
+ toolkit_images_dir = ../../../dali-toolkit/images
+ toolkit_sounds_dir = ../../../dali-toolkit/sounds
+ toolkit_styles_dir = ../../../dali-toolkit/styles
+ toolkit_src_dir = ../../../dali-toolkit/internal
+ public_api_src_dir = ../../../dali-toolkit/public-api
+
+ include ../../../dali-toolkit/images/file.list
+ include ../../../dali-toolkit/sounds/file.list
+ include ../../../dali-toolkit/styles/file.list
+ include ../../../dali-toolkit/internal/file.list
+ include ../../../dali-toolkit/public-api/file.list
resources_dir = ../../../resources
daliimagedir = ${dataReadOnlyDir}/toolkit/images/
- if TOOLKIT_BASIC_VERSION
- daliimage_DATA = ${dali_toolkit_base_image_files}
- else
- daliimage_DATA = ${dali_toolkit_base_image_files} \
- ${dali_toolkit_optional_image_files}
- endif # TOOLKIT_BASIC_VERSION
+ daliimage_DATA = ${dali_toolkit_image_files}
dalisounddir = ${dataReadOnlyDir}/toolkit/sounds/
- dalisound_DATA = ${dali_toolkit_base_sound_files}
+ dalisound_DATA = ${dali_toolkit_sound_files}
# The library
lib_LTLIBRARIES = libdali-toolkit.la
- if TOOLKIT_BASIC_VERSION
libdali_toolkit_la_SOURCES = \
- $(toolkit_base_src_files) \
- $(public_api_base_src_files)
- else
- libdali_toolkit_la_SOURCES = \
- $(toolkit_base_src_files) \
- $(public_api_base_src_files) \
- $(toolkit_optional_src_files) \
- $(public_api_optional_src_files)
- endif # TOOLKIT_BASIC_VERSION
+ $(toolkit_src_files) \
+ $(public_api_src_files)
dalistyledir = ${dataReadOnlyDir}/toolkit/styles/
dalistyle_DATA = ${dali_toolkit_style_files}
libdali_toolkit_la_DEPENDENCIES =
- toolkit_basic_includes = -I../../../base
-
- if ! TOOLKIT_BASIC_VERSION
- toolkit_optional_includes = -I../../../optional
- endif
-
libdali_toolkit_la_CXXFLAGS = -DDALI_COMPILATION \
-DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
-DDALI_SOUND_DIR="\"${dalisounddir}\"" \
-DDALI_STYLE_DIR="\"${dalistyledir}\"" \
-DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
-Werror -Wall \
- $(toolkit_basic_includes) \
- $(toolkit_optional_includes) \
+ -I../../../ \
$(DALI_TOOLKIT_CFLAGS) \
$(DALICORE_CFLAGS) \
$(DALI_CFLAGS) \
$(FRIBIDI_LIBS) \
$(HTMLCXX_LIBS)
- # Install Base headers
-
- toplevelbasedir = $(devincludepath)/dali-toolkit
-
- publicapibasedir = $(toplevelbasedir)/public-api
- publicapibasecontrolsdir = $(publicapibasedir)/controls
- publicapibasealignmentdir = $(publicapibasedir)/controls/alignment
- publicapibasebuttonsdir = $(publicapibasedir)/controls/buttons
- publicapibasedefaultcontrolsdir = $(publicapibasedir)/controls/default-controls
- publicapibaseitemviewdir = $(publicapibasedir)/controls/scrollable/item-view
- publicapibasepopupdir = $(publicapibasedir)/controls/popup
- publicapibasescrollbardir = $(publicapibasedir)/controls/scroll-bar
- publicapibasescrollcomponentdir = $(publicapibasedir)/controls/scroll-component
- publicapibasescrollabledir = $(publicapibasedir)/controls/scrollable
- publicapibasescrollviewdir = $(publicapibasedir)/controls/scrollable/scroll-view
- publicapibasetableviewdir = $(publicapibasedir)/controls/table-view
- publicapibasetextcontrolsdir = $(publicapibasedir)/controls/text-controls
- publicapibasetextdir = $(publicapibasedir)/text
- publicapibasetextlayoutsdir = $(publicapibasedir)/text/layouts
- publicapibasetextrenderingdir = $(publicapibasedir)/text/rendering
- publicapibasetextrenderingbasicdir = $(publicapibasedir)/text/rendering/basic
- publicapibasetextrenderingshadersdir = $(publicapibasedir)/text/rendering/shaders
- publicapibasefactorydir = $(publicapibasedir)/factory
- publicapibasefocusmanagerdir = $(publicapibasedir)/focus-manager
- publicapibasemarkupprocessordir = $(publicapibasedir)/markup-processor
- publicapibaseshadereffectsdir = $(publicapibasedir)/shader-effects
- publicapibasestylingdir = $(publicapibasedir)/styling
- publicapibasebuilderdir = $(publicapibasedir)/builder
-
- publicapibase_HEADERS = $(public_api_base_header_files)
- publicapibasecontrols_HEADERS = $(public_api_base_controls_header_files)
- publicapibasealignment_HEADERS = $(public_api_base_alignment_header_files)
- publicapibasebuttons_HEADERS = $(public_api_base_buttons_header_files)
- publicapibasedefaultcontrols_HEADERS = $(public_api_base_default_controls_header_files)
- publicapibaseitemview_HEADERS = $(public_api_base_item_view_header_files)
- publicapibasepopup_HEADERS = $(public_api_base_popup_header_files)
- publicapibasescrollbar_HEADERS = $(public_api_base_scroll_bar_header_files)
- publicapibasescrollcomponent_HEADERS = $(public_api_base_scroll_component_header_files)
- publicapibasescrollable_HEADERS = $(public_api_base_scrollable_header_files)
- publicapibasescrollview_HEADERS = $(public_api_base_scroll_view_header_files)
- publicapibasetableview_HEADERS = $(public_api_base_table_view_header_files)
- publicapibasetextcontrols_HEADERS = $(public_api_base_text_controls_header_files)
- publicapibasetext_HEADERS = $(public_api_base_text_header_files)
- publicapibasetextlayouts_HEADERS = $(public_api_base_text_layouts_header_files)
- publicapibasetextrendering_HEADERS = $(public_api_base_text_rendering_header_files)
- publicapibasetextrenderingbasic_HEADERS = $(public_api_base_text_rendering_basic_header_files)
- publicapibasetextrenderingshaders_HEADERS = $(public_api_base_text_rendering_shaders_header_files)
- publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files)
- publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files)
- publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files)
- publicapibasestyling_HEADERS = $(public_api_base_styling_header_files)
- publicapibasebuilder_HEADERS = $(public_api_base_builder_header_files)
-
- # Install Optional headers
-
- topleveloptionaldir = $(devincludepath)/dali-toolkit
- topleveloptional_HEADERS = ../../../optional/dali-toolkit/dali-toolkit.h
-
- publicapioptionaldir = $(topleveloptionaldir)/public-api
- publicapioptionalcontrolsdir = $(publicapioptionaldir)/controls
- publicapioptionalbloomviewdir = $(publicapioptionaldir)/controls/bloom-view
- publicapioptionalclusterdir = $(publicapioptionaldir)/controls/cluster
- publicapioptionaleffectsviewdir = $(publicapioptionaldir)/controls/effects-view
- publicapioptionalgaussianblurviewdir = $(publicapioptionaldir)/controls/gaussian-blur-view
- publicapioptionalimageviewdir = $(publicapioptionaldir)/controls/image-view
- publicapioptionalmagnifierdir = $(publicapioptionaldir)/controls/magnifier
- publicapioptionalpageturnviewdir = $(publicapioptionaldir)/controls/page-turn-view
- publicapioptionalsliderdir = $(publicapioptionaldir)/controls/slider
- publicapioptionaltoolbardir = $(publicapioptionaldir)/controls/tool-bar
- publicapioptionalselectorsdir = $(publicapioptionaldir)/controls/selectors
- publicapioptionalshadowviewdir = $(publicapioptionaldir)/controls/shadow-view
- publicapioptionalbubbleemitterdir = $(publicapioptionaldir)/controls/bubble-effect
- publicapioptionalsuperblurviewdir = $(publicapioptionaldir)/controls/super-blur-view
- publicapioptionalviewdir = $(publicapioptionaldir)/controls/view
- publicapioptionalnavigationframedir = $(publicapioptionaldir)/controls/navigation-frame
- publicapioptionalshadereffectsdir = $(publicapioptionaldir)/shader-effects
- publicapioptionalbubbleeffectdir = $(publicapioptionaldir)/shader-effects/bubble-effect
- publicapioptionaltransitioneffectsdir = $(publicapioptionaldir)/transition-effects
-
- publicapioptional_HEADERS = $(public_api_optional_header_files)
- publicapioptionalcontrols_HEADERS = $(public_api_optional_controls_header_files)
- publicapioptionalbloomview_HEADERS = $(public_api_optional_bloom_view_header_files)
- publicapioptionalcluster_HEADERS = $(public_api_optional_cluster_header_files)
- publicapioptionaleffectsview_HEADERS = $(public_api_optional_effects_view_header_files)
- publicapioptionalgaussianblurview_HEADERS = $(public_api_optional_gaussian_blur_view_header_files)
- publicapioptionalimageview_HEADERS = $(public_api_optional_image_view_header_files)
- publicapioptionalmagnifier_HEADERS = $(public_api_optional_magnifier_header_files)
- publicapioptionalpageturnview_HEADERS = $(public_api_optional_page_turn_view_header_files)
- publicapioptionalslider_HEADERS = $(public_api_optional_slider_header_files)
- publicapioptionaltoolbar_HEADERS = $(public_api_optional_tool_bar_header_files)
- publicapioptionalselectors_HEADERS = $(public_api_optional_selectors_header_files)
- publicapioptionalshadowview_HEADERS = $(public_api_optional_shadow_view_header_files)
- publicapioptionalbubbleemitter_HEADERS = $(public_api_optional_bubble_emitter_header_files)
- publicapioptionalsuperblurview_HEADERS = $(public_api_optional_super_blur_view_header_files)
- publicapioptionalview_HEADERS = $(public_api_optional_view_header_files)
- publicapioptionalnavigationframe_HEADERS = $(public_api_optional_navigation_frame_header_files)
- publicapioptionalshadereffects_HEADERS = $(public_api_optional_shader_effects_header_files)
- publicapioptionalbubbleeffect_HEADERS = $(public_api_optional_bubble_effect_header_files)
- publicapioptionaltransitioneffects_HEADERS = $(public_api_optional_transition_effects_header_files)
+ # Install headers
+
+ topleveldir = $(devincludepath)/dali-toolkit
+ toplevel_HEADERS = ../../../dali-toolkit/dali-toolkit.h
+
+ publicapidir = $(topleveldir)/public-api
+
+ publicapicontrolsdir = $(publicapidir)/controls
+ publicapialignmentdir = $(publicapicontrolsdir)/alignment
+ publicapibloomviewdir = $(publicapicontrolsdir)/bloom-view
+ publicapibubbleemitterdir = $(publicapicontrolsdir)/bubble-effect
+ publicapibuttonsdir = $(publicapicontrolsdir)/buttons
+ publicapiclusterdir = $(publicapicontrolsdir)/cluster
+ publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls
+ publicapieffectsviewdir = $(publicapicontrolsdir)/effects-view
+ publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view
+ publicapiimageviewdir = $(publicapicontrolsdir)/image-view
+ publicapiitemviewdir = $(publicapicontrolsdir)/scrollable/item-view
+ publicapimagnifierdir = $(publicapicontrolsdir)/magnifier
+ publicapinavigationframedir = $(publicapicontrolsdir)/navigation-frame
+ publicapipageturnviewdir = $(publicapicontrolsdir)/page-turn-view
+ publicapipopupdir = $(publicapicontrolsdir)/popup
+ publicapiscrollbardir = $(publicapicontrolsdir)/scroll-bar
+ publicapiscrollcomponentdir = $(publicapicontrolsdir)/scroll-component
+ publicapiscrollabledir = $(publicapicontrolsdir)/scrollable
+ publicapiscrollviewdir = $(publicapicontrolsdir)/scrollable/scroll-view
+ publicapiselectorsdir = $(publicapicontrolsdir)/selectors
+ publicapishadowviewdir = $(publicapicontrolsdir)/shadow-view
+ publicapisliderdir = $(publicapicontrolsdir)/slider
+ publicapisuperblurviewdir = $(publicapicontrolsdir)/super-blur-view
+ publicapitableviewdir = $(publicapicontrolsdir)/table-view
-publicapitextviewdir = $(publicapicontrolsdir)/text-view
-publicapitextinputdir = $(publicapicontrolsdir)/text-input
++publicapitextcontrolsdir = $(publicapidir)/controls/text-controls
++publicapitextdir = $(publicapidir)/text
++publicapitextlayoutsdir = $(publicapidir)/text/layouts
++publicapitextrenderingdir = $(publicapidir)/text/rendering
++publicapitextrenderingbasicdir = $(publicapidir)/text/rendering/basic
++publicapitextrenderingshadersdir = $(publicapidir)/text/rendering/shaders
+ publicapitoolbardir = $(publicapicontrolsdir)/tool-bar
+ publicapiviewdir = $(publicapicontrolsdir)/view
-
+ publicapibuilderdir = $(publicapidir)/builder
+ publicapifocusmanagerdir = $(publicapidir)/focus-manager
-publicapimarkupprocessordir = $(publicapidir)/markup-processor
+ publicapishadereffectsdir = $(publicapidir)/shader-effects
+ publicapibubbleeffectdir = $(publicapidir)/shader-effects/bubble-effect
+ publicapistylingdir = $(publicapidir)/styling
+ publicapitransitioneffectsdir = $(publicapidir)/transition-effects
+
+ publicapi_HEADERS = $(public_api_header_files)
+ publicapicontrols_HEADERS = $(public_api_controls_header_files)
+ publicapialignment_HEADERS = $(public_api_alignment_header_files)
+ publicapibloomview_HEADERS = $(public_api_bloom_view_header_files)
+ publicapibubbleemitter_HEADERS = $(public_api_bubble_emitter_header_files)
+ publicapibuttons_HEADERS = $(public_api_buttons_header_files)
+ publicapicluster_HEADERS = $(public_api_cluster_header_files)
+ publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files)
+ publicapieffectsview_HEADERS = $(public_api_effects_view_header_files)
+ publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files)
+ publicapiimageview_HEADERS = $(public_api_image_view_header_files)
+ publicapiitemview_HEADERS = $(public_api_item_view_header_files)
+ publicapimagnifier_HEADERS = $(public_api_magnifier_header_files)
+ publicapinavigationframe_HEADERS = $(public_api_navigation_frame_header_files)
+ publicapipageturnview_HEADERS = $(public_api_page_turn_view_header_files)
+ publicapipopup_HEADERS = $(public_api_popup_header_files)
+ publicapiscrollbar_HEADERS = $(public_api_scroll_bar_header_files)
+ publicapiscrollcomponent_HEADERS = $(public_api_scroll_component_header_files)
+ publicapiscrollable_HEADERS = $(public_api_scrollable_header_files)
+ publicapiscrollview_HEADERS = $(public_api_scroll_view_header_files)
+ publicapiselectors_HEADERS = $(public_api_selectors_header_files)
+ publicapishadowview_HEADERS = $(public_api_shadow_view_header_files)
+ publicapislider_HEADERS = $(public_api_slider_header_files)
+ publicapisuperblurview_HEADERS = $(public_api_super_blur_view_header_files)
+ publicapitableview_HEADERS = $(public_api_table_view_header_files)
-publicapitextview_HEADERS = $(public_api_text_view_header_files)
-publicapitextinput_HEADERS = $(public_api_text_input_header_files)
++publicapitextcontrols_HEADERS = $(public_api_text_controls_header_files)
++publicapitext_HEADERS = $(public_api_text_header_files)
++publicapitextlayouts_HEADERS = $(public_api_text_layouts_header_files)
++publicapitextrendering_HEADERS = $(public_api_text_rendering_header_files)
++publicapitextrenderingbasic_HEADERS = $(public_api_text_rendering_basic_header_files)
++publicapitextrenderingshaders_HEADERS = $(public_api_text_rendering_shaders_header_files)
+ publicapitoolbar_HEADERS = $(public_api_tool_bar_header_files)
+ publicapiview_HEADERS = $(public_api_view_header_files)
-
+ publicapibuilder_HEADERS = $(public_api_builder_header_files)
+ publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files)
-publicapimarkupprocessor_HEADERS = $(public_api_markup_processor_header_files)
+ publicapishadereffects_HEADERS = $(public_api_shader_effects_header_files)
+ publicapibubbleeffect_HEADERS = $(public_api_bubble_effect_header_files)
+ publicapistyling_HEADERS = $(public_api_styling_header_files)
+ publicapitransitioneffects_HEADERS = $(public_api_transition_effects_header_files)
++
- #ifndef __DALI_TOOLKIT_INTERNAL_H__
- #define __DALI_TOOLKIT_INTERNAL_H__
+ #ifndef __DALI_TOOLKIT_H__
+ #define __DALI_TOOLKIT_H__
/*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
// Toolkit
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
+ #include <dali-toolkit/public-api/controls/bloom-view/bloom-view.h>
+ #include <dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h>
#include <dali-toolkit/public-api/controls/buttons/button.h>
+ #include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
#include <dali-toolkit/public-api/controls/buttons/radio-button.h>
#include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
+ #include <dali-toolkit/public-api/controls/cluster/cluster.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/control.h>
- #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
- #include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
- #include <dali-toolkit/public-api/controls/image-view/masked-image-view.h>
- #include <dali-toolkit/public-api/controls/popup/popup.h>
- #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
- #include <dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.h>
- #include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
- #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
- #include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
- #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-cube-effect.h>
- #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
- #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h>
- #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
- #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
- #include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
- #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
- #include <dali-toolkit/public-api/enums.h>
- #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
- #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
- #include <dali-toolkit/public-api/shader-effects/dissolve-effect.h>
- #include <dali-toolkit/public-api/shader-effects/image-region-effect.h>
- #include <dali-toolkit/public-api/shader-effects/iris-effect.h>
- #include <dali-toolkit/public-api/shader-effects/mask-effect.h>
- #include <dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h>
- #include <dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.h>
- #include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
- #include <dali-toolkit/public-api/shader-effects/ripple-effect.h>
- #include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
- #include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
- #include <dali-toolkit/public-api/text/character-run.h>
- #include <dali-toolkit/public-api/text/character-set-conversion.h>
- #include <dali-toolkit/public-api/text/font-run.h>
- #include <dali-toolkit/public-api/text/logical-model.h>
- #include <dali-toolkit/public-api/text/script.h>
- #include <dali-toolkit/public-api/text/segmentation.h>
- #include <dali-toolkit/public-api/text/multi-language-support.h>
- #include <dali-toolkit/public-api/text/text-controller.h>
- #include <dali-toolkit/public-api/text/text-definitions.h>
- #include <dali-toolkit/public-api/text/text-view.h>
- #include <dali-toolkit/public-api/text/text-view-interface.h>
- #include <dali-toolkit/public-api/text/visual-model.h>
- #include <dali-toolkit/public-api/text/layouts/layout-engine.h>
- #include <dali-toolkit/public-api/text/rendering/text-renderer.h>
- #include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h>
- #include <dali-toolkit/public-api/text/rendering/shaders/text-basic-shader.h>
-
- // INTERNAL INCLUDES
-
- #include <dali-toolkit/public-api/controls/bloom-view/bloom-view.h>
- #include <dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h>
- #include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
- #include <dali-toolkit/public-api/controls/cluster/cluster.h>
-
#include <dali-toolkit/public-api/controls/default-controls/check-button-factory.h>
-
+ #include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
+ #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
#include <dali-toolkit/public-api/controls/effects-view/effects-view.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+ #include <dali-toolkit/public-api/controls/image-view/masked-image-view.h>
#include <dali-toolkit/public-api/controls/magnifier/magnifier.h>
+ #include <dali-toolkit/public-api/controls/navigation-frame/navigation-control.h>
+ #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
+ #include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
- #include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
- #include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
-
+ #include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+ #include <dali-toolkit/public-api/controls/popup/popup.h>
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.h>
+ #include <dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.h>
+ #include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+ #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+ #include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-carousel-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-cube-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-depth-effect.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-cube-effect.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+ #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
#include <dali-toolkit/public-api/controls/shadow-view/shadow-view.h>
#include <dali-toolkit/public-api/controls/slider/slider.h>
+ #include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
-#include <dali-toolkit/public-api/controls/text-input/text-input.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
++#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/tool-bar/tool-bar.h>
#include <dali-toolkit/public-api/controls/view/view.h>
- #include <dali-toolkit/public-api/controls/navigation-frame/navigation-control.h>
- #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
-
+ #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
+ #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
-#include <dali-toolkit/public-api/markup-processor/markup-processor.h>
-
#include <dali-toolkit/public-api/shader-effects/alpha-discard-effect.h>
#include <dali-toolkit/public-api/shader-effects/bendy-effect.h>
#include <dali-toolkit/public-api/shader-effects/blind-effect.h>
#include <dali-toolkit/public-api/shader-effects/water-effect.h>
#include <dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.h>
#include <dali-toolkit/public-api/shader-effects/bubble-effect/color-adjuster.h>
+ #include <dali-toolkit/public-api/shader-effects/dissolve-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/image-region-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/iris-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/mask-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/ripple-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
+ #include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
+
++#include <dali-toolkit/public-api/text/bidirectional-line-info-run.h>
++#include <dali-toolkit/public-api/text/bidirectional-paragraph-info-run.h>
++#include <dali-toolkit/public-api/text/bidirectional-support.h>
++#include <dali-toolkit/public-api/text/character-run.h>
++#include <dali-toolkit/public-api/text/character-set-conversion.h>
++#include <dali-toolkit/public-api/text/font-run.h>
++#include <dali-toolkit/public-api/text/logical-model.h>
++#include <dali-toolkit/public-api/text/multi-language-support.h>
++#include <dali-toolkit/public-api/text/script.h>
++#include <dali-toolkit/public-api/text/segmentation.h>
++#include <dali-toolkit/public-api/text/text-controller.h>
++#include <dali-toolkit/public-api/text/text-definitions.h>
++#include <dali-toolkit/public-api/text/text-view.h>
++#include <dali-toolkit/public-api/text/text-view-interface.h>
++#include <dali-toolkit/public-api/text/visual-model.h>
++#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
++#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
++#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h>
++#include <dali-toolkit/public-api/text/rendering/shaders/text-basic-shader.h>
+
#include <dali-toolkit/public-api/transition-effects/cube-transition-effect.h>
#include <dali-toolkit/public-api/transition-effects/cube-transition-wave-effect.h>
#include <dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.h>
#include <dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.h>
#include <dali-toolkit/public-api/dali-toolkit-version.h>
+ #include <dali-toolkit/public-api/enums.h>
- #endif // __DALI_TOOLKIT_EXT_H__
+ #endif // __DALI_TOOLKIT_H__
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include "push-button-impl.h"
namespace Dali
// INTERNAL INCLUDES
#include "push-button-default-painter-impl.h"
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include <dali-toolkit/internal/controls/relayout-helper.h>
namespace Dali
void PushButton::SetLabel( const std::string& label )
{
- Toolkit::TextView textView ( Toolkit::TextView::New( label ) );
- textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); // Make sure our text always fits inside the button
- SetLabel( textView );
+ // TODO
}
void PushButton::SetLabel( Actor label )
size.height = std::max( size.height, imageSize.height );
}
}
-
- // If label, test against it's size
- Toolkit::TextView textView = Toolkit::TextView::DownCast( mLabel );
- if( textView )
- {
- Vector3 textViewSize = textView.GetNaturalSize();
-
- if( widthIsZero )
- {
- size.width = std::max( size.width, textViewSize.width + TEXT_PADDING * 2.0f );
- }
-
- if( heightIsZero )
- {
- size.height = std::max( size.height, textViewSize.height + TEXT_PADDING * 2.0f );
- }
- }
}
return size;
#include "radio-button-impl.h"
// EXTERNAL INCLUDES
-#include <dali/public-api/actors/text-actor.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/scripting/scripting.h>
void RadioButton::SetLabel(const std::string& label)
{
- TextActor textActor = TextActor::DownCast( mLabel );
- if( textActor )
- {
- textActor.SetText( label );
- }
- else
- {
- Toolkit::TextView newTextView = Toolkit::TextView::New( label );
- SetLabel( newTextView );
- }
+ // TODO
RelayoutRequest();
}
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include <dali-toolkit/public-api/controls/buttons/radio-button.h>
#include "button-impl.h"
// title icon layout: the top row, the bottom row and the left column are all for margins
mTitleIconLayout= Toolkit::TableView::New( 3,2 );
SetFixedSizes();
-
- mTitle = Toolkit::TextView::New();
- mTitle.SetTextAlignment( Toolkit::Alignment::HorizontalLeft );
- mTitle.SetWidthExceedPolicy(Toolkit::TextView::ShrinkToFit);
- mSubTitle = Toolkit::TextView::New();
- mSubTitle.SetTextAlignment( Toolkit::Alignment::HorizontalLeft );
- mSubTitle.SetWidthExceedPolicy(Toolkit::TextView::ShrinkToFit);
}
void NavigationTitleBar::Update( Toolkit::Page page )
mLayout.AddChild(mButtonLayout, Toolkit::TableView::CellPosition(0,2));
}
- // add title and subtitle(if exist)
- mTitle.SetText( page.GetTitle() );
- mTitle.SetStyleToCurrentText(mCurrentStyle->titleTextStyle);
- if( page.GetSubTitle().empty() ) //display title
- {
- mTitleLayout.SetFixedHeight( 1,mCurrentStyle->titleHeightWithoutSubtitle - mCurrentStyle->subtitleHeight );
- mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0,2,1) );
- }
- else //display title and subtitle
- {
- mTitleLayout.SetFixedHeight( 1, mCurrentStyle->titleHeightWithSubtitle );
- mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0) );
- mSubTitle.SetText( page.GetSubTitle() );
- mSubTitle.SetStyleToCurrentText(mCurrentStyle->subtitleTextStyle);
- mTitleLayout.AddChild( mSubTitle, Toolkit::TableView::CellPosition(2,0) );
- }
-
// insert title icon to the left of the title(if exist)
if( page.GetTitleIcon() )
{
*/
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
Toolkit::TableView mTitleLayout;
Toolkit::TableView mTitleIconLayout;
- Toolkit::TextView mTitle;
- Toolkit::TextView mSubTitle;
-
};
} // namespace Internal
*/
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
const char* const PROPERTY_TITLE = "title";
const char* const PROPERTY_STATE = "state";
- // Constraints ///////////////////////////////////////////////////////////////////////////
-
/**
- * BackgroundSizeConstraint
- *
* The background size should be at least as big as the Dialog.
* In some cases a background may have graphics which are visible
* outside of the Dialog, e.g. A Shadow. For this we need to alter
* the size of Background.
+ *
+ * @param[in] outerBorder The border to extend beyond parent's Size.
+ * @param[in] parentSize The parent's size
*/
- struct BackgroundSizeConstraint
+ Vector3 BackgroundSize(const Vector4& outerBoarder, const Vector3& parentSize)
{
- /**
- * Constraint that sets size to parent's size plus a border.
- *
- * @param[in] outerBorder The border to extend beyond parent's Size.
- */
- BackgroundSizeConstraint( Vector4 outerBorder )
- : mOuterBorder( outerBorder )
- {
- }
+ Vector3 size( parentSize );
+ size.width += outerBoarder.x + outerBoarder.y;
+ size.height += outerBoarder.z + outerBoarder.w;
- /**
- * (render thread code)
- * @param[in] current The current size.
- * @param[in] parentSizeProperty The parent's size
- */
- Vector3 operator()( const Vector3& current,
- const PropertyInput& parentSizeProperty )
- {
- Vector3 size = parentSizeProperty.GetVector3();
-
- size.width += mOuterBorder.x + mOuterBorder.y;
- size.height += mOuterBorder.z + mOuterBorder.w;
-
- return size;
- }
-
- const Vector4 mOuterBorder; ///< The size of the outer-border (Set to 0.0, 0.0f, 0.0f, 0.0f if doesn't exist).
- };
+ return size;
+ }
- struct ButtonAreaSizeConstraint
- {
/**
- * Constraint that sets size to parent's size plus a border.
+ * sets button area size to parent's size plus a border.
*
* @param[in] outerBorder The border to extend beyond parent's Size.
+ * @param[in] parentSize The parent's size
*/
- ButtonAreaSizeConstraint( Vector4 outerBorder )
- : mOuterBorder( outerBorder )
- {
- }
-
- /**
- * (render thread code)
- * @param[in] current The current size.
- * @param[in] parentSizeProperty The parent's size
- */
- Vector3 operator()( const Vector3& current,
- const PropertyInput& parentSizeProperty )
- {
- Vector3 size = parentSizeProperty.GetVector3();
-
- size.width += mOuterBorder.x + mOuterBorder.y;
- size.width -= (POPUP_OUT_MARGIN_WIDTH + POPUP_OUT_MARGIN_WIDTH);
- size.height = POPUP_BUTTON_BG_HEIGHT;
-
- return size;
- }
+ Vector3 ButtonAreaSize( const Vector4& outBoarder, const Vector3& parentSize )
+ {
+ Vector3 size( parentSize );
+ size.width += outBoarder.x + outBoarder.y;
+ size.width -= (POPUP_OUT_MARGIN_WIDTH + POPUP_OUT_MARGIN_WIDTH);
+ size.height = POPUP_BUTTON_BG_HEIGHT;
- const Vector4 mOuterBorder; ///< The size of the outer-border (Set to 0.0, 0.0f, 0.0f, 0.0f if doesn't exist).
- };
+ return size;
+ }
} // unnamed namespace
mLayer.SetParentOrigin(ParentOrigin::CENTER);
mLayer.SetAnchorPoint(AnchorPoint::CENTER);
mLayer.RaiseToTop();
- mLayer.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
self.Add(mLayer);
mPopupBg = Actor::New();
mPopupBg.SetParentOrigin(ParentOrigin::CENTER);
mPopupBg.SetAnchorPoint(AnchorPoint::CENTER);
- mPopupBg.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
mLayer.Add(mPopupBg);
// Any content after this point which is added to Self() will be reparented to
void Popup::SetTitle( const std::string& text )
{
- Toolkit::TextView titleActor = Toolkit::TextView::New();
- titleActor.SetText( text );
- titleActor.SetColor( Color::BLACK );
- titleActor.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
- titleActor.SetWidthExceedPolicy( Toolkit::TextView::Split );
- titleActor.SetLineJustification( Toolkit::TextView::Center );
-
- SetTitle( titleActor );
-}
-
-void Popup::SetTitle( Toolkit::TextView titleActor )
-{
- // Replaces the current title actor.
- if( mTitle && mPopupBg )
- {
- mPopupBg.Remove( mTitle );
- }
- mTitle = titleActor;
-
- mPopupBg.Add( mTitle );
-
- RelayoutRequest();
}
-Toolkit::TextView Popup::GetTitle() const
+const std::string& Popup::GetTitle() const
{
- return mTitle;
+ static std::string temp("");
+ return temp;
}
void Popup::AddButton( Toolkit::Button button )
}
}
+ void Popup::OnControlSizeSet( const Vector3& targetSize )
+ {
+ mLayer.SetSize( targetSize );
+ mPopupBg.SetSize( targetSize );
+
+ const Vector4 outerBorder = mPopupStyle->backgroundOuterBorder;
+ if( mBackgroundImage )
+ {
+ mBackgroundImage.SetSize( BackgroundSize( outerBorder,targetSize ) );
+ }
+ if( mButtonAreaImage )
+ {
+ mButtonAreaImage.SetSize( ButtonAreaSize( outerBorder, targetSize ) );
+ }
+
+ }
+
void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
// Set the popup size
if( mBackgroundImage )
{
- Constraint constraint = Constraint::New<Vector3>( Actor::SIZE,
- ParentSource( Actor::SIZE ),
- BackgroundSizeConstraint(outerBorder) );
-
- mBackgroundImage.RemoveConstraints();
- mBackgroundImage.ApplyConstraint( constraint );
-
+ mBackgroundImage.SetSize(BackgroundSize(outerBorder, Vector3(size)));
mBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
mBackgroundImage.SetPosition( -outerBorder.x, -outerBorder.y, 0.0f );
}
else
{
- Constraint constraint = Constraint::New<Vector3>( Actor::SIZE,
- ParentSource( Actor::SIZE ),
- ButtonAreaSizeConstraint(outerBorder) );
-
- mButtonAreaImage.RemoveConstraints();
- mButtonAreaImage.ApplyConstraint( constraint );
-
+ mButtonAreaImage.SetSize( ButtonAreaSize(outerBorder, Vector3(size)) );
mButtonAreaImage.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
mButtonAreaImage.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
mButtonAreaImage.SetY( -outerBorder.z - POPUP_OUT_MARGIN_HEIGHT );
// Relayout title
Vector3 positionOffset( 0.0f, mPopupStyle->margin + POPUP_OUT_MARGIN_WIDTH, CONTENT_DEPTH );
- if( mTitle )
- {
- Vector2 titleSize;
- titleSize.width = popupSize.width;
- titleSize.height = mTitle.GetHeightForWidth( titleSize.width );
-
- // As the default size policy for text-view is Fixed & Fixed, a size needs to be set.
- // Otherwise size-negotiation algorithm uses the GetNaturalSize() with doesn't take
- // into account the multiline and exceed policies, giving as result a wrong size.
- mTitle.SetSize( titleSize );
- Relayout( mTitle, titleSize, container );
-
- mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER );
- mTitle.SetPosition( positionOffset );
-
- positionOffset.y += titleSize.height + mPopupStyle->margin;
- }
+ // TODO
// Relayout content
if( mContent )
Vector3 Popup::GetNaturalSize()
{
float margin = 2.0f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin );
+ const float maxWidth = Stage::GetCurrent().GetSize().width - margin;
Vector3 naturalSize( 0.0f, 0.0f, 0.0f );
- if ( mTitle )
- {
- Vector3 titleNaturalSize = mTitle.GetImplementation().GetNaturalSize();
- // Buffer to avoid errors. The width of the popup could potentially be the width of the title text.
- // It was observed in this case that text wrapping was then inconsistent when seen on device
- const float titleBuffer = 0.5f;
- titleNaturalSize.width += titleBuffer;
-
- // As TextView GetNaturalSize does not take wrapping into account, limit the width
- // to that of the stage
- if( titleNaturalSize.width >= maxWidth)
- {
- naturalSize.width = maxWidth;
- naturalSize.height = mTitle.GetImplementation().GetHeightForWidth( naturalSize.width );
- }
- else
- {
- naturalSize += titleNaturalSize;
- }
-
- naturalSize.height += mPopupStyle->margin;
- }
-
if( mContent )
{
Vector3 contentSize = RelayoutHelper::GetNaturalSize( mContent );
// Choose the biggest width
naturalSize.width = std::max( naturalSize.width, contentSize.width );
+ if( naturalSize.width > maxWidth )
+ {
+ naturalSize.width = maxWidth;
+ contentSize.height = RelayoutHelper::GetHeightForWidth( mContent, maxWidth );
+ }
naturalSize.height += contentSize.height + mPopupStyle->margin;
}
float height( 0.0f );
float popupWidth( width - 2.f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin ) );
- if ( mTitle )
- {
- height += mTitle.GetImplementation().GetHeightForWidth( popupWidth );
- height += mPopupStyle->margin;
- }
-
if( mContent )
{
height += RelayoutHelper::GetHeightForWidth( mContent, popupWidth ) + mPopupStyle->margin;
void SetTitle( const std::string& text );
/**
- * @copydoc Toolkit::Popup::SetTitle( TextView titleActor )
- */
- void SetTitle( Toolkit::TextView titleActor );
-
- /**
* @copydoc Toolkit::Popup::GetTitle
*/
- Toolkit::TextView GetTitle() const;
+ const std::string& GetTitle() const;
/**
* @copydoc Toolkit::Popup::AddButton
virtual void OnControlChildAdd( Actor& child );
/**
- * @copydoc Control::OnRelayout()
+ * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& size )
+ */
+ virtual void OnControlSizeSet( const Vector3& size );
+
+ /**
+ * @copydoc Control::OnRelayOut()
*/
virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
Actor mBackgroundImage; ///< Stores the background image.
Actor mButtonAreaImage; ///< Stores the button background image.
- Toolkit::TextView mTitle; ///< Stores the text title.
Actor mContent; ///< Stores popup's content.
Actor mBottomBg; ///< bottom button bar background. ImageActor is replaced with Actor due to hidden image.
Actor mTailImage; ///< Stores the tail image
#include <sstream>
#endif // defined(DEBUG_ENABLED)
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
-
namespace Dali
{
#include "dali-toolkit/public-api/controls/control.h"
#include "dali-toolkit/public-api/controls/control-impl.h"
-#include "dali-toolkit/public-api/controls/text-view/text-view.h"
namespace Dali
{
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/actors/text-actor.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
Image image = imageActor.GetImage();
size = Vector3( static_cast<float>( image.GetWidth() ), static_cast<float>( image.GetHeight() ), depth );
}
- else
- {
- // Get natural size for TextActor.
- TextActor textActor = TextActor::DownCast( actor );
- if( textActor )
- {
- Font font = textActor.GetFont();
- if( !font )
- {
- font = Font::New();
- }
- size = font.MeasureText( textActor.GetText() );
- size.depth = depth;
- }
- }
}
return size;
}
else
{
- TextActor textActor = TextActor::DownCast( actor );
- if( textActor )
- {
- Font font = textActor.GetFont();
- if( !font )
- {
- font = Font::New();
- }
- size = font.MeasureText( textActor.GetText() );
-
- constrainSize = true;
- }
- else
- {
- size = actor.GetCurrentSize();
- }
+ size = actor.GetCurrentSize();
}
// Scale the actor
mMarkSignal.Emit( self, markIndex );
}
}
-
- if( mHandleValueTextView )
- {
- std::stringstream ss;
- ss.precision( GetValuePrecision() );
- ss << std::fixed << clampledValue;
- mHandleValueTextView.SetText( ss.str() );
- }
}
void Slider::SetMarks( const MarkList& marks )
return arrow;
}
-Toolkit::TextView Slider::CreatePopupText()
-{
- Toolkit::TextView textView = Toolkit::TextView::New();
- textView.SetParentOrigin( ParentOrigin::CENTER );
- textView.SetAnchorPoint( AnchorPoint::CENTER );
- textView.SetSizePolicy( Toolkit::Control::Flexible, Toolkit::Control::Flexible );
- textView.SetZ( VALUE_DISPLAY_TEXT_Z );
- return textView;
-}
+//Toolkit::TextView Slider::CreatePopupText()
+//{
+//}
ImageActor Slider::CreatePopup()
{
popup.SetParentOrigin( ParentOrigin::TOP_CENTER );
popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- mValueTextView = CreatePopupText();
- popup.Add( mValueTextView );
-
return popup;
}
void Slider::CreateHandleValueDisplay()
{
- if( mHandle && !mHandleValueTextView )
- {
- mHandleValueTextView = Toolkit::TextView::New();
- mHandleValueTextView.SetParentOrigin( ParentOrigin::CENTER );
- mHandleValueTextView.SetAnchorPoint( AnchorPoint::CENTER );
- mHandleValueTextView.SetSize( GetHandleRegion() );
- mHandleValueTextView.SetZ( HANDLE_VALUE_DISPLAY_TEXT_Z );
- mHandle.Add( mHandleValueTextView );
- }
}
void Slider::DestroyHandleValueDisplay()
{
- if(mHandleValueTextView)
- {
- mHandleValueTextView.Unparent();
- mHandleValueTextView.Reset();
- }
}
void Slider::SetPopupTextColor( const Vector4& color )
void Slider::DisplayPopup( float value )
{
- // Value displayDoConnectSignal
- if( mValueTextView )
- {
- std::stringstream ss;
- ss.precision( GetValuePrecision() );
- ss << std::fixed << value;
- mValueTextView.SetText( ss.str() );
- TextStyle style;
- style.SetTextColor( GetPopupTextColor() );
- mValueTextView.SetStyleToCurrentText( style, TextStyle::COLOR);
-
- if( mValueDisplay )
- {
- Font font = Font::New();
- float popupWidth = font.MeasureText( ss.str() ).x + VALUE_POPUP_MARGIN * 2.0f;
- if( popupWidth < VALUE_POPUP_MIN_WIDTH )
- {
- popupWidth = VALUE_POPUP_MIN_WIDTH;
- }
-
- mPopup.SetSize( popupWidth, VALUE_POPUP_HEIGHT );
- mValueDisplay.SetVisible( true );
-
- mValueTimer.SetInterval( VALUE_VIEW_SHOW_DURATION );
- }
- }
}
void Slider::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/slider/slider.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
namespace Dali
{
*
* @return The textview created for the popup
*/
- Toolkit::TextView CreatePopupText();
+ //Toolkit::TextView CreatePopupText();
/**
* Create the value display for the slider
ImageActor mPopup; ///< Popup backing
ImageActor mPopupArrow; ///< Popup arrow backing
- Toolkit::TextView mValueTextView; //< The text value in popup
- Toolkit::TextView mHandleValueTextView; ///< The text value on handle
Vector2 mHandleLastTouchPoint; ///< The last touch point for the handle
Timer mValueTimer; ///< Timer used to hide value view
--- /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 <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
+#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h> // TODO - Get from RendererFactory
+
+using Dali::Toolkit::Text::LayoutEngine;
+
+namespace
+{
+
+} // namespace
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+const Property::Index TextLabel::PROPERTY_TEXT( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX );
+const Property::Index TextLabel::PROPERTY_MULTI_LINE( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 1 );
+
+namespace Internal
+{
+
+namespace
+{
+
+// Type registration
+BaseHandle Create()
+{
+ return Toolkit::TextLabel::New();
+}
+
+TypeRegistration mType( typeid(Toolkit::TextLabel), typeid(Toolkit::Control), Create );
+
+PropertyRegistration property1( mType, "text", Toolkit::TextLabel::PROPERTY_TEXT, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
+PropertyRegistration property2( mType, "multi-line", Toolkit::TextLabel::PROPERTY_MULTI_LINE, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
+
+} // namespace
+
+Toolkit::TextLabel TextLabel::New()
+{
+ // Create the implementation, temporarily owned by this handle on stack
+ IntrusivePtr< TextLabel > impl = new TextLabel();
+
+ // Pass ownership to CustomActor handle
+ Toolkit::TextLabel handle( *impl );
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ impl->Initialize();
+
+ return handle;
+}
+
+void TextLabel::SetRenderer( Text::RendererPtr renderer )
+{
+ mRenderer = renderer;
+}
+
+void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
+
+ if( label )
+ {
+ TextLabel& labelImpl( GetImpl( label ) );
+ switch( index )
+ {
+ case Toolkit::TextLabel::PROPERTY_TEXT:
+ {
+ labelImpl.SetText( value.Get< std::string >() );
+ break;
+ }
+ case Toolkit::TextLabel::PROPERTY_MULTI_LINE:
+ {
+ labelImpl.SetMultiLine( value.Get< bool >() );
+ break;
+ }
+ }
+ }
+}
+
+Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index )
+{
+ Property::Value value;
+
+ Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
+
+ if( label )
+ {
+ switch( index )
+ {
+ case Toolkit::TextLabel::PROPERTY_TEXT:
+ {
+ DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
+ break;
+ }
+ }
+ }
+
+ return value;
+}
+
+void TextLabel::OnInitialize()
+{
+ mController = Text::Controller::New();
+}
+
+void TextLabel::OnRelayout( const Vector2& size, ActorSizeContainer& container )
+{
+ if( mController->Relayout( size ) )
+ {
+ if( !mRenderer )
+ {
+ // TODO - Get from RendererFactory
+ mRenderer = Dali::Toolkit::Text::BasicRenderer::New();
+ }
+
+ if( mRenderer )
+ {
+ Actor renderableActor = mRenderer->Render( mController->GetView() );
+
+ if( renderableActor )
+ {
+ Self().Add( renderableActor );
+ }
+ }
+ }
+}
+
+void TextLabel::SetText( const std::string& text )
+{
+ if( mController )
+ {
+ // The Controller updates the View for the renderer
+ mController->SetText( text );
+ }
+}
+
+void TextLabel::SetMultiLine( bool multiLine )
+{
+ if( mController )
+ {
+ if( multiLine )
+ {
+ mController->GetLayoutEngine().SetLayout( LayoutEngine::MULTI_LINE_BOX );
+ }
+ else
+ {
+ mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
+ }
+ }
+}
+
+TextLabel::TextLabel()
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )
+{
+}
+
+TextLabel::~TextLabel()
+{
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
+#define __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/text/text-controller.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * @brief A control which renders a short text string.
+ */
+class TextLabel : public Control
+{
+public:
+
+ // Properties
+ enum
+ {
+ TEXTLABEL_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+ TEXTLABEL_PROPERTY_END_INDEX = TEXTLABEL_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
+ };
+
+ /**
+ * @copydoc Dali::Toollkit::TextLabel::New()
+ */
+ static Toolkit::TextLabel New();
+
+ /**
+ * @copydoc Dali::Toollkit::TextLabel::SetRenderer()
+ */
+ void SetRenderer( Text::RendererPtr renderer );
+
+ // Properties
+
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Property::Value GetProperty( BaseObject* object, Property::Index index );
+
+private: // From Control
+
+ /**
+ * @copydoc Control::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
+ * @copydoc Control::OnInitialize()
+ */
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
+
+private: // Implementation
+
+ /**
+ * Helper for SetProperty.
+ * @param[in] text The new "text" property value.
+ */
+ void SetText( const std::string& text );
+
+ /**
+ * Helper for SetProperty.
+ * @param[in] multiLine The new "multi-line" property value.
+ */
+ void SetMultiLine( bool multiLine );
+
+ /**
+ * Construct a new TextLabel.
+ */
+ TextLabel();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TextLabel();
+
+private:
+
+ // Undefined copy constructor and assignment operators
+ TextLabel(const TextLabel&);
+ TextLabel& operator=(const TextLabel& rhs);
+
+private: // Data
+
+ Text::ControllerPtr mController;
+ Text::RendererPtr mRenderer;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Toolkit::Internal::TextLabel& GetImpl( Toolkit::TextLabel& textLabel )
+{
+ DALI_ASSERT_ALWAYS(textLabel);
+
+ Dali::RefObject& handle = textLabel.GetImplementation();
+
+ return static_cast<Toolkit::Internal::TextLabel&>(handle);
+}
+
+inline const Toolkit::Internal::TextLabel& GetImpl( const Toolkit::TextLabel& textLabel )
+{
+ DALI_ASSERT_ALWAYS(textLabel);
+
+ const Dali::RefObject& handle = textLabel.GetImplementation();
+
+ return static_cast<const Toolkit::Internal::TextLabel&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
--- /dev/null
- $(toolkit_src_dir)/controls/text-input/text-input-decorator-impl.cpp \
- $(toolkit_src_dir)/controls/text-input/text-input-handles-impl.cpp \
- $(toolkit_src_dir)/controls/text-input/text-input-impl.cpp \
- $(toolkit_src_dir)/controls/text-input/text-input-popup-impl.cpp \
- $(toolkit_src_dir)/controls/text-input/text-input-text-highlight-impl.cpp \
- $(toolkit_src_dir)/controls/text-view/relayout-utilities.cpp \
- $(toolkit_src_dir)/controls/text-view/split-by-char-policies.cpp \
- $(toolkit_src_dir)/controls/text-view/split-by-new-line-char-policies.cpp \
- $(toolkit_src_dir)/controls/text-view/split-by-word-policies.cpp \
- $(toolkit_src_dir)/controls/text-view/text-actor-cache.cpp \
- $(toolkit_src_dir)/controls/text-view/text-processor-bidirectional-info.cpp \
- $(toolkit_src_dir)/controls/text-view/text-processor.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-character-processor.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-impl.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-paragraph-processor.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-processor-dbg.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-processor-helper-functions.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-processor.cpp \
- $(toolkit_src_dir)/controls/text-view/text-view-word-processor.cpp \
+ # Add local source files here
+
+ toolkit_src_files = \
+ $(toolkit_src_dir)/builder/builder-actor.cpp \
+ $(toolkit_src_dir)/builder/builder-animations.cpp \
+ $(toolkit_src_dir)/builder/builder-impl.cpp \
+ $(toolkit_src_dir)/builder/builder-set-property.cpp \
+ $(toolkit_src_dir)/builder/builder-signals.cpp \
+ $(toolkit_src_dir)/builder/json-parser-state.cpp \
+ $(toolkit_src_dir)/builder/json-parser-impl.cpp \
+ $(toolkit_src_dir)/builder/tree-node-manipulator.cpp \
+ $(toolkit_src_dir)/builder/replacement.cpp \
+ $(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \
+ $(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
+ $(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/button-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/check-box-button-default-painter-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/check-box-button-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/push-button-default-painter-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/push-button-impl.cpp \
+ $(toolkit_src_dir)/controls/buttons/radio-button-impl.cpp \
+ $(toolkit_src_dir)/controls/cluster/cluster-impl.cpp \
+ $(toolkit_src_dir)/controls/cluster/cluster-style-impl.cpp \
+ $(toolkit_src_dir)/controls/effects-view/effects-view-impl.cpp \
+ $(toolkit_src_dir)/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp \
+ $(toolkit_src_dir)/controls/image-view/masked-image-view-impl.cpp \
+ $(toolkit_src_dir)/controls/magnifier/magnifier-impl.cpp \
+ $(toolkit_src_dir)/controls/navigation-frame/navigation-bar.cpp \
+ $(toolkit_src_dir)/controls/navigation-frame/navigation-control-impl.cpp \
+ $(toolkit_src_dir)/controls/navigation-frame/navigation-title-bar.cpp \
+ $(toolkit_src_dir)/controls/navigation-frame/navigation-tool-bar.cpp \
+ $(toolkit_src_dir)/controls/navigation-frame/page-impl.cpp \
+ $(toolkit_src_dir)/controls/popup/popup-impl.cpp \
+ $(toolkit_src_dir)/controls/popup/popup-style-impl.cpp \
+ $(toolkit_src_dir)/controls/page-turn-view/page-turn-portrait-view-impl.cpp \
+ $(toolkit_src_dir)/controls/page-turn-view/page-turn-landscape-view-impl.cpp \
+ $(toolkit_src_dir)/controls/page-turn-view/page-turn-view-impl.cpp \
+ $(toolkit_src_dir)/controls/relayout-controller-impl.cpp \
+ $(toolkit_src_dir)/controls/relayout-controller.cpp \
+ $(toolkit_src_dir)/controls/relayout-helper.cpp \
+ $(toolkit_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \
+ $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal-impl.cpp \
+ $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal.cpp \
+ $(toolkit_src_dir)/controls/scrollable/bouncing-effect-actor.cpp \
+ $(toolkit_src_dir)/controls/scrollable/item-view/item-view-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scrollable-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-connector-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-base-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-helper-functions.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp \
+ $(toolkit_src_dir)/controls/shadow-view/shadow-view-impl.cpp \
+ $(toolkit_src_dir)/controls/slider/slider-impl.cpp \
+ $(toolkit_src_dir)/controls/super-blur-view/super-blur-view-impl.cpp \
+ $(toolkit_src_dir)/controls/table-view/table-view-impl.cpp \
++ $(toolkit_src_dir)/controls/text-controls/text-label-impl.cpp \
+ $(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \
+ $(toolkit_src_dir)/controls/view/view-impl.cpp \
+ $(toolkit_src_dir)/focus-manager/focus-manager-impl.cpp \
+ $(toolkit_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
+ $(toolkit_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
+ $(toolkit_src_dir)/filters/blur-two-pass-filter.cpp \
+ $(toolkit_src_dir)/filters/emboss-filter.cpp \
+ $(toolkit_src_dir)/filters/image-filter.cpp \
+ $(toolkit_src_dir)/filters/spread-filter.cpp \
+ $(toolkit_src_dir)/shader-effects/page-turn-effect-impl.cpp \
+ $(toolkit_src_dir)/shader-effects/water-effect-impl.cpp \
+ $(toolkit_src_dir)/styling/style-manager-impl.cpp \
++ $(toolkit_src_dir)/text/multi-language-support-impl.cpp \
+ $(toolkit_src_dir)/transition-effects/cube-transition-effect-impl.cpp \
+ $(toolkit_src_dir)/transition-effects/cube-transition-cross-effect-impl.cpp \
+ $(toolkit_src_dir)/transition-effects/cube-transition-fold-effect-impl.cpp \
+ $(toolkit_src_dir)/transition-effects/cube-transition-wave-effect-impl.cpp
+
--- /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 <dali-toolkit/internal/text/multi-language-support-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/singleton-service.h>
+#include <dali-toolkit/public-api/text/logical-model.h>
+#include <dali-toolkit/public-api/text/font-run.h>
+#include <dali-toolkit/public-api/text/script.h>
+#include <dali-toolkit/public-api/text/script-run.h>
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal
+{
+
+/**
+ * @brief Retrieves the font Id from the font run for a given character's @p index.
+ *
+ * If the character's index exceeds the current font run it increases the iterator to get the next one.
+ *
+ * @param[in] index The character's index.
+ * @param[in,out] fontRunIt Iterator to the current font run.
+ * @param[in] fontRunEndIt Iterator to one after the last font run.
+ *
+ * @return The font id.
+ */
+FontId GetFontId( Length index,
+ Vector<FontRun>::ConstIterator& fontRunIt,
+ const Vector<FontRun>::ConstIterator& fontRunEndIt )
+{
+ FontId fontId = 0u;
+
+ if( fontRunIt != fontRunEndIt )
+ {
+ const FontRun& fontRun = *fontRunIt;
+
+ if( ( index >= fontRun.characterRun.characterIndex ) &&
+ ( index < fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters ) )
+ {
+ fontId = fontRun.fontId;
+ }
+
+ if( index == fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters )
+ {
+ // All the characters of the current run have been traversed. Get the next one for the next iteration.
+ ++fontRunIt;
+ }
+ }
+
+ return fontId;
+}
+
+/**
+ * @brief Retrieves the script Id from the script run for a given character's @p index.
+ *
+ * If the character's index exceeds the current script run it increases the iterator to get the next one.
+ *
+ * @param[in] index The character's index.
+ * @param[in,out] scriptRunIt Iterator to the current font run.
+ * @param[in] scriptRunEndIt Iterator to one after the last script run.
+ *
+ * @return The script.
+ */
+Script GetScript( Length index,
+ Vector<ScriptRun>::ConstIterator& scriptRunIt,
+ const Vector<ScriptRun>::ConstIterator& scriptRunEndIt )
+{
+ Script script = TextAbstraction::UNKNOWN;
+
+ if( scriptRunIt != scriptRunEndIt )
+ {
+ const ScriptRun& scriptRun = *scriptRunIt;
+
+ if( ( index >= scriptRun.characterRun.characterIndex ) &&
+ ( index < scriptRun.characterRun.characterIndex + scriptRun.characterRun.numberOfCharacters ) )
+ {
+ script = scriptRun.script;
+ }
+
+ if( index == scriptRun.characterRun.characterIndex + scriptRun.characterRun.numberOfCharacters )
+ {
+ // All the characters of the current run have been traversed. Get the next one for the next iteration.
+ ++scriptRunIt;
+ }
+ }
+
+ return script;
+}
+
+bool ValidateFontsPerScript::FindValidFont( FontId fontId ) const
+{
+ for( Vector<FontId>::ConstIterator it = mValidFonts.Begin(),
+ endIt = mValidFonts.End();
+ it != endIt;
+ ++it )
+ {
+ if( fontId == *it )
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+MultilanguageSupport::MultilanguageSupport()
+: mDefaultFontPerScriptCache(),
+ mValidFontsPerScriptCache()
+{
+ // Initializes the default font cache to zero (invalid font).
+ // Reserves space to cache the default fonts and access them with the script as an index.
+ mDefaultFontPerScriptCache.Resize( TextAbstraction::UNKNOWN, 0u );
+
+ // Initializes the valid fonts cache to NULL (no valid fonts).
+ // Reserves space to cache the valid fonts and access them with the script as an index.
+ mValidFontsPerScriptCache.Resize( TextAbstraction::UNKNOWN, NULL );
+}
+
+MultilanguageSupport::~MultilanguageSupport()
+{
+ // Destroy the valid fonts per script cache.
+
+ for( Vector<ValidateFontsPerScript*>::Iterator it = mValidFontsPerScriptCache.Begin(),
+ endIt = mValidFontsPerScriptCache.End();
+ it != endIt;
+ ++it )
+ {
+ delete *it;
+ }
+}
+
+Text::MultilanguageSupport MultilanguageSupport::Get()
+{
+ Text::MultilanguageSupport multilanguageSupportHandle;
+
+ SingletonService service( SingletonService::Get() );
+ if( service )
+ {
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = service.GetSingleton( typeid( Text::MultilanguageSupport ) );
+ if( handle )
+ {
+ // If so, downcast the handle
+ MultilanguageSupport* impl = dynamic_cast< Internal::MultilanguageSupport* >( handle.GetObjectPtr() );
+ multilanguageSupportHandle = Text::MultilanguageSupport( impl );
+ }
+ else // create and register the object
+ {
+ multilanguageSupportHandle = Text::MultilanguageSupport( new MultilanguageSupport );
+ service.Register( typeid( multilanguageSupportHandle ), multilanguageSupportHandle );
+ }
+ }
+
+ return multilanguageSupportHandle;
+}
+
+void MultilanguageSupport::SetScripts( LogicalModel& model )
+{
+ // 1) Retrieve the text from the model.
+ const Length numberOfCharacters = model.GetNumberOfCharacters();
+
+ if( 0u == numberOfCharacters )
+ {
+ // Nothing to do if there are no characters.
+ return;
+ }
+
+ Vector<Character> text;
+ text.Resize( numberOfCharacters );
+
+ model.GetText( 0u,
+ text.Begin(),
+ numberOfCharacters );
+
+ // 2) Traverse all characters and set the scripts.
+
+ // Stores the current script run.
+ ScriptRun currentScriptRun;
+ currentScriptRun.characterRun.characterIndex = 0u;
+ currentScriptRun.characterRun.numberOfCharacters = 0u;
+ currentScriptRun.script = TextAbstraction::UNKNOWN;
+
+ // Temporary stores the script runs.
+ std::vector<ScriptRun> scriptRuns;
+ scriptRuns.reserve( numberOfCharacters << 2u ); // To reduce the number of reallocations.
+
+ for( Vector<Character>::ConstIterator it = text.Begin(),
+ endIt = text.End();
+ it != endIt;
+ ++it )
+ {
+ const Character character = *it;
+
+ Script script = GetCharacterScript( character );
+
+ if( TextAbstraction::UNKNOWN == script )
+ {
+ script = TextAbstraction::LATIN;
+ DALI_ASSERT_DEBUG( !"MultilanguageSupport::SetScripts. Unkown script!" );
+ }
+
+ if( script != currentScriptRun.script )
+ {
+ // Current run needs to be stored and a new one initialized.
+
+ if( 0u != currentScriptRun.characterRun.numberOfCharacters )
+ {
+ // Store the script run.
+ scriptRuns.push_back( currentScriptRun );
+ }
+
+ // Initialize the new one.
+ currentScriptRun.characterRun.characterIndex = currentScriptRun.characterRun.characterIndex + currentScriptRun.characterRun.numberOfCharacters;
+ currentScriptRun.characterRun.numberOfCharacters = 0u;
+ currentScriptRun.script = script;
+ }
+
+ // Add one more character to the run.
+ ++currentScriptRun.characterRun.numberOfCharacters;
+ }
+
+ if( 0u != currentScriptRun.characterRun.numberOfCharacters )
+ {
+ // Store the last run.
+ scriptRuns.push_back( currentScriptRun );
+ }
+
+ // 3) Set the script runs into the model.
+
+ model.SetScripts( &scriptRuns[0u],
+ scriptRuns.size() );
+}
+
+void MultilanguageSupport::ValidateFonts( LogicalModel& model )
+{
+ // 1) Retrieve the text from the model.
+ const Length numberOfCharacters = model.GetNumberOfCharacters();
+
+ if( 0u == numberOfCharacters )
+ {
+ // Nothing to do if there are no characters.
+ return;
+ }
+
+ Vector<Character> text;
+ text.Resize( numberOfCharacters );
+
+ Character* textBuffer = text.Begin();
+ model.GetText( 0u,
+ textBuffer,
+ numberOfCharacters );
+
+ // 2) Retrieve any font previously set.
+
+ const Length numberOfFontRuns = model.GetNumberOfFontRuns( 0u, numberOfCharacters );
+
+ Vector<FontRun> fontRuns;
+ fontRuns.Reserve( numberOfFontRuns );
+
+ FontRun* fontRunsBuffer = fontRuns.Begin();
+ model.GetFontRuns( fontRunsBuffer,
+ 0u,
+ numberOfCharacters );
+
+ // 3) Retrieve the scripts from the model.
+
+ const Length numberOfScriptRuns = model.GetNumberOfScriptRuns( 0u, numberOfCharacters );
+
+ Vector<ScriptRun> scriptRuns;
+ scriptRuns.Reserve( numberOfScriptRuns );
+
+ ScriptRun* scriptRunsBuffer = scriptRuns.Begin();
+ model.GetScriptRuns( scriptRunsBuffer,
+ 0u,
+ numberOfCharacters );
+
+ // 4) Traverse the characters and validate/set the fonts.
+
+ // Get the caches.
+ FontId* defaultFontPerScriptCacheBuffer = mDefaultFontPerScriptCache.Begin();
+ ValidateFontsPerScript** validFontsPerScriptCacheBuffer = mValidFontsPerScriptCache.Begin();
+
+ // Stores the validated font runs.
+ Vector<FontRun> validatedFontRuns;
+ validatedFontRuns.Reserve( numberOfFontRuns );
+
+ // Initializes a validated font run.
+ FontRun currentFontRun;
+ currentFontRun.characterRun.characterIndex = 0u;
+ currentFontRun.characterRun.numberOfCharacters = 0u;
+ currentFontRun.fontId = 0u;
+ currentFontRun.isDefault = false;
+
+ // Get the font client.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ // Iterators of the font and script runs.
+ Vector<FontRun>::ConstIterator fontRunIt = fontRuns.Begin();
+ Vector<FontRun>::ConstIterator fontRunEndIt = fontRuns.End();
+ Vector<ScriptRun>::ConstIterator scriptRunIt = scriptRuns.Begin();
+ Vector<ScriptRun>::ConstIterator scriptRunEndIt = scriptRuns.End();
+
+ for( Length index = 0u; index < numberOfCharacters; ++index )
+ {
+ // Get the character.
+ const Character character = *( textBuffer + index );
+
+ // Get the font for the character.
+ FontId fontId = GetFontId( index,
+ fontRunIt,
+ fontRunEndIt );
+
+ // Get the script for the character.
+ Script script = GetScript( index,
+ scriptRunIt,
+ scriptRunEndIt );
+
+ if( TextAbstraction::UNKNOWN == script )
+ {
+ DALI_LOG_WARNING( "MultilanguageSupport::ValidateFonts. Unknown script!" );
+ script = TextAbstraction::LATIN;
+ }
+
+ // Whether the font being validated is a default one not set by the user.
+ const bool isDefault = ( 0u == fontId );
+
+ // The default font point size.
+ PointSize26Dot6 pointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
+
+ if( !isDefault )
+ {
+ // Validate if the font set by the user supports the character.
+
+ // Check first in the caches.
+
+ // The user may have set the default font. Check it. Otherwise check in the valid fonts cache.
+ if( fontId != *( defaultFontPerScriptCacheBuffer + script ) )
+ {
+ // Check in the valid fonts cache.
+ ValidateFontsPerScript* validateFontsPerScript = *( validFontsPerScriptCacheBuffer + script );
+ if( NULL != validateFontsPerScript )
+ {
+ if( !validateFontsPerScript->FindValidFont( fontId ) )
+ {
+ // Use the font client to validate the font.
+ const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+
+ if( 0u == glyphIndex )
+ {
+ // Get the point size of the current font. It will be used to get a default font id.
+ pointSize = fontClient.GetPointSize( fontId );
+
+ // The font is not valid. Set to zero and a default one will be set.
+ fontId = 0u;
+ }
+ else
+ {
+ // Add the font to the valid font cache.
+ validateFontsPerScript->mValidFonts.PushBack( fontId );
+ }
+ }
+ }
+ else
+ {
+ // Use the font client to validate the font.
+ const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+
+ if( 0u == glyphIndex )
+ {
+ // Get the point size of the current font. It will be used to get a default font id.
+ pointSize = fontClient.GetPointSize( fontId );
+
+ // The font is not valid. Set to zero and a default one will be set.
+ fontId = 0u;
+ }
+ else
+ {
+ // Add the font to the valid font cache.
+ validateFontsPerScript = new ValidateFontsPerScript();
+ *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript;
+
+ validateFontsPerScript->mValidFonts.PushBack( fontId );
+ }
+ }
+ }
+ }
+
+ // The font has not been validated. Find a default one.
+ if( 0u == fontId )
+ {
+ // The character has no font assigned. Get a default one from the cache
+ fontId = *( defaultFontPerScriptCacheBuffer + script );
+
+ // If the cache has not a default font, get one from the font client.
+ if( 0u == fontId )
+ {
+ // Find a default font.
+ fontId = fontClient.FindDefaultFont( character, pointSize );
+
+ // Cache the font.
+ *( defaultFontPerScriptCacheBuffer + script ) = fontId;
+ }
+ }
+
+ // The font is now validated.
+
+ if( ( fontId != currentFontRun.fontId ) ||
+ ( isDefault != currentFontRun.isDefault ) )
+ {
+ // Current run needs to be stored and a new one initialized.
+
+ if( 0u != currentFontRun.characterRun.numberOfCharacters )
+ {
+ // Store the font run.
+ validatedFontRuns.PushBack( currentFontRun );
+ }
+
+ // Initialize the new one.
+ currentFontRun.characterRun.characterIndex = currentFontRun.characterRun.characterIndex + currentFontRun.characterRun.numberOfCharacters;
+ currentFontRun.characterRun.numberOfCharacters = 0u;
+ currentFontRun.fontId = fontId;
+ currentFontRun.isDefault = isDefault;
+ }
+
+ // Add one more character to the run.
+ ++currentFontRun.characterRun.numberOfCharacters;
+ }
+
+ if( 0u != currentFontRun.characterRun.numberOfCharacters )
+ {
+ // Store the last run.
+ validatedFontRuns.PushBack( currentFontRun );
+ }
+
+ // 5) Sets the validated font runs to the model.
+ model.SetFonts( validatedFontRuns.Begin(),
+ validatedFontRuns.Count() );
+}
+
+} // namespace Internal
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__
+#define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/multi-language-support.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal
+{
+
+/**
+ * @brief Stores valid font ids per script.
+ */
+struct ValidateFontsPerScript
+{
+ /**
+ * Default constructor.
+ */
+ ValidateFontsPerScript()
+ : mValidFonts()
+ {}
+
+ /**
+ * Default destructor.
+ */
+ ~ValidateFontsPerScript()
+ {}
+
+ /**
+ * @brief Whether the given @p fontId is in the vector of valid fonts.
+ *
+ * @param[in] fontId The font id.
+ *
+ * @return @e true if the font is in the vector of valid fonts.
+ */
+ bool FindValidFont( FontId fontId ) const;
+
+ Vector<FontId> mValidFonts;
+};
+
+/**
+ * @brief Multi-language support implementation. @see Text::MultilanguageSupport.
+ */
+class MultilanguageSupport : public BaseObject
+{
+public:
+
+ /**
+ * Constructor
+ */
+ MultilanguageSupport();
+
+ /**
+ * Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~MultilanguageSupport();
+
+ /**
+ * @copydoc Dali::MultilanguageSupport::Get()
+ */
+ static Text::MultilanguageSupport Get();
+
+ /**
+ * @copydoc Dali::MultilanguageSupport::SetScripts()
+ */
+ void SetScripts( LogicalModel& model );
+
+ /**
+ * @copydoc Dali::MultilanguageSupport::ValidateFonts()
+ */
+ void ValidateFonts( LogicalModel& model );
+
+private:
+ Vector<FontId> mDefaultFontPerScriptCache; ///< Caches the default font for a script.
+ Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache; ///< Caches valid fonts for a script.
+};
+
+} // namespace Internal
+
+inline static Internal::MultilanguageSupport& GetImplementation( MultilanguageSupport& multilanguageSupport )
+{
+ DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
+ BaseObject& handle = multilanguageSupport.GetBaseObject();
+ return static_cast<Internal::MultilanguageSupport&>( handle );
+}
+
+inline static const Internal::MultilanguageSupport& GetImplementation( const MultilanguageSupport& multilanguageSupport )
+{
+ DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
+ const BaseObject& handle = multilanguageSupport.GetBaseObject();
+ return static_cast<const Internal::MultilanguageSupport&>( handle );
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__
* Constructor
*/
NaviTitleBarStyle( Actor background,
- TextStyle titleTextStyle,
- TextStyle subtitleTextStyle,
int referenceWidth,
int height,
int titleHeightWithoutSubtitle,
int buttonBottomMargin,
int gapBetweenButtons )
: BasicNaviBarStyle( background, referenceWidth, height),
- titleTextStyle( titleTextStyle ), subtitleTextStyle( subtitleTextStyle ),
titleHeightWithoutSubtitle( titleHeightWithoutSubtitle ),
titleHeightWithSubtitle( titleHeightWithSubtitle ), subtitleHeight( subtitleHeight ),
titleLeftMargin( titleLeftMargin ), titleBottomMargin( titleBottomMargin ),
{
}
- TextStyle titleTextStyle; ///< the text style of the tile text
- TextStyle subtitleTextStyle; ///< the text style of the subtitle text
int titleHeightWithoutSubtitle; ///< the height of the title when no subtitle exists
int titleHeightWithSubtitle; ///< the height of the title when there is subtitle below
int subtitleHeight; ///< the height of the subtitle
GetImpl(*this).SetTitle( text );
}
-void Popup::SetTitle( TextView titleActor )
-{
- GetImpl(*this).SetTitle( titleActor );
-}
-
-TextView Popup::GetTitle() const
+const std::string& Popup::GetTitle() const
{
return GetImpl(*this).GetTitle();
}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
namespace Dali
{
void SetTitle( const std::string& text );
/**
- * @brief Sets a title for this Popup.
- *
- * @param[in] titleActor The TextView to appear as the heading for this Popup
- */
- void SetTitle( TextView titleActor );
-
- /**
* @brief Gets the text (TextView) for this Popup.
*
- * @return The TextView representing this popup is returned.
+ * @return The text to appear as the heading for this Popup
*/
- TextView GetTitle() const;
+ const std::string& GetTitle() const;
/**
* @brief Adds a button to this Popup.
--- /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 <dali-toolkit/public-api/controls/text-controls/text-label.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+const std::string TextLabel::TEXT_PROPERTY_NAME("text");
+const std::string TextLabel::MULTI_LINE_PROPERTY_NAME("multi-line");
+
+TextLabel TextLabel::New()
+{
+ return Internal::TextLabel::New();
+}
+
+TextLabel::TextLabel()
+{
+}
+
+TextLabel::TextLabel( const TextLabel& handle )
+: Control( handle )
+{
+}
+
+TextLabel& TextLabel::operator=( const TextLabel& handle )
+{
+ if( &handle != this )
+ {
+ Control::operator=( handle );
+ }
+ return *this;
+}
+
+TextLabel::~TextLabel()
+{
+}
+
+TextLabel TextLabel::DownCast( BaseHandle handle )
+{
+ return Control::DownCast<TextLabel, Internal::TextLabel>(handle);
+}
+
+void TextLabel::SetRenderer( Text::RendererPtr renderer )
+{
+ GetImpl(*this).SetRenderer( renderer );
+}
+
+TextLabel::TextLabel( Internal::TextLabel& implementation )
+: Control(implementation)
+{
+}
+
+TextLabel::TextLabel( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer<Internal::TextLabel>( internal );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_LABEL_H__
+#define __DALI_TOOLKIT_TEXT_LABEL_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+class TextLabel;
+}
+
+/**
+ * @brief A control which renders a short text string.
+ */
+class DALI_IMPORT_API TextLabel : public Control
+{
+public:
+
+ // Property indices
+ static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING
+ static const Property::Index PROPERTY_MULTI_LINE; ///< name "multi-line", type BOOLEAN
+
+ // Property names
+ static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING
+ static const std::string MULTI_LINE_PROPERTY_NAME; ///< Property, name "multi-line", type BOOLEAN
+
+ /**
+ * Create the TextLabel control.
+ * @return A handle to the TextLabel control.
+ */
+ static TextLabel New();
+
+ /**
+ * @brief Creates an empty handle.
+ */
+ TextLabel();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @param[in] handle The handle to copy from.
+ */
+ TextLabel( const TextLabel& handle );
+
+ /**
+ * @brief Assignment operator.
+ *
+ * @param[in] handle The handle to copy from.
+ * @return A reference to this.
+ */
+ TextLabel& operator=( const TextLabel& handle );
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~TextLabel();
+
+ /**
+ * @brief Downcast a handle to TextLabel.
+ *
+ * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
+ * If not the returned handle is left empty.
+ *
+ * @param[in] handle Handle to an object
+ * @return handle to a TextLabel or an empty handle
+ */
+ static TextLabel DownCast( BaseHandle handle );
+
+ /**
+ * @brief Set the rendering back-end used by the TextLabel.
+ *
+ * @param[in] renderer The text renderer to use.
+ */
+ void SetRenderer( Text::RendererPtr renderer );
+
+public: // Not intended for application developers
+
+ /**
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ *
+ * @param[in] implementation The Control implementation.
+ */
+ DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
+
+ /**
+ * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ *
+ * @param[in] internal A pointer to the internal CustomActor.
+ */
+ explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_LABEL_H__
--- /dev/null
- $(public_api_src_dir)/controls/text-input/text-input.cpp \
- $(public_api_src_dir)/controls/text-view/text-view.cpp \
+ # Add local source files here
+
+ public_api_src_files = \
+ $(public_api_src_dir)/builder/builder.cpp \
+ $(public_api_src_dir)/builder/json-parser.cpp \
+ $(public_api_src_dir)/builder/tree-node.cpp \
+ $(public_api_src_dir)/controls/control-impl.cpp \
+ $(public_api_src_dir)/controls/control.cpp \
+ $(public_api_src_dir)/controls/alignment/alignment.cpp \
+ $(public_api_src_dir)/controls/bubble-effect/bubble-emitter.cpp \
+ $(public_api_src_dir)/controls/buttons/button.cpp \
+ $(public_api_src_dir)/controls/buttons/check-box-button.cpp \
+ $(public_api_src_dir)/controls/buttons/push-button.cpp \
+ $(public_api_src_dir)/controls/buttons/radio-button.cpp \
+ $(public_api_src_dir)/controls/default-controls/check-button-factory.cpp \
+ $(public_api_src_dir)/controls/default-controls/push-button-factory.cpp \
+ $(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \
+ $(public_api_src_dir)/controls/navigation-frame/navigation-control.cpp \
+ $(public_api_src_dir)/controls/navigation-frame/page.cpp \
+ $(public_api_src_dir)/controls/magnifier/magnifier.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-factory.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-view.cpp \
+ $(public_api_src_dir)/controls/popup/popup.cpp \
+ $(public_api_src_dir)/controls/scroll-bar/scroll-bar.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/depth-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/grid-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-factory.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-view.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-depth-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-cube-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-connector.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-component-impl.cpp \
+ $(public_api_src_dir)/controls/scrollable/scroll-component.cpp \
+ $(public_api_src_dir)/controls/scrollable/scrollable.cpp \
+ $(public_api_src_dir)/controls/shadow-view/shadow-view.cpp \
+ $(public_api_src_dir)/controls/slider/slider.cpp \
+ $(public_api_src_dir)/controls/super-blur-view/super-blur-view.cpp \
+ $(public_api_src_dir)/controls/table-view/table-view.cpp \
- $(public_api_src_dir)/markup-processor/markup-processor.cpp \
++ $(public_api_src_dir)/controls/text-controls/text-label.cpp \
+ $(public_api_src_dir)/controls/tool-bar/tool-bar.cpp \
+ $(public_api_src_dir)/controls/bloom-view/bloom-view.cpp \
+ $(public_api_src_dir)/controls/cluster/cluster-style.cpp \
+ $(public_api_src_dir)/controls/cluster/cluster.cpp \
+ $(public_api_src_dir)/controls/effects-view/effects-view.cpp \
+ $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
+ $(public_api_src_dir)/controls/image-view/masked-image-view.cpp \
+ $(public_api_src_dir)/controls/view/view.cpp \
+ $(public_api_src_dir)/focus-manager/focus-manager.cpp \
+ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
+ $(public_api_src_dir)/focus-manager/keyinput-focus-manager.cpp \
-public_api_markup_processor_header_files = \
- $(public_api_src_dir)/markup-processor/markup-processor.h
-
+ $(public_api_src_dir)/shader-effects/bubble-effect/bubble-effect.cpp \
+ $(public_api_src_dir)/shader-effects/bubble-effect/color-adjuster.cpp \
+ $(public_api_src_dir)/shader-effects/alpha-discard-effect.cpp \
+ $(public_api_src_dir)/shader-effects/bendy-effect.cpp \
+ $(public_api_src_dir)/shader-effects/blind-effect.cpp \
+ $(public_api_src_dir)/shader-effects/bouncing-effect.cpp \
+ $(public_api_src_dir)/shader-effects/carousel-effect.cpp \
+ $(public_api_src_dir)/shader-effects/displacement-effect.cpp \
+ $(public_api_src_dir)/shader-effects/dissolve-effect.cpp \
+ $(public_api_src_dir)/shader-effects/dissolve-local-effect.cpp \
+ $(public_api_src_dir)/shader-effects/distance-field-effect.cpp \
+ $(public_api_src_dir)/shader-effects/image-region-effect.cpp \
+ $(public_api_src_dir)/shader-effects/iris-effect.cpp \
+ $(public_api_src_dir)/shader-effects/mask-effect.cpp \
+ $(public_api_src_dir)/shader-effects/mirror-effect.cpp \
+ $(public_api_src_dir)/shader-effects/motion-blur-effect.cpp \
+ $(public_api_src_dir)/shader-effects/motion-stretch-effect.cpp \
+ $(public_api_src_dir)/shader-effects/nine-patch-mask-effect.cpp \
+ $(public_api_src_dir)/shader-effects/overlay-effect.cpp \
+ $(public_api_src_dir)/shader-effects/page-turn-book-spine-effect.cpp \
+ $(public_api_src_dir)/shader-effects/page-turn-effect.cpp \
+ $(public_api_src_dir)/shader-effects/ripple-effect.cpp \
+ $(public_api_src_dir)/shader-effects/ripple2d-effect.cpp \
+ $(public_api_src_dir)/shader-effects/shear-effect.cpp \
+ $(public_api_src_dir)/shader-effects/soft-button-effect.cpp \
+ $(public_api_src_dir)/shader-effects/spot-effect.cpp \
+ $(public_api_src_dir)/shader-effects/square-dissolve-effect.cpp \
+ $(public_api_src_dir)/shader-effects/swirl-effect.cpp \
+ $(public_api_src_dir)/shader-effects/water-effect.cpp \
+ $(public_api_src_dir)/styling/style-manager.cpp \
++ $(public_api_src_dir)/text/bidirectional-support.cpp \
++ $(public_api_src_dir)/text/character-set-conversion.cpp \
++ $(public_api_src_dir)/text/logical-model.cpp \
++ $(public_api_src_dir)/text/multi-language-support.cpp \
++ $(public_api_src_dir)/text/script.cpp \
++ $(public_api_src_dir)/text/segmentation.cpp \
++ $(public_api_src_dir)/text/text-controller.cpp \
++ $(public_api_src_dir)/text/text-view.cpp \
++ $(public_api_src_dir)/text/text-view-interface.cpp \
++ $(public_api_src_dir)/text/visual-model.cpp \
++ $(public_api_src_dir)/text/layouts/layout-engine.cpp \
++ $(public_api_src_dir)/text/rendering/text-renderer.cpp \
++ $(public_api_src_dir)/text/rendering/basic/text-basic-renderer.cpp \
++ $(public_api_src_dir)/text/rendering/shaders/text-basic-shader.cpp \
+ $(public_api_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
+ $(public_api_src_dir)/transition-effects/cube-transition-effect.cpp \
+ $(public_api_src_dir)/transition-effects/cube-transition-fold-effect.cpp \
+ $(public_api_src_dir)/transition-effects/cube-transition-wave-effect.cpp \
+ $(public_api_src_dir)/dali-toolkit-version.cpp \
+ $(public_api_src_dir)/enums.cpp
+
+ # Add public header files here
+
+ public_api_header_files = \
+ $(public_api_src_dir)/dali-toolkit-version.h \
+ $(public_api_src_dir)/enums.h
+
+ public_api_builder_header_files = \
+ $(public_api_src_dir)/builder/builder.h \
+ $(public_api_src_dir)/builder/json-parser.h \
+ $(public_api_src_dir)/builder/tree-node.h
+
+ public_api_controls_header_files = \
+ $(public_api_src_dir)/controls/control-impl.h \
+ $(public_api_src_dir)/controls/control.h
+
+ public_api_alignment_header_files = \
+ $(public_api_src_dir)/controls/alignment/alignment.h
+
+ public_api_buttons_header_files = \
+ $(public_api_src_dir)/controls/buttons/button.h \
+ $(public_api_src_dir)/controls/buttons/check-box-button.h \
+ $(public_api_src_dir)/controls/buttons/push-button.h \
+ $(public_api_src_dir)/controls/buttons/radio-button.h
+
+ public_api_bloom_view_header_files = \
+ $(public_api_src_dir)/controls/bloom-view/bloom-view.h
+
+ public_api_bubble_emitter_header_files = \
+ $(public_api_src_dir)/controls/bubble-effect/bubble-emitter.h
+
+ public_api_cluster_header_files = \
+ $(public_api_src_dir)/controls/cluster/cluster-style.h \
+ $(public_api_src_dir)/controls/cluster/cluster.h
+
+ public_api_default_controls_header_files = \
+ $(public_api_src_dir)/controls/default-controls/check-button-factory.h \
+ $(public_api_src_dir)/controls/default-controls/push-button-factory.h \
+ $(public_api_src_dir)/controls/default-controls/solid-color-actor.h
+
+ public_api_effects_view_header_files = \
+ $(public_api_src_dir)/controls/effects-view/effects-view.h
+
+ public_api_gaussian_blur_view_header_files = \
+ $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
+
+ public_api_image_view_header_files = \
+ $(public_api_src_dir)/controls/image-view/masked-image-view.h
+
+ public_api_item_view_header_files = \
+ $(public_api_src_dir)/controls/scrollable/item-view/depth-layout.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/grid-layout.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-factory.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-layout.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-view-declarations.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/item-view.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.h \
+ $(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.h
+
+ public_api_magnifier_header_files = \
+ $(public_api_src_dir)/controls/magnifier/magnifier.h
+
+ public_api_page_turn_view_header_files = \
+ $(public_api_src_dir)/controls/page-turn-view/page-factory.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-view.h
+
+ public_api_popup_header_files = \
+ $(public_api_src_dir)/controls/popup/popup.h
+
+ public_api_scrollable_header_files = \
+ $(public_api_src_dir)/controls/scrollable/scroll-component-impl.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-component.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-connector.h \
+ $(public_api_src_dir)/controls/scrollable/scrollable.h
+
+ public_api_scroll_bar_header_files = \
+ $(public_api_src_dir)/controls/scroll-bar/scroll-bar.h
+
+ public_api_scroll_view_header_files = \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-depth-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-cube-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.h \
+ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.h
+
+ public_api_slider_header_files = \
+ $(public_api_src_dir)/controls/slider/slider.h
+
+ public_api_shadow_view_header_files = \
+ $(public_api_src_dir)/controls/shadow-view/shadow-view.h
+
+ public_api_super_blur_view_header_files = \
+ $(public_api_src_dir)/controls/super-blur-view/super-blur-view.h
+
+ public_api_table_view_header_files = \
+ $(public_api_src_dir)/controls/table-view/table-view.h
+
++public_api_text_controls_header_files = \
++ $(public_api_src_dir)/controls/text-controls/text-label.h
++
++public_api_text_header_files = \
++ $(public_api_src_dir)/text/bidirectional-line-info-run.h \
++ $(public_api_src_dir)/text/bidirectional-paragraph-info-run.h \
++ $(public_api_src_dir)/text/bidirectional-support.h \
++ $(public_api_src_dir)/text/character-run.h \
++ $(public_api_src_dir)/text/character-set-conversion.h \
++ $(public_api_src_dir)/text/font-run.h \
++ $(public_api_src_dir)/text/logical-model.h \
++ $(public_api_src_dir)/text/multi-language-support.h \
++ $(public_api_src_dir)/text/script.h \
++ $(public_api_src_dir)/text/script-run.h \
++ $(public_api_src_dir)/text/segmentation.h \
++ $(public_api_src_dir)/text/text-controller.h \
++ $(public_api_src_dir)/text/text-definitions.h \
++ $(public_api_src_dir)/text/text-view.h \
++ $(public_api_src_dir)/text/text-view-interface.h \
++ $(public_api_src_dir)/text/visual-model.h
++
++public_api_text_layouts_header_files = \
++ $(public_api_src_dir)/text/layouts/layout-engine.h
++
++public_api_text_rendering_header_files = \
++ $(public_api_src_dir)/text/rendering/text-renderer.h
++
++public_api_text_rendering_basic_header_files = \
++ $(public_api_src_dir)/text/rendering/basic/text-basic-renderer.h
++
++public_api_text_rendering_shaders_header_files = \
++ $(public_api_src_dir)/text/rendering/shaders/text-basic-shader.h
++
+ public_api_text_input_header_files = \
+ $(public_api_src_dir)/controls/text-input/text-input.h
+
+ public_api_text_view_header_files = \
+ $(public_api_src_dir)/controls/text-view/text-view.h
+
+ public_api_tool_bar_header_files = \
+ $(public_api_src_dir)/controls/tool-bar/tool-bar.h
+
+ public_api_navigation_frame_header_files = \
+ $(public_api_src_dir)/controls/navigation-frame/navigation-bar-style.h \
+ $(public_api_src_dir)/controls/navigation-frame/navigation-control.h \
+ $(public_api_src_dir)/controls/navigation-frame/page.h
+
+ public_api_view_header_files = \
+ $(public_api_src_dir)/controls/view/view.h
+
+ public_api_focus_manager_header_files = \
+ $(public_api_src_dir)/focus-manager/focus-manager.h \
+ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.h \
+ $(public_api_src_dir)/focus-manager/keyinput-focus-manager.h
+
+ public_api_shader_effects_header_files = \
+ $(public_api_src_dir)/shader-effects/alpha-discard-effect.h \
+ $(public_api_src_dir)/shader-effects/bendy-effect.h \
+ $(public_api_src_dir)/shader-effects/blind-effect.h \
+ $(public_api_src_dir)/shader-effects/bouncing-effect.h \
+ $(public_api_src_dir)/shader-effects/carousel-effect.h \
+ $(public_api_src_dir)/shader-effects/displacement-effect.h \
+ $(public_api_src_dir)/shader-effects/dissolve-effect.h \
+ $(public_api_src_dir)/shader-effects/dissolve-local-effect.h \
+ $(public_api_src_dir)/shader-effects/distance-field-effect.h \
+ $(public_api_src_dir)/shader-effects/image-region-effect.h \
+ $(public_api_src_dir)/shader-effects/iris-effect.h \
+ $(public_api_src_dir)/shader-effects/mask-effect.h \
+ $(public_api_src_dir)/shader-effects/mirror-effect.h \
+ $(public_api_src_dir)/shader-effects/motion-blur-effect.h \
+ $(public_api_src_dir)/shader-effects/motion-stretch-effect.h \
+ $(public_api_src_dir)/shader-effects/nine-patch-mask-effect.h \
+ $(public_api_src_dir)/shader-effects/overlay-effect.h \
+ $(public_api_src_dir)/shader-effects/page-turn-book-spine-effect.h \
+ $(public_api_src_dir)/shader-effects/page-turn-effect.h \
+ $(public_api_src_dir)/shader-effects/ripple-effect.h \
+ $(public_api_src_dir)/shader-effects/ripple2d-effect.h \
+ $(public_api_src_dir)/shader-effects/shear-effect.h \
+ $(public_api_src_dir)/shader-effects/soft-button-effect.h \
+ $(public_api_src_dir)/shader-effects/spot-effect.h \
+ $(public_api_src_dir)/shader-effects/square-dissolve-effect.h \
+ $(public_api_src_dir)/shader-effects/swirl-effect.h \
+ $(public_api_src_dir)/shader-effects/water-effect.h
+
+ public_api_bubble_effect_header_files = \
+ $(public_api_src_dir)/shader-effects/bubble-effect/bubble-effect.h \
+ $(public_api_src_dir)/shader-effects/bubble-effect/color-adjuster.h
+
+ public_api_styling_header_files = \
+ $(public_api_src_dir)/styling/style-manager.h
+
+ public_api_transition_effects_header_files = \
+ $(public_api_src_dir)/transition-effects/cube-transition-effect.h \
+ $(public_api_src_dir)/transition-effects/cube-transition-cross-effect.h \
+ $(public_api_src_dir)/transition-effects/cube-transition-fold-effect.h \
+ $(public_api_src_dir)/transition-effects/cube-transition-wave-effect.h
+
ShaderEffect shaderEffectCustom = ShaderEffect::New(vertexShader,
"",
- GeometryType( GEOMETRY_TYPE_IMAGE | GEOMETRY_TYPE_TEXT ),
+ GeometryType( GEOMETRY_TYPE_IMAGE ),
ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ));
// Pass ownership to CarouselEffect through overloaded constructor, So that it now has access to the
// Create the implementation, temporarily owned on stack
Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New(
- vertexShader, imageFragmentShader, vertexShader, "", GeometryHints(HINT_GRID) );
+ vertexShader, imageFragmentShader, GeometryType(GEOMETRY_TYPE_IMAGE), GeometryHints(HINT_GRID) );
/* Pass ownership to RippleEffect through overloaded constructor, So that it now has access to the
Dali::ShaderEffect implementation */
ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New(
vertexShader,
"",
- GeometryType( GEOMETRY_TYPE_IMAGE | GEOMETRY_TYPE_TEXT ),
+ GeometryType( GEOMETRY_TYPE_IMAGE ),
GeometryHints( HINT_GRID ));
// Pass ownership to ShearEffect through overloaded constructor, So that it now has access to the
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief BidirectionalLineInfoRun
+ */
+struct BidirectionalLineInfoRun
+{
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ CharacterIndex* visualToLogicalMap; ///< Pointer to the visual to logical map table.
+ CharacterIndex* logicalToVisualMap; ///< Pointer to the logical to visual map table.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief BidirectionalParagraphInfoRun
+ *
+ * In terms of the bidirectional algorithm, a 'paragraph' is understood as a run of characters between Paragraph Separators or appropriate Newline Functions.
+ * A 'paragraph' may also be determined by higher-level protocols like a mark-up tag.
+ */
+struct BidirectionalParagraphInfoRun
+{
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ BidiInfoIndex bidirectionalInfoIndex; ///< Index to the table with the bidirectional info per paragraph.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_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.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/public-api/text/bidirectional-support.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+void SetBidirectionalInfo( LogicalModel& model )
+{
+}
+
+void ReorderLines( LogicalModel& logicalModel,
+ const VisualModel& visualModel )
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class LogicalModel;
+class VisualModel;
+
+/**
+ * Sets the bidirectional info into the logical model.
+ *
+ * Any bidirectional info previously set is removed.
+ *
+ * @pre The @p model needs to have a text set.
+ * @pre The @p model needs to have the line break info set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+void SetBidirectionalInfo( LogicalModel& model );
+
+/**
+ * Sets the visual to logical and logical to visual map tables.
+ *
+ * Any map tables previously set are removed.
+ *
+ * @pre The @p logicalModel needs to have a text set.
+ * @pre The @p logicalModel needs to have the line break info set.
+ * @pre The @p visualModel needs to have the laid-out lines info set.
+ *
+ * @param[in,out] logicalModel The text's logical model.
+ * @param[in] visualModel The text's visual model.
+ */
+void ReorderLines( LogicalModel& logicalModel,
+ const VisualModel& visualModel );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_CHARACTER_RUN_H__
+#define __DALI_TOOLKIT_TEXT_CHARACTER_RUN_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief A run of consecutive characters.
+ */
+struct CharacterRun
+{
+ CharacterIndex characterIndex; ///< Index to the first character.
+ Length numberOfCharacters; ///< Number of characters in the run.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_CHARACTER_RUN_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.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/public-api/text/character-set-conversion.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace
+{
+ const static uint8_t U1 = 1u;
+ const static uint8_t U2 = 2u;
+ const static uint8_t U3 = 3u;
+ const static uint8_t U4 = 4u;
+ const static uint8_t U0 = 0u;
+ const static uint8_t UTF8_LENGTH[256] = {
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, // lead byte = 0xxx xxxx (U+0000 - U+007F + some extended ascii characters)
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, U1, U1, U1, U1, U1, U1, U1, U1, //
+ U1, U1, //
+
+ U2, U2, U2, U2, U2, U2, U2, U2, U2, U2, //
+ U2, U2, U2, U2, U2, U2, U2, U2, U2, U2, // lead byte = 110x xxxx (U+0080 - U+07FF)
+ U2, U2, U2, U2, U2, U2, U2, U2, U2, U2, //
+ U2, U2, //
+
+ U3, U3, U3, U3, U3, U3, U3, U3, U3, U3, // lead byte = 1110 xxxx (U+0800 - U+FFFF)
+ U3, U3, U3, U3, U3, U3, //
+
+ U4, U4, U4, U4, U4, U4, U4, U4, // lead byte = 1111 0xxx (U+10000 - U+1FFFFF)
+
+ U0, U0, U0, U0, // Non valid.
+ U0, U0, U0, U0, // Non valid.
+ };
+} // namespace
+
+uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length )
+{
+ uint32_t numberOfCharacters = 0u;
+
+ const uint8_t* begin = utf8;
+ const uint8_t* end = utf8 + length;
+
+ for( ; begin < end ; begin += UTF8_LENGTH[*begin], ++numberOfCharacters );
+
+ return numberOfCharacters;
+}
+
+uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters )
+{
+ uint32_t numberOfBytes = 0u;
+
+ const uint32_t* begin = utf32;
+ const uint32_t* end = utf32 + numberOfCharacters;
+
+ for( ; begin < end; ++begin )
+ {
+ const uint32_t code = *begin;
+
+ if( code < 0x80u )
+ {
+ ++numberOfBytes;
+ }
+ else if( code < 0x800u )
+ {
+ numberOfBytes += U2;
+ }
+ else if( code < 0x10000u )
+ {
+ numberOfBytes += U3;
+ }
+ else if( code < 0x200000u )
+ {
+ numberOfBytes += U4;
+ }
+ }
+
+ return numberOfBytes;
+}
+
+uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 )
+{
+ uint32_t numberOfCharacters = 0u;
+
+ const uint8_t* begin = utf8;
+ const uint8_t* end = utf8 + length;
+
+ for( ; begin < end ; ++numberOfCharacters )
+ {
+ const uint8_t leadByte = *begin;
+
+ switch( UTF8_LENGTH[leadByte] )
+ {
+ case U1:
+ {
+ *utf32++ = leadByte;
+ begin++;
+ break;
+ }
+
+ case U2:
+ {
+ uint32_t& code = *utf32++;
+ code = leadByte & 0x1fu;
+ begin++;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ break;
+ }
+
+ case U3:
+ {
+ uint32_t& code = *utf32++;
+ code = leadByte & 0x1fu;
+ begin++;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ break;
+ }
+
+ case U4:
+ {
+ uint32_t& code = *utf32++;
+ code = leadByte & 0x1fu;
+ begin++;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ code <<= 6u;
+ code |= *begin++ & 0x3fu;
+ break;
+ }
+ }
+ }
+
+ return numberOfCharacters;
+}
+
+void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 )
+{
+ const uint32_t* begin = utf32;
+ const uint32_t* end = utf32 + numberOfCharacters;
+
+ for( ; begin < end; ++begin )
+ {
+ const uint32_t code = *begin;
+
+ if( code < 0x80u )
+ {
+ *utf8++ = code;
+ }
+ else if( code < 0x800u )
+ {
+ *utf8++ = static_cast<uint8_t>( code >> 6u ) | 0xc0u; // lead byte for 2 byte sequence
+ *utf8++ = static_cast<uint8_t>( code & 0x3f ) | 0x80u; // continuation byte
+ }
+ else if( code < 0x10000u )
+ {
+ *utf8++ = static_cast<uint8_t>( code >> 12u ) | 0xe0u; // lead byte for 2 byte sequence
+ *utf8++ = static_cast<uint8_t>( ( code >> 6u ) & 0x3f ) | 0x80u; // continuation byte
+ *utf8++ = static_cast<uint8_t>( code & 0x3f ) | 0x80u; // continuation byte
+ }
+ else if( code < 0x200000u )
+ {
+ *utf8++ = static_cast<uint8_t>( code >> 18u ) | 0xf0u; // lead byte for 2 byte sequence
+ *utf8++ = static_cast<uint8_t>( ( code >> 12u ) & 0x3f ) | 0x80u; // continuation byte
+ *utf8++ = static_cast<uint8_t>( ( code >> 6u ) & 0x3f ) | 0x80u; // continuation byte
+ *utf8++ = static_cast<uint8_t>( code & 0x3f ) | 0x80u; // continuation byte
+ }
+ }
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H__
+#define __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+// EXTERNAL INCLUDES
+#include <stdint.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @brief Retrieves the number of characters of the text array encoded in UTF8
+ *
+ * @param[in] utf8 The pointer to the UTF8 array.
+ * @param[in] length The length of the UTF8 array.
+ *
+ * @return The number of characters.
+ */
+DALI_IMPORT_API uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length );
+
+/**
+ * @brief Retrieves the number of bytes needed to encode in UTF8 the given text array encoded in UTF32.
+ *
+ * @param[in] utf32 The pointer to the UTF32 array.
+ * @param[in] numberOfCharacters The number of characters of the UTF32 array.
+ *
+ * @return The number of bytes.
+ */
+DALI_IMPORT_API uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters );
+
+/**
+ * @brief Converts a text array encoded in UTF8 into a text array encoded in UTF32.
+ *
+ * The @p utf32 buffer needs to be big enough to store all the characters.
+ *
+ * @param[in] utf8 The pointer to the UTF8 array.
+ * @param[in] length The length of the UTF8 array.
+ * @param[out] utf32 The pointer to the UTF32 array.
+ *
+ * @return The number of characters.
+ */
+DALI_IMPORT_API uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 );
+
+/**
+ * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
+ *
+ * The @p utf8 buffer needs to be big enough to store all the characters.
+ *
+ * @param[in] utf32 The pointer to the UTF32 array.
+ * @param[in] numberOfCharacters The number of characters of the UTF32 array.
+ * @param[out] utf8 The pointer to the UTF8 array.
+ */
+DALI_IMPORT_API void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint32_t* utf8 );
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_FONT_RUN_H__
+#define __DALI_TOOLKIT_TEXT_FONT_RUN_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Run of characters with the same font.
+ */
+struct FontRun
+{
+ CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
+ FontId fontId; ///< Font id of the run.
+ bool isDefault; ///< Whether the font is a default font not defined by the user.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_FONT_RUN_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 <dali-toolkit/public-api/text/layouts/layout-engine.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/text-abstraction/font-client.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/logical-model.h>
+#include <dali-toolkit/public-api/text/visual-model.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct LayoutEngine::Impl
+{
+ Impl()
+ : mLayout( LayoutEngine::SINGLE_LINE_BOX )
+ {
+ mFontClient = TextAbstraction::FontClient::Get();
+ }
+
+ void UpdateVisualModel( const Vector2& boundingBox, const LogicalModel& logicalModel, VisualModel& visualModel )
+ {
+ // TODO Switch between different layouts
+
+ TextAbstraction::FontId fontId = mFontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 13*64 );
+
+ const Length characterCount = logicalModel.GetNumberOfCharacters();
+
+ Vector<GlyphInfo> glyphs;
+ glyphs.Reserve( characterCount );
+
+ Vector<CharacterIndex> characterIndices;
+ characterIndices.Reserve( characterCount );
+
+ std::vector<Length> charactersPerGlyph;
+ charactersPerGlyph.assign( characterCount, 1 );
+
+ for( unsigned int i=0; i<characterCount; ++i )
+ {
+ Character charcode;
+ logicalModel.GetText( i, &charcode, 1 );
+
+ // TODO - Perform shaping to get correct glyph indices
+ GlyphIndex glyphIndex = mFontClient.GetGlyphIndex( fontId, charcode );
+
+ glyphs.PushBack( GlyphInfo(fontId, glyphIndex) );
+ characterIndices.PushBack( 1 );
+ }
+
+ if( mFontClient.GetGlyphMetrics( &glyphs[0], glyphs.Size() ) )
+ {
+ visualModel.SetGlyphs( &glyphs[0],
+ &characterIndices[0],
+ &charactersPerGlyph[0],
+ characterCount );
+
+ UpdateGlyphPositions( boundingBox, visualModel );
+ }
+ }
+
+ void UpdateGlyphPositions( const Vector2& boundingBox, VisualModel& visualModel )
+ {
+ if( LayoutEngine::SINGLE_LINE_BOX == mLayout )
+ {
+ SingleLineLayout( boundingBox, visualModel );
+ }
+ else
+ {
+ MultiLineLayout( boundingBox, visualModel );
+ }
+ }
+
+ // TODO - Rewrite this to handle bidi
+ void SingleLineLayout( const Vector2& boundingBox, VisualModel& visualModel )
+ {
+ Length glyphCount = visualModel.GetNumberOfGlyphs();
+
+ std::vector<Vector2> glyphPositions;
+ glyphPositions.reserve( glyphCount );
+
+ if( glyphCount > 0 )
+ {
+ // FIXME Single font assumption
+ Text::FontMetrics fontMetrics;
+ GlyphInfo firstGlyph;
+ visualModel.GetGlyphs( 0, &firstGlyph, 1 );
+ mFontClient.GetFontMetrics( firstGlyph.fontId, fontMetrics );
+
+ float penX( 0 );
+ float penY( fontMetrics.ascender ); // Move to baseline
+
+ for( unsigned int i=0; i<glyphCount; ++i )
+ {
+ GlyphInfo glyph;
+ visualModel.GetGlyphs( i, &glyph, 1 );
+
+ glyphPositions.push_back( Vector2( penX + glyph.xBearing,
+ penY - glyph.yBearing ) );
+
+ penX += glyph.advance;
+ }
+
+ visualModel.SetGlyphPositions( &glyphPositions[0], glyphCount );
+ }
+ }
+
+ // TODO - Rewrite this to handle bidi
+ void MultiLineLayout( const Vector2& boundingBox, VisualModel& visualModel )
+ {
+ Length glyphCount = visualModel.GetNumberOfGlyphs();
+
+ std::vector<Vector2> glyphPositions;
+ glyphPositions.reserve( glyphCount );
+
+ if( glyphCount > 0 )
+ {
+ // FIXME Single font assumption
+ Text::FontMetrics fontMetrics;
+ GlyphInfo firstGlyph;
+ visualModel.GetGlyphs( 0, &firstGlyph, 1 );
+ mFontClient.GetFontMetrics( firstGlyph.fontId, fontMetrics );
+
+ float penX( 0 );
+ float penY( fontMetrics.ascender ); // Move to baseline
+
+ unsigned int i=0;
+ while( i < glyphCount )
+ {
+ // Skip initial whitespace
+ for( ; i<glyphCount; ++i )
+ {
+ GlyphInfo glyph;
+ visualModel.GetGlyphs( i, &glyph, 1 );
+
+ if( glyph.width > 0 &&
+ glyph.height > 0 )
+ {
+ break;
+ }
+ else
+ {
+ glyphPositions.push_back( Vector2( penX + glyph.xBearing,
+ penY - glyph.yBearing ) );
+ }
+ }
+
+ // Find last glyph for the next line
+ unsigned int endIndex = i;
+ float endPenX = penX;
+ unsigned int j=i;
+ for( ; j<glyphCount; ++j )
+ {
+ GlyphInfo glyph;
+ visualModel.GetGlyphs( j, &glyph, 1 );
+
+ endPenX += glyph.advance;
+
+ if( glyph.width <= 0 ||
+ glyph.height <= 0 )
+ {
+ // Potential line end found
+ endIndex = j;
+ }
+ else if( endPenX > boundingBox.width )
+ {
+ break;
+ }
+ }
+
+ // If end of text or no whitespace found
+ if( glyphCount == j ||
+ endIndex == i )
+ {
+ endIndex = j;
+ }
+
+ for( ; i<endIndex; ++i )
+ {
+ GlyphInfo glyph;
+ visualModel.GetGlyphs( i, &glyph, 1 );
+
+ glyphPositions.push_back( Vector2( penX + glyph.xBearing,
+ penY - glyph.yBearing ) );
+
+ penX += glyph.advance;
+ }
+
+ // Go to next line
+ penX = 0;
+ penY += fontMetrics.height;
+ }
+
+ visualModel.SetGlyphPositions( &glyphPositions[0], glyphCount );
+ }
+ }
+
+ unsigned int mLayout;
+
+ TextAbstraction::FontClient mFontClient;
+};
+
+LayoutEngine::LayoutEngine()
+: mImpl( NULL )
+{
+ mImpl = new LayoutEngine::Impl();
+}
+
+LayoutEngine::~LayoutEngine()
+{
+ delete mImpl;
+}
+
+void LayoutEngine::SetLayout( Layout layout )
+{
+ mImpl->mLayout = layout;
+}
+
+void LayoutEngine::UpdateVisualModel( const Vector2& boundingBox, const LogicalModel& logicalModel, VisualModel& visualModel )
+{
+ mImpl->UpdateVisualModel( boundingBox, logicalModel, visualModel );
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__
+#define __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_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.
+ *
+ */
+
+namespace Dali
+{
+
+struct Vector2;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class LogicalModel;
+class VisualModel;
+
+/**
+ * @brief LayoutEngine is responsible for calculating the visual position of glyphs in layout.
+ */
+class LayoutEngine
+{
+public:
+
+ enum Layout
+ {
+ SINGLE_LINE_BOX,
+ MULTI_LINE_BOX
+ };
+
+ /**
+ * @brief Create a new instance of a LayoutEngine.
+ */
+ LayoutEngine();
+
+ /**
+ * @brief Virtual destructor.
+ */
+ ~LayoutEngine();
+
+ /**
+ * @brief Choose the required layout.
+ *
+ * @param[in] layout The required layout.
+ */
+ void SetLayout( Layout layout );
+
+ /**
+ * @brief Store the visual position of glyphs in the VisualModel.
+ *
+ * @param[in] boundingBox The size of the box containing the text.
+ * @param[in] logicalModel The logical model.
+ * @param[in] visualModel The visual model to update.
+ */
+ void UpdateVisualModel( const Vector2& boundingBox, const LogicalModel& logicalModel, VisualModel& visualModel );
+
+private:
+
+ // Undefined
+ LayoutEngine( const LayoutEngine& handle );
+
+ // Undefined
+ LayoutEngine& operator=( const LayoutEngine& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_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 <dali-toolkit/public-api/text/logical-model.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/font-run.h>
+#include <dali-toolkit/public-api/text/script-run.h>
+
+// EXTERNAL INCLUDES
+#include <memory.h>
+#include <stdlib.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct LogicalModel::Impl
+{
+ Vector<Character> mText;
+ Vector<ScriptRun> mScriptRuns;
+ Vector<FontRun> mFontRuns;
+};
+
+LogicalModelPtr LogicalModel::New()
+{
+ return LogicalModelPtr( new LogicalModel() );
+}
+
+void LogicalModel::SetText( const Character* text, Length length )
+{
+ Vector<Character>& modelText = mImpl->mText;
+ modelText.Resize( length );
+ memcpy( &modelText[0], text, length*sizeof(Character) );
+}
+
+Length LogicalModel::GetNumberOfCharacters() const
+{
+ return mImpl->mText.Count();
+}
+
+void LogicalModel::GetText( CharacterIndex characterIndex, Character* text, Length numberOfCharacters ) const
+{
+ Vector<Character>& modelText = mImpl->mText;
+ memcpy( text, &modelText[characterIndex], numberOfCharacters*sizeof(Character) );
+}
+
+void LogicalModel::SetScripts( const ScriptRun* const scripts,
+ Length numberOfRuns )
+{
+ Vector<ScriptRun>& scriptRuns = mImpl->mScriptRuns;
+ scriptRuns.Resize( numberOfRuns );
+ memcpy( scriptRuns.Begin(), scripts, numberOfRuns * sizeof( ScriptRun ) );
+}
+
+Length LogicalModel::GetNumberOfScriptRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ if( ( 0u == characterIndex ) && ( mImpl->mText.Count() == numberOfCharacters ) )
+ {
+ return mImpl->mScriptRuns.Count();
+ }
+
+ const CharacterIndex charcterEndIndex = characterIndex + numberOfCharacters;
+ Length numberOfScriptRuns = 0u;
+ bool firstIndexFound = false;
+
+ for( Length index = 0u, length = mImpl->mScriptRuns.Count(); index < length; ++index )
+ {
+ const ScriptRun* const scriptRun = mImpl->mScriptRuns.Begin() + index;
+
+ if( !firstIndexFound &&
+ ( characterIndex < scriptRun->characterRun.characterIndex + scriptRun->characterRun.numberOfCharacters ) )
+ {
+ // The character index is within this script run.
+ // Starts the counter of script runs.
+ firstIndexFound = true;
+ }
+
+ if( firstIndexFound )
+ {
+ ++numberOfScriptRuns;
+ if( scriptRun->characterRun.characterIndex + scriptRun->characterRun.numberOfCharacters > charcterEndIndex )
+ {
+ // This script run exceeds the given range. The number of scripts can be returned.
+ return numberOfScriptRuns;
+ }
+ }
+ }
+
+ return numberOfScriptRuns;
+}
+
+void LogicalModel::GetScriptRuns( ScriptRun* scriptRuns,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ // A better implementation can cache the first script run and the number of then when the GetNumberOfScriptRuns() is called.
+
+ Length numberOfScriptRuns = GetNumberOfScriptRuns( characterIndex,
+ numberOfCharacters );
+
+ for( Length index = 0u, length = mImpl->mScriptRuns.Count(); index < length; ++index )
+ {
+ const ScriptRun* const scriptRun = mImpl->mScriptRuns.Begin() + index;
+
+ if( characterIndex < scriptRun->characterRun.characterIndex + scriptRun->characterRun.numberOfCharacters )
+ {
+ memcpy( scriptRuns, scriptRun, sizeof( ScriptRun ) * numberOfScriptRuns );
+ return;
+ }
+ }
+}
+
+Script LogicalModel::GetScript( CharacterIndex characterIndex ) const
+{
+ // If this operation is too slow, consider a binary search.
+
+ for( Length index = 0u, length = mImpl->mScriptRuns.Count(); index < length; ++index )
+ {
+ const ScriptRun* const scriptRun = mImpl->mScriptRuns.Begin() + index;
+
+ if( ( scriptRun->characterRun.characterIndex <= characterIndex ) &&
+ ( characterIndex < scriptRun->characterRun.characterIndex + scriptRun->characterRun.numberOfCharacters ) )
+ {
+ return scriptRun->script;
+ }
+ }
+
+ return TextAbstraction::UNKNOWN;
+}
+
+void LogicalModel::SetFonts( const FontRun* const fonts,
+ Length numberOfRuns )
+{
+ Vector<FontRun>& fontRuns = mImpl->mFontRuns;
+ fontRuns.Resize( numberOfRuns );
+ memcpy( fontRuns.Begin(), fonts, numberOfRuns * sizeof( FontRun ) );
+}
+
+Length LogicalModel::GetNumberOfFontRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ if( ( 0u == characterIndex ) && ( mImpl->mText.Count() == numberOfCharacters ) )
+ {
+ return mImpl->mFontRuns.Count();
+ }
+
+ const CharacterIndex charcterEndIndex = characterIndex + numberOfCharacters;
+ Length numberOfFontRuns = 0u;
+ bool firstIndexFound = false;
+
+ for( Length index = 0u, length = mImpl->mFontRuns.Count(); index < length; ++index )
+ {
+ const FontRun* const fontRun = mImpl->mFontRuns.Begin() + index;
+
+ if( !firstIndexFound &&
+ ( characterIndex < fontRun->characterRun.characterIndex + fontRun->characterRun.numberOfCharacters ) )
+ {
+ // The character index is within this font run.
+ // Starts the counter of font runs.
+ firstIndexFound = true;
+ }
+
+ if( firstIndexFound )
+ {
+ ++numberOfFontRuns;
+ if( fontRun->characterRun.characterIndex + fontRun->characterRun.numberOfCharacters > charcterEndIndex )
+ {
+ // This font run exceeds the given range. The number of fonts can be returned.
+ return numberOfFontRuns;
+ }
+ }
+ }
+
+ return numberOfFontRuns;
+}
+
+void LogicalModel::GetFontRuns( FontRun* fontRuns,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ // A better implementation can cache the first font run and the number of then when the GetNumberOfFontRuns() is called.
+
+ Length numberOfFontRuns = GetNumberOfFontRuns( characterIndex,
+ numberOfCharacters );
+
+ for( Length index = 0u, length = mImpl->mFontRuns.Count(); index < length; ++index )
+ {
+ const FontRun* const fontRun = mImpl->mFontRuns.Begin() + index;
+
+ if( characterIndex < fontRun->characterRun.characterIndex + fontRun->characterRun.numberOfCharacters )
+ {
+ memcpy( fontRuns, fontRun, sizeof( FontRun ) * numberOfFontRuns );
+ return;
+ }
+ }
+}
+
+FontId LogicalModel::GetFont( CharacterIndex characterIndex ) const
+{
+ for( Length index = 0u, length = mImpl->mFontRuns.Count(); index < length; ++index )
+ {
+ const FontRun* const fontRun = mImpl->mFontRuns.Begin() + index;
+
+ if( ( fontRun->characterRun.characterIndex <= characterIndex ) &&
+ ( characterIndex < fontRun->characterRun.characterIndex + fontRun->characterRun.numberOfCharacters ) )
+ {
+ return fontRun->fontId;
+ }
+ }
+
+ return 0u;
+}
+
+void LogicalModel::SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo,
+ Length length )
+{
+}
+
+void LogicalModel::GetLineBreakInfo( LineBreakInfo* lineBreakInfo,
+ CharacterIndex characterIndex,
+ Length numberOfItems ) const
+{
+}
+
+LineBreakInfo LogicalModel::GetLineBreakInfo( CharacterIndex characterIndex ) const
+{
+ return 0;
+}
+
+void LogicalModel::SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo,
+ Length length )
+{
+}
+
+void LogicalModel::GetWordBreakInfo( WordBreakInfo* wordBreakInfo,
+ CharacterIndex characterIndex,
+ Length numberOfItems ) const
+{
+}
+
+WordBreakInfo LogicalModel::GetWordBreakInfo( CharacterIndex characterIndex ) const
+{
+ return 0;
+}
+
+void LogicalModel::SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo,
+ Length numberOfRuns )
+{
+}
+
+Length LogicalModel::GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ return 0u;
+}
+
+void LogicalModel::GetCharacterDirections( CharacterDirection* directions,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
+CharacterDirection LogicalModel::GetCharacterDirection( CharacterIndex characterIndex ) const
+{
+ return false;
+}
+
+void LogicalModel::SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo,
+ Length numberOfRuns )
+{
+}
+
+CharacterIndex LogicalModel::GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const
+{
+ return 0u;
+}
+
+CharacterIndex LogicalModel::GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const
+{
+ return 0u;
+}
+
+void LogicalModel::GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
+void LogicalModel::GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
+LogicalModel::~LogicalModel()
+{
+ delete mImpl;
+}
+
+LogicalModel::LogicalModel()
+: mImpl( NULL )
+{
+ mImpl = new LogicalModel::Impl();
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_H__
+#define __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_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 <dali/public-api/common/intrusive-ptr.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct BidirectionalLineInfoRun;
+struct BidirectionalParagraphInfoRun;
+struct FontRun;
+class LogicalModel;
+typedef IntrusivePtr<LogicalModel> LogicalModelPtr;
+struct ScriptRun;
+
+/**
+ * @brief A logical text model contains layout independent information.
+ *
+ * This includes:
+ * - A series of UTF-32 characters in logical order
+ */
+class LogicalModel : public RefObject
+{
+public:
+
+ /**
+ * @brief Create a new instance of a LogicalModel.
+ *
+ * @return A pointer to a new LogicalModel.
+ */
+ static LogicalModelPtr New();
+
+ // Text interface.
+
+ /**
+ * @brief Replaces any text previously set.
+ *
+ * @param[in] text An array of UTF-32 characters.
+ * @param[in] length The length of the array.
+ */
+ void SetText( const Character* text,
+ Length length );
+
+ /**
+ * @brief Retrieves the number of characters of the text.
+ *
+ * @return The number of characters.
+ */
+ Length GetNumberOfCharacters() const;
+
+ /**
+ * @brief Retrieves characters from the text in the given buffer.
+ *
+ * @pre The size of the @p text buffer needs to be big enough to copy the @p numberOfCharacters.
+ * @param[in] characterIndex The index to the first character to copy.
+ * @param[out] text Pointer to a buffer where the text is copied.
+ * @param[in] numberOfCharacters The number of characters to be copied.
+ */
+ void GetText( CharacterIndex characterIndex,
+ Character* text,
+ Length numberOfCharacters ) const;
+
+ // Language support interface.
+
+ /**
+ * Sets the script runs.
+ *
+ * Replaces any scripts previously set.
+ *
+ * A run is a group of consecutive characters. A script run contains the script for a run.
+ *
+ * @param[in] scripts Pointer to a buffer with all the script runs.
+ * @param[in] numberOfRuns The number of script runs.
+ */
+ void SetScripts( const ScriptRun* const scripts,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the number of script runs for the given range of characters.
+ *
+ * A run is a group of consecutive characters. A script run contains the script for a run.
+ *
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ *
+ * @return The number of script runs.
+ */
+ Length GetNumberOfScriptRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the script runs for the given range of characters.
+ *
+ * The @p scriptRuns buffer needs to be big enough to copy the number of script runs.
+ * Call GetNumberOfScriptRuns() to retrieve the number of script runs.
+ *
+ * @param[out] scriptRuns Pointer to a buffer where the script runs are copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetScriptRuns( ScriptRun* scriptRuns,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the script for the given character index.
+ *
+ * @param[in] characterIndex Index to the character.
+ *
+ * @return The character's script.
+ */
+ Script GetScript( CharacterIndex characterIndex ) const;
+
+ /**
+ * Sets the font runs.
+ *
+ * Replaces any fonts previously set.
+ *
+ * A run is a group of consecutive characters. A font run contains the font id for a run.
+ *
+ * @param[in] fonts Pointer to a buffer with all the font runs.
+ * @param[in] numberOfRuns The number of font runs.
+ */
+ void SetFonts( const FontRun* const fonts,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the number of font runs for the given range of characters.
+ *
+ * A run is a group of consecutive characters. A font run contains the font id for a run.
+ *
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ *
+ * @return The number of font runs.
+ */
+ Length GetNumberOfFontRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the font runs for the given range of characters.
+ *
+ * The @p fontRuns buffer needs to be big enough to copy the number of font runs.
+ * Call GetNumberOfFontRuns() to retrieve the number of font runs.
+ *
+ * @param[out] fontRuns Pointer to a buffer where the font runs are copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetFontRuns( FontRun* fontRuns,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the font id for the given character index.
+ *
+ * @param[in] characterIndex Index to the first character.
+ *
+ * @return The font id.
+ */
+ FontId GetFont( CharacterIndex characterIndex ) const;
+
+ // Break info interface.
+
+ /**
+ * Sets the line break info.
+ *
+ * See GetLineBreakInfo() to get how the line break info is encoded.
+ *
+ * Replaces any line break info previously set.
+ *
+ * @param[in] lineBreakInfo Pointer to a buffer with the line break info.
+ * @param[in] length The size of the buffer.
+ */
+ void SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo,
+ Length length );
+
+ /**
+ * Retrieves the line break info in the given buffer.
+ *
+ * The size of the @p lineBreakInfo buffer needs to be big enough to copy the @p numberOfItems.
+ *
+ * Possible values for LineBreakInfo are:
+ *
+ * - 0 is a LINE_MUST_BREAK. Text must be broken into a new line.
+ * - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
+ * - 2 is a LINE_NO_BREAK. Text can't be broken into a new line.
+ *
+ @verbatim
+ i.e. Hello big\nworld produces:
+ 2222212220 22220
+ @endverbatim
+ *
+ * @param[out] lineBreakInfo Pointer to a buffer where the line break info is copied.
+ * @param[in] characterIndex Index to the first line break info item.
+ * @param[in] numberOfItems The number of items to be copied.
+ */
+ void GetLineBreakInfo( LineBreakInfo* lineBreakInfo,
+ CharacterIndex characterIndex,
+ Length numberOfItems ) const;
+
+ /**
+ * Retrieves the line break info for the given item index.
+ *
+ * @param[in] characterIndex Index to the line break info item.
+ */
+ LineBreakInfo GetLineBreakInfo( CharacterIndex characterIndex ) const;
+
+ /**
+ * Sets the word break info.
+ *
+ * See GetWordBreakInfo() to get how the word break info is encoded.
+ *
+ * Replaces any word break info previously set.
+ *
+ * @param[in] wordBreakInfo Pointer to a buffer with the word break info.
+ * @param[in] length The size of the buffer.
+ */
+ void SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo,
+ Length length );
+
+ /**
+ * Retrieves the word break info in the given buffer.
+ *
+ * The size of the @p wordBreakInfo buffer needs to be big enough to copy the @p numberOfItems.
+ *
+ * The size of the buffer has to be big enough to store the whole word break info per character.
+ * Call GetNumberOfCharacters() to get the number of characters.
+ *
+ * Possible values for WordBreakInfo are:
+ *
+ * - 0 is a WORD_BREAK. Text can be broken into a new word.
+ * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
+ *
+ @verbatim
+ i.e. Hello big\nworld produces:
+ 1111001100 11110
+ @endverbatim
+ *
+ * @param[out] wordBreakInfo Pointer to a buffer where the word break info is copied.
+ * @param[in] characterIndex Index to the first word break info item.
+ * @param[in] numberOfItems The number of items to be copied.
+ */
+ void GetWordBreakInfo( WordBreakInfo* wordBreakInfo,
+ CharacterIndex characterIndex,
+ Length numberOfItems ) const;
+
+ /**
+ * Retrieves the word break info for the given item index.
+ *
+ * @param[in] characterIndex Index to the word break info item.
+ */
+ WordBreakInfo GetWordBreakInfo( CharacterIndex characterIndex ) const;
+
+ // Bidirectional support interface.
+
+ /**
+ * Sets the bidirectional info runs.
+ *
+ * Replaces any bidirectional info previously set.
+ *
+ * Each bidirectional info run stores bidirectional info for a whole 'paragraph' of text which contains right to left scripts.
+
+ * In terms of the bidirectional algorithm, a 'paragraph' is understood as a run of characters between Paragraph Separators or appropriate Newline Functions.
+ * A 'paragraph' may also be determined by higher-level protocols like a mark-up tag.
+ *
+ * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs.
+ * @param[in] numberOfRuns The number of bidirectional info runs.
+ */
+ void SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the number of bidirectional info runs for the given range of characters.
+ *
+ * It may be zero if there is no right to left scripts.
+ *
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ *
+ * @return The number of bidirectional info runs.
+ */
+ Length GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the direction of the characters.
+ *
+ * It sets @c true for right to left characters and @c false for left to right.
+ * For neutral characters it check's the next and previous character's directions:
+ * - If they are equals set that direction. If they are not, sets the paragraph's direction.
+ * - If there is no next, sets the paragraph's direction.
+ *
+ * See SetBidirectionalInfo() to get an explanation of the 'paragraph' meaning in the bidirectional algorithm.
+ *
+ * @param[out] directions Whether the characters are right to left or left to right.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetCharacterDirections( CharacterDirection* directions,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the direction of a characters.
+ *
+ * See GetCharacterDirections().
+ *
+ * @param[in] characterIndex Index to a character.
+ *
+ * @return The character's direction.
+ */
+ CharacterDirection GetCharacterDirection( CharacterIndex characterIndex ) const;
+
+ // Visual <--> Logical conversion tables.
+
+ /**
+ * Sets the visual to logical and the logical to visual map tables.
+ *
+ * Replaces any map tables previously set.
+ *
+ * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs.
+ * @param[in] numberOfRuns The number of bidirectional info runs.
+ */
+ void SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the visual character index for the given logical character index.
+ *
+ * @param[in] logicalCharacterIndex The logical character index.
+ *
+ * @return The visual character index.
+ */
+ CharacterIndex GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const;
+
+ /**
+ * Retrieves the logical character index for the given visual character index.
+ *
+ * @param[in] visualCharacterIndex The visual character index.
+ *
+ * @return The logical character index.
+ */
+ CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const;
+
+ /**
+ * Retrieves the whole or part of the logical to visual conversion map.
+ *
+ * The size of the buffer needs to be big enough to copy the @p numberOfCharacters.
+ *
+ * @param[out] logicalToVisualMap Pointer to a buffer where the conversion map is copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the whole or part of the visual to logical conversion map.
+ *
+ * The size of the buffer needs to be big enough to copy the @p numberOfCharacters.
+ *
+ * @param[out] visualToLogicalMap Pointer to a buffer where the conversion map is copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~LogicalModel();
+
+private:
+
+ /**
+ * @brief Private constructor.
+ */
+ LogicalModel();
+
+ // Undefined
+ LogicalModel( const LogicalModel& handle );
+
+ // Undefined
+ LogicalModel& operator=( const LogicalModel& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_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.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/public-api/text/multi-language-support.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/multi-language-support-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+MultilanguageSupport::MultilanguageSupport()
+{
+}
+
+MultilanguageSupport::~MultilanguageSupport()
+{
+}
+
+MultilanguageSupport::MultilanguageSupport( Internal::MultilanguageSupport* implementation )
+: BaseHandle( implementation )
+{
+}
+
+MultilanguageSupport MultilanguageSupport::Get()
+{
+ return Internal::MultilanguageSupport::Get();
+}
+
+void MultilanguageSupport::SetScripts( LogicalModel& model )
+{
+ GetImplementation( *this ).SetScripts( model );
+}
+
+void MultilanguageSupport::ValidateFonts( LogicalModel& model )
+{
+ GetImplementation( *this ).ValidateFonts( model );
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__
+#define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal DALI_INTERNAL
+{
+
+class MultilanguageSupport;
+
+} // Internal
+
+class LogicalModel;
+
+/**
+ * @brief Sets the character's scripts to the model and validates the fonts set by the user or assigns default ones.
+ */
+class MultilanguageSupport : public BaseHandle
+{
+public:
+
+ /**
+ * @brief Create an uninitialized MultilanguageSupport handle.
+ */
+ MultilanguageSupport();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~MultilanguageSupport();
+
+ /**
+ * @brief This constructor is used by MultilanguageSupport::Get().
+ *
+ * @param[in] implementation A pointer to the internal multi-language support object.
+ */
+ explicit DALI_INTERNAL MultilanguageSupport( Internal::MultilanguageSupport* implementation );
+
+ /**
+ * @brief Retrieve a handle to the MultilanguageSupport instance.
+ *
+ * @return A handle to the MultilanguageSupport.
+ */
+ static MultilanguageSupport Get();
+
+ /**
+ * @brief Sets the scripts of the whole text.
+ *
+ * Any script info previously set is removed.
+ *
+ * Scripts are used to validate and set default fonts and to shape the text in further steps.
+ *
+ * @pre The @p model needs to have a text set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+ void SetScripts( LogicalModel& model );
+
+ /**
+ * @brief Validates the character's font of the whole text.
+ *
+ * It may update fonts set by application developers.
+ *
+ * This method ensures all characters are going to be rendered using an appropriate font. Provided a valid font
+ * exists in the platform.
+ *
+ * For those characters with no font set, it sets a default one.
+ *
+ * If a font has been set by the application developer, this method checks if the font supports the character.
+ * If it doesn't, this method replaces it by a default one.
+ *
+ * @pre The @p model needs to have a text set.
+ * @pre The @p model needs to have the scripts set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+ void ValidateFonts( LogicalModel& model );
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_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 <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h>
+
+// EXTERNAL INCLUDES
+#include <dali/dali.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering/shaders/text-basic-shader.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Text;
+
+namespace
+{
+
+const std::size_t PADDING = 2; //< To avoid GL filtering artefacts
+
+struct TextureCoordinates
+{
+ TextureCoordinates()
+ : topLeft( 0.0f, 0.0f ),
+ topRight( 1.0f, 0.0f ),
+ bottomLeft( 0.0f, 1.0f ),
+ bottomRight( 1.0f, 1.0f )
+ {
+ }
+
+ Vector2 topLeft;
+ Vector2 topRight;
+ Vector2 bottomLeft;
+ Vector2 bottomRight;
+};
+
+struct AtlasHelperGlyph
+{
+ AtlasHelperGlyph()
+ : fontId( 0 ),
+ index( 0 ),
+ xOffset( 0 ),
+ width( 0 ),
+ height( 0 )
+ {
+ }
+
+ AtlasHelperGlyph( FontId id,
+ GlyphIndex glyphIndex,
+ std::size_t offset,
+ std::size_t widthPixels,
+ std::size_t heightPixels )
+ : fontId( id ),
+ index( glyphIndex ),
+ xOffset( offset ),
+ width( widthPixels ),
+ height( heightPixels )
+ {
+ }
+
+ FontId fontId;
+ GlyphIndex index;
+ std::size_t xOffset;
+ std::size_t width;
+ std::size_t height;
+ TextureCoordinates coords;
+};
+
+struct AtlasHelper
+{
+ AtlasHelper()
+ : mWidth( 0.0f ),
+ mHeight( 0.0f )
+ {
+ mFontClient = TextAbstraction::FontClient::Get();
+ }
+
+ void Reset()
+ {
+ mWidth = 0.0f;
+ mHeight = 0.0f;
+ mGlyphs.clear();
+ }
+
+ void Reserve( std::size_t size )
+ {
+ mGlyphs.reserve( size );
+ }
+
+ bool GlyphFound( FontId fontId, GlyphIndex index ) const
+ {
+ for( unsigned int i=0; i<mGlyphs.size(); ++i )
+ {
+ const AtlasHelperGlyph& glyph = mGlyphs[i];
+
+ if( fontId == glyph.fontId &&
+ index == glyph.index )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void AddGlyph( const GlyphInfo& glyphInfo )
+ {
+ mGlyphs.push_back( AtlasHelperGlyph( glyphInfo.fontId, glyphInfo.index, mWidth, glyphInfo.width, glyphInfo.height ) );
+
+ mWidth += glyphInfo.width + PADDING;
+ if( mHeight < glyphInfo.height + PADDING )
+ {
+ mHeight = glyphInfo.height + PADDING;
+ }
+ }
+
+ Atlas CreateAtlas()
+ {
+ Atlas atlas = Atlas::New( mWidth, mHeight, Pixel::L8 );
+
+ for( unsigned int i=0; i<mGlyphs.size(); ++i )
+ {
+ AtlasHelperGlyph& glyph = mGlyphs[i];
+ BitmapImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
+ atlas.Upload( bitmap, glyph.xOffset, 0 );
+
+ TextureCoordinates& coords = glyph.coords;
+ coords.topLeft.x = static_cast<float>(glyph.xOffset) / static_cast<float>(mWidth);
+ coords.topLeft.y = 0.0f;
+ coords.topRight.x = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(mWidth);
+ coords.topRight.y = 0.0f;
+ coords.bottomLeft.x = static_cast<float>(glyph.xOffset) / static_cast<float>(mWidth);
+ coords.bottomLeft.y = static_cast<float>(glyph.height) / static_cast<float>(mHeight);
+ coords.bottomRight.x = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(mWidth);
+ coords.bottomRight.y = static_cast<float>(glyph.height) / static_cast<float>(mHeight);
+ }
+
+ return atlas;
+ }
+
+ void GetTextureCoordinates( FontId fontId, GlyphIndex index, TextureCoordinates& coords )
+ {
+ for( unsigned int i=0; i<mGlyphs.size(); ++i )
+ {
+ const AtlasHelperGlyph& glyph = mGlyphs[i];
+
+ if( fontId == glyph.fontId &&
+ index == glyph.index )
+ {
+ coords = glyph.coords;
+ return;
+ }
+ }
+ }
+
+private: // Data
+
+ std::size_t mWidth;
+ std::size_t mHeight;
+
+ std::vector<AtlasHelperGlyph> mGlyphs;
+
+ TextAbstraction::FontClient mFontClient;
+};
+
+} // unnamed namespace
+
+struct BasicRenderer::Impl
+{
+ /**
+ * @brief Ccreate an Atlas, uploading the necessary glyph bitmaps
+ *
+ * @param[in] glyphs The glyphs to upload.
+ */
+ Atlas CreateAtlas( const Vector<GlyphInfo>& glyphs )
+ {
+ AtlasHelper& helper = mAtlasHelper;
+
+ // Clear previous atlas
+ helper.Reset();
+ helper.Reserve( glyphs.Count() );
+
+ for( unsigned int i=0; i<glyphs.Count(); ++i )
+ {
+ float width = glyphs[i].width;
+ float height = glyphs[i].height;
+
+ if( width > 0 &&
+ height > 0 ) // skip whitespace
+ {
+ if( !helper.GlyphFound( glyphs[i].fontId, glyphs[i].index ) )
+ {
+ helper.AddGlyph( glyphs[i] );
+ }
+ }
+ }
+
+ // Uploads the bitmaps to Dali
+ return helper.CreateAtlas();
+ }
+
+ /**
+ * @brief Helper method to create a mesh with one quad per glyph.
+ *
+ * @param[in] glyphs The glyphs to display.
+ * @param[in] positions The 2D positions of the glyphs.
+ * @param[in] image The material uses this as a diffuse texture.
+ */
+ Mesh CreateMesh( const Vector<GlyphInfo>& glyphs, const std::vector<Vector2>& positions, Image image )
+ {
+ MeshData::VertexContainer vertices( 4 * glyphs.Count() ); // 1 quad per glyph
+
+ MeshData::FaceIndices faces;
+ faces.reserve( 6 * glyphs.Count() ); // 2 triangles per quad
+
+ for( unsigned int i=0; i<glyphs.Count(); ++i )
+ {
+ float width = glyphs[i].width;
+ float height = glyphs[i].height;
+
+ if( width > 0 &&
+ height > 0 ) // skip whitespace
+ {
+ const Vector2& position = positions[i];
+
+ TextureCoordinates coords;
+ mAtlasHelper.GetTextureCoordinates( glyphs[i].fontId, glyphs[i].index, coords );
+
+ vertices[ i*4 + 0 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 0.0f*height, 0.0f ), coords.topLeft, Vector3( 1.0f, 0.0f, 0.0f ) );
+ vertices[ i*4 + 1 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 0.0f*height, 0.0f ), coords.topRight, Vector3( 1.0f, 1.0f, 0.0f ) );
+ vertices[ i*4 + 2 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomLeft, Vector3( 0.0f, 1.0f, 0.0f ) );
+ vertices[ i*4 + 3 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomRight, Vector3( 0.0f, 0.0f, 1.0f ) );
+
+ faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 3 ); faces.push_back( i*4 + 1 );
+ faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 2 ); faces.push_back( i*4 + 3 );
+ }
+ }
+
+ Material material = Material::New( "Material" );
+ material.SetDiffuseTexture( image );
+
+ // Create the mesh data from the vertices and faces
+ MeshData meshData;
+ meshData.SetHasColor( false );
+ meshData.SetMaterial( material );
+ meshData.SetVertices( vertices );
+ meshData.SetFaceIndices( faces );
+
+ // Create a mesh from the data
+ Dali::Mesh mesh = Mesh::New( meshData );
+ return mesh;
+ }
+
+ RenderableActor mActor; ///< The actor which renders the text
+
+ AtlasHelper mAtlasHelper; ///< A helper class for storing atlas positions etc.
+};
+
+Text::RendererPtr BasicRenderer::New()
+{
+ return Text::RendererPtr( new BasicRenderer() );
+}
+
+RenderableActor BasicRenderer::Render( Text::ViewInterface& view )
+{
+ Text::Length numberOfGlyphs = view.GetNumberOfGlyphs();
+
+ if( numberOfGlyphs > 0 )
+ {
+ Vector<GlyphInfo> glyphs;
+ glyphs.Resize( numberOfGlyphs );
+
+ view.GetGlyphs( 0, &glyphs[0], numberOfGlyphs );
+
+ std::vector<Vector2> positions;
+ positions.resize( numberOfGlyphs );
+ view.GetGlyphPositions( 0, &positions[0], numberOfGlyphs );
+
+ Atlas atlas = mImpl->CreateAtlas( glyphs );
+
+ MeshActor actor = MeshActor::New( mImpl->CreateMesh( glyphs, positions, atlas ) );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAffectedByLighting( false );
+
+ ShaderEffect shader = BasicShader::New();
+ actor.SetShaderEffect( shader );
+
+ mImpl->mActor = actor;
+ }
+
+ return mImpl->mActor;
+}
+
+BasicRenderer::BasicRenderer()
+{
+ mImpl = new Impl();
+}
+
+BasicRenderer::~BasicRenderer()
+{
+ delete mImpl;
+}
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BASIC_RENDERER_H__
+#define __DALI_TOOLKIT_TEXT_BASIC_RENDERER_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief A reference implementation of Text::Renderer.
+ *
+ * This is intended for testing & performance comparisons with more complex solutions.
+ * Each basic renderer creates its own texture atlas, and uses a simple packing algorithm,
+ * in which glyphs are stored in a single row.
+ */
+class BasicRenderer : public Renderer
+{
+public:
+
+ /**
+ * @brief Create the renderer.
+ */
+ static RendererPtr New();
+
+ /**
+ * @brief Render the glyphs from a ViewInterface.
+ *
+ * @param[in] view The interface to a view.
+ * @return The Renderable actor used to position the text.
+ */
+ virtual RenderableActor Render( ViewInterface& view );
+
+protected:
+
+ /**
+ * @brief Constructor.
+ */
+ BasicRenderer();
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~BasicRenderer();
+
+private:
+
+ // Undefined
+ BasicRenderer( const BasicRenderer& handle );
+
+ // Undefined
+ BasicRenderer& operator=( const BasicRenderer& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BASIC_RENDERER_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 <dali-toolkit/public-api/text/rendering/text-renderer.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace BasicShader
+{
+
+Dali::ShaderEffect New()
+{
+ std::string vertexShader = DALI_COMPOSE_SHADER(
+ uniform mediump vec4 uTextureRect;\n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * vec4( aPosition.xy, 0.0, 1.0 );\n
+ vTexCoord = aTexCoord.xy;\n
+ }\n
+ );
+
+ std::string fragmentShader = DALI_COMPOSE_SHADER(
+ void main()\n
+ {\n
+ mediump vec4 color = texture2D( sTexture, vTexCoord );
+ gl_FragColor = vec4(uColor.rgb, uColor.a*color.r);
+ }\n
+ );
+
+ Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, fragmentShader,
+ Dali::GeometryType( Dali::GEOMETRY_TYPE_TEXTURED_MESH ),
+ Dali::ShaderEffect::GeometryHints( Dali::ShaderEffect::HINT_NONE ) );
+ return shaderEffect;
+}
+
+} // namespace BasicShader
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BASIC_SHADER_H__
+#define __DALI_TOOLKIT_TEXT_BASIC_SHADER_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 <dali/public-api/shader-effects/shader-effect.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief A basic shader for rendering glyphs in Pixel::L8 format.
+ */
+namespace BasicShader
+{
+
+/**
+ * Create a basic text shader.
+ * @return A handle to a newly allocated ShaderEffect
+ */
+Dali::ShaderEffect New();
+
+} // namespace BasicShader
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BASIC_SHADER_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 <dali-toolkit/public-api/text/rendering/text-renderer.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+Renderer::Renderer()
+{
+}
+
+Renderer::~Renderer()
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_RENDERER_H__
+#define __DALI_TOOLKIT_TEXT_RENDERER_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 <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-view-interface.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class Renderer;
+typedef IntrusivePtr<Renderer> RendererPtr;
+
+/**
+ * @brief Abstract base class for Text rendering back-ends.
+ *
+ * This is reponsible for rendering the glyphs from a ViewInterface in the specified positions.
+ * It is implemented by returning a RenderableActor intended as the child of a UI control.
+ */
+class Renderer : public RefObject
+{
+public:
+
+ /**
+ * @brief Render the glyphs from a ViewInterface.
+ *
+ * @param[in] view The interface to a view.
+ * @return The Renderable actor used to position the text.
+ */
+ virtual RenderableActor Render( ViewInterface& view ) = 0;
+
+protected:
+
+ /**
+ * @brief Constructor.
+ */
+ Renderer();
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~Renderer();
+
+private:
+
+ // Undefined
+ Renderer( const Renderer& handle );
+
+ // Undefined
+ Renderer& operator=( const Renderer& handle );
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_RENDERER_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_SCRIPT_RUN_H__
+#define __DALI_TOOLKIT_TEXT_SCRIPT_RUN_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Run of characters with the same script.
+ */
+struct ScriptRun
+{
+ CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
+ Script script; ///< Script of the run.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SCRIPT_RUN_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.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/public-api/text/script.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+Script GetCharacterScript( Character character )
+{
+ // Latin script:
+ // 0x0000 - 0x007f C0 Controls and Basic Latin
+ // 0x0080 - 0x00ff C1 Controls and Latin-1 Supplement
+ // 0x0100 - 0x017f Latin Extended-A
+ // 0x0180 - 0x024f Latin Extended-B
+ // 0x0250 - 0x02af IPA Extensions
+ // 0x02b0 - 0x02ff Spacing Modifier Letters
+ // 0x1d00 - 0x1d7f Phonetic Extensions
+ // 0x1d80 - 0x1dbf Phonetic Extensions Supplement
+ // 0x1e00 - 0x1eff Latin Extended Additional
+ // 0x2070 - 0x209f Superscripts and Subscripts
+ // 0x2100 - 0x214f Letterlike symbols
+ // 0x2150 - 0x218f Number Forms
+ // 0x2c60 - 0x2c7f Latin Extended-C
+ // 0xa720 - 0xa7ff Latin Extended-D
+ // 0xab30 - 0xab6f Latin Extended-E
+ // 0xfb00 - 0xfb4f Alphabetic Presentation Forms
+ // 0xff00 - 0xffef Halfwidth and Fullwidth Forms
+
+ // Brahmic scripts:
+ // 0x0900 - 0x097f Devanagari
+ // 0x0980 - 0x09ff Bengali
+ // 0x0a00 - 0x0a7f Gurmukhi
+ // 0x0a80 - 0x0aff Gujarati
+ // 0x0b00 - 0x0b7f Oriya
+ // 0x0b80 - 0x0bff Tamil
+ // 0x0c00 - 0x0c7f Telugu
+ // 0x0c80 - 0x0cff Kannada
+ // 0x0d00 - 0x0d7f Malayalam
+
+ // Sinhala script.
+ // 0x0d80 - 0x0dff Sinhala
+
+ // Arabic script.
+ // 0x0600 - 0x06ff Arabic
+ // 0x0750 - 0x077f Arabic Supplement
+ // 0x08A0 - 0x08ff Arabic Extended-A
+ // 0xfb50 - 0xfdff Arabic Presentation Forms-A
+ // 0xfe70 - 0xfeff Arabic Presentation Forms-B
+ // 0x1ee00 - 0x1eeff Arabic Mathematical Alphabetic Symbols
+
+ // CJK and Vietnamese script.
+ // 0x2E80 - 0x2eff CJK Radicals Supplement
+ // 0x3000 - 0x303f CJK Symbols and Punctuation
+ // 0x3200 - 0x32ff Enclosed CJK Letters and Months
+ // 0x3400 - 0x4dbf CJK Unified Ideographs Extension A
+ // 0x4e00 - 0x62ff CJK Unified Ideographs
+ // 0x6300 - 0x77ff CJK Unified Ideographs
+ // 0x7800 - 0x8cff CJK Unified Ideographs
+ // 0x8d00 - 0x9fff CJK Unified Ideographs
+ // 0x20000 - 0x215ff CJK Unified Ideographs Extension B
+ // 0x21600 - 0x230ff CJK Unified Ideographs Extension B
+ // 0x23100 - 0x245ff CJK Unified Ideographs Extension B
+ // 0x24600 - 0x260ff CJK Unified Ideographs Extension B
+ // 0x26100 - 0x275ff CJK Unified Ideographs Extension B
+ // 0x27600 - 0x290ff CJK Unified Ideographs Extension B
+ // 0x29100 - 0x2a6df CJK Unified Ideographs Extension B
+ // 2a700-2b73f. CJK Unified Ideographs Extension C
+ // 2b740-2b81f. CJK Unified Ideographs Extension D
+
+ // Hangul script
+ // 0x1100 - 0x11ff Hangul jamo
+ // 0x3130 - 0x318f Hangul Compatibility Jamo
+ // 0xa960 - 0xa97f Hangul Jamo Extended-A
+ // 0xac00 - 0xd7af Hangul Syllables
+ // 0xd7b0 - 0xd7ff Hangul Jamo Extended-B
+
+ // Khmer script
+ // 0x1780 - 0x17ff Khmer
+ // 0x19e0 - 0x19ff Khmer Symbols
+
+ // Lao script
+ // 0x0e80 - 0x0eff Lao
+
+ // Thai script
+ // 0x0e00 - 0x0e7f Thai
+
+ // Burmese script
+ // 0x1000 - 0x104f Myanmar
+
+
+ if( character <= 0x0cff )
+ {
+ if( character <= 0x09ff )
+ {
+ if( character <= 0x077f )
+ {
+ if( character <= 0x02ff )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0x0600 <= character ) && ( character <= 0x06ff ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ if( ( 0x0750 <= character ) && ( character <= 0x077f ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ }
+ else // > 0x077f
+ {
+ if( ( 0x08A0 <= character ) && ( character <= 0x08ff ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ if( ( 0x0900 <= character ) && ( character <= 0x097f ) )
+ {
+ return TextAbstraction::DEVANAGARI;
+ }
+ if( ( 0x0980 <= character ) && ( character <= 0x09ff ) )
+ {
+ return TextAbstraction::BENGALI;
+ }
+ }
+ }
+ else // > 0x09ff
+ {
+ if( character <= 0x0b7f )
+ {
+ if( ( 0x0a00 <= character ) && ( character <= 0x0a7f ) )
+ {
+ return TextAbstraction::GURMUKHI;
+ }
+ if( ( 0x0a80 <= character ) && ( character <= 0x0aff ) )
+ {
+ return TextAbstraction::GUJARATI;
+ }
+ if( ( 0x0b00 <= character ) && ( character <= 0x0b7f ) )
+ {
+ return TextAbstraction::ORIYA;
+ }
+ }
+ else // > 0x0b7f
+ {
+ if( ( 0x0b80 <= character ) && ( character <= 0x0bff ) )
+ {
+ return TextAbstraction::TAMIL;
+ }
+ if( ( 0x0c00 <= character ) && ( character <= 0x0c7f ) )
+ {
+ return TextAbstraction::TELUGU;
+ }
+ if( ( 0x0c80 <= character ) && ( character <= 0x0cff ) )
+ {
+ return TextAbstraction::KANNADA;
+ }
+ }
+ }
+ }
+ else // > 0x0cff
+ {
+ if( character <= 0x2c7f )
+ {
+ if( character <= 0x1eff )
+ {
+ if( ( 0x0d00 <= character ) && ( character <= 0x0d7f ) )
+ {
+ return TextAbstraction::MALAYALAM;
+ }
+ if( ( 0x0d80 <= character ) && ( character <= 0x0dff ) )
+ {
+ return TextAbstraction::SINHALA;
+ }
+ if( ( 0x0e00 <= character ) && ( character <= 0x0e7f ) )
+ {
+ return TextAbstraction::THAI;
+ }
+ if( ( 0x0e80 <= character ) && ( character <= 0x0eff ) )
+ {
+ return TextAbstraction::LAO;
+ }
+ if( ( 0x1000 <= character ) && ( character <= 0x104f ) )
+ {
+ return TextAbstraction::BURMESE;
+ }
+ if( ( 0x1100 <= character ) && ( character <= 0x11ff ) )
+ {
+ return TextAbstraction::HANGUL;
+ }
+ if( ( 0x1780 <= character ) && ( character <= 0x17ff ) )
+ {
+ return TextAbstraction::KHMER;
+ }
+ if( ( 0x19e0 <= character ) && ( character <= 0x19ff ) )
+ {
+ return TextAbstraction::KHMER;
+ }
+ if( ( 0x1d00 <= character ) && ( character <= 0x1eff ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ }
+ else // > 0x1eff
+ {
+ if( ( 0x2070 <= character ) && ( character <= 0x209f ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0x2100 <= character ) && ( character <= 0x218f ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0x2c60 <= character ) && ( character <= 0x2c7f ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ }
+ }
+ else // > 0x2c7f
+ {
+ if( character <= 0xfdff )
+ {
+ if( ( 0x2e80 <= character ) && ( character <= 0x2eff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x3000 <= character ) && ( character <= 0x303f ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x3130 <= character ) && ( character <= 0x318f ) )
+ {
+ return TextAbstraction::HANGUL;
+ }
+ if( ( 0x3200 <= character ) && ( character <= 0x32ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x3400 <= character ) && ( character <= 0x4dbf ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x4e00 <= character ) && ( character <= 0x62ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x6300 <= character ) && ( character <= 0x77ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x7800 <= character ) && ( character <= 0x8cff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x8d00 <= character ) && ( character <= 0x9fff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0xa720 <= character ) && ( character <= 0xa7ff ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0xa960 <= character ) && ( character <= 0xa97f ) )
+ {
+ return TextAbstraction::HANGUL;
+ }
+ if( ( 0xab30 <= character ) && ( character <= 0xab6f ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0xac00 <= character ) && ( character <= 0xd7af ) )
+ {
+ return TextAbstraction::HANGUL;
+ }
+ if( ( 0xd7b0 <= character ) && ( character <= 0xd7ff ) )
+ {
+ return TextAbstraction::HANGUL;
+ }
+ if( ( 0xfb00 <= character ) && ( character <= 0xfb4f ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0xfb50 <= character ) && ( character <= 0xfdff ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ }
+ else // > 0xfdff
+ {
+ if( ( 0xfe70 <= character ) && ( character <= 0xfeff ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ if( ( 0xff00 <= character ) && ( character <= 0xffef ) )
+ {
+ return TextAbstraction::LATIN;
+ }
+ if( ( 0x1ee00 <= character ) && ( character <= 0x1eeff ) )
+ {
+ return TextAbstraction::ARABIC;
+ }
+ if( ( 0x20000 <= character ) && ( character <= 0x215ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x21600 <= character ) && ( character <= 0x230ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x23100 <= character ) && ( character <= 0x245ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x24600 <= character ) && ( character <= 0x260ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x26100 <= character ) && ( character <= 0x275ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x27600 <= character ) && ( character <= 0x290ff ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x29100 <= character ) && ( character <= 0x2a6df ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x2a700 <= character ) && ( character <= 0x2b73f ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ if( ( 0x2b740 <= character ) && ( character <= 0x2b81f ) )
+ {
+ return TextAbstraction::CJK;
+ }
+ }
+ }
+ }
+
+ return TextAbstraction::UNKNOWN;
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_SCRIPT_H__
+#define __DALI_TOOLKIT_TEXT_SCRIPT_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Retrieves a character's script.
+ *
+ * @param[in] character The character.
+ *
+ * @return The chraracter's script.
+ */
+Script GetCharacterScript( Character character );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SCRIPT_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 <dali-toolkit/public-api/text/segmentation.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+void SetLineBreakInfo( LogicalModel& model )
+{
+}
+
+void SetWordBreakInfo( LogicalModel& model )
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
+#define __DALI_TOOLKIT_TEXT_SEGMENTATION_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class LogicalModel;
+
+/**
+ * Sets line break info.
+ *
+ * Any line break info previously set is removed.
+ *
+ * @pre The @p model needs to have a text set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+void SetLineBreakInfo( LogicalModel& model );
+
+/**
+ * Sets word break info.
+ *
+ * Any word break info previously set is removed.
+ *
+ * @pre The @p model needs to have a text set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+void SetWordBreakInfo( LogicalModel& model );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SEGMENTATION_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 <dali-toolkit/public-api/text/text-controller.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/font-client.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/character-set-conversion.h>
+#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
+#include <dali-toolkit/public-api/text/logical-model.h>
+#include <dali-toolkit/public-api/text/text-view.h>
+#include <dali-toolkit/public-api/text/visual-model.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct Controller::Impl
+{
+ Impl()
+ : mNewTextArrived( false )
+ {
+ mLogicalModel = LogicalModel::New();
+ mVisualModel = VisualModel::New();
+
+ mView.SetVisualModel( mVisualModel );
+
+ mFontClient = TextAbstraction::FontClient::Get();
+ }
+
+ std::string mNewText;
+ bool mNewTextArrived;
+
+ LogicalModelPtr mLogicalModel;
+ VisualModelPtr mVisualModel;
+
+ View mView;
+
+ LayoutEngine mLayoutEngine;
+
+ TextAbstraction::FontClient mFontClient;
+};
+
+ControllerPtr Controller::New()
+{
+ return ControllerPtr( new Controller() );
+}
+
+void Controller::SetText( const std::string& text )
+{
+ // Keep until size negotiation
+ mImpl->mNewText = text;
+ mImpl->mNewTextArrived = true;
+}
+
+bool Controller::Relayout( const Vector2& size )
+{
+ bool viewUpdated( false );
+
+ if( mImpl->mNewTextArrived )
+ {
+ std::string& text = mImpl->mNewText;
+
+ // Convert text into UTF-32
+ Vector<Character> utf32Characters;
+ utf32Characters.Resize( text.size() );
+
+ // This is a bit horrible but std::string returns a (signed) char*
+ const uint8_t* utf8 = reinterpret_cast<const uint8_t*>( text.c_str() );
+
+ Length characterCount = Utf8ToUtf32( utf8, text.size(), &utf32Characters[0] );
+
+ // Manipulate the logical model
+ mImpl->mLogicalModel->SetText( &utf32Characters[0], characterCount );
+
+ // Update the visual model
+ mImpl->mLayoutEngine.UpdateVisualModel( size, *mImpl->mLogicalModel, *mImpl->mVisualModel );
+
+ // Discard temporary text
+ mImpl->mNewTextArrived = false;
+ text.clear();
+
+ viewUpdated = true;
+ }
+
+ return viewUpdated;
+}
+
+View& Controller::GetView()
+{
+ return mImpl->mView;
+}
+
+LayoutEngine& Controller::GetLayoutEngine()
+{
+ return mImpl->mLayoutEngine;
+}
+
+Controller::~Controller()
+{
+ delete mImpl;
+}
+
+Controller::Controller()
+: mImpl( NULL )
+{
+ mImpl = new Controller::Impl();
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_CONTROLLER_H__
+#define __DALI_TOOLKIT_TEXT_CONTROLLER_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 <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-view.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class Controller;
+class LayoutEngine;
+
+typedef IntrusivePtr<Controller> ControllerPtr;
+
+/**
+ * @brief A Text Controller is used by UI Controls which display text.
+ *
+ * It manipulates the Logical & Visual text models on behalf of the UI Controls.
+ * It provides a view of the text that can be used by rendering back-ends.
+ */
+class Controller : public RefObject
+{
+public:
+
+ /**
+ * @brief Create a new instance of a Controller.
+ *
+ * @return A pointer to a new Controller.
+ */
+ static ControllerPtr New();
+
+ /**
+ * @brief Replaces any text previously set.
+ *
+ * @note This will be converted into UTF-32 when stored in the text model.
+ * @param[in] text A string of UTF-8 characters.
+ */
+ void SetText( const std::string& text );
+
+ /**
+ * @brief Triggers a relayout which updates View (if necessary).
+ *
+ * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
+ * @param[in] size A the size of a bounding box to layout text within.
+ * @return True if the View was updated.
+ */
+ bool Relayout( const Vector2& size );
+
+ /**
+ * @brief Return the layout engine.
+ *
+ * @return A reference to the layout engine.
+ */
+ LayoutEngine& GetLayoutEngine();
+
+ /**
+ * @brief Return a view of the text.
+ *
+ * @return A reference to the view.
+ */
+ View& GetView();
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~Controller();
+
+private:
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller();
+
+ /**
+ * @brief Populates the visual model.
+ */
+ void UpdateVisualModel();
+
+ // Undefined
+ Controller( const Controller& handle );
+
+ // Undefined
+ Controller& operator=( const Controller& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_CONTROLLER_H__
--- /dev/null
+#ifndef __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__
+#define __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_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 <dali/public-api/text-abstraction/text-abstraction.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+typedef TextAbstraction::FontId FontId; ///< The unique identifier for a font face (generated by FontClient)
+typedef TextAbstraction::FontMetrics FontMetrics; ///< The metrics for a Font expressed in 26.6 fractional pixel format
+typedef TextAbstraction::PointSize26Dot6 PointSize26Dot6; ///< The point size in 26.6 fractional points
+typedef TextAbstraction::FaceIndex FaceIndex; ///< Used with fonts which allow several font faces
+typedef TextAbstraction::GlyphIndex GlyphIndex; ///< Uniquely identifies a glyph within a particular font
+typedef TextAbstraction::Character Character; ///< A UTF-32 representation of a character
+typedef TextAbstraction::GlyphInfo GlyphInfo; ///< The information describing a glyph (font ID, index, metrics)
+typedef TextAbstraction::CharacterIndex CharacterIndex; ///< An index into an array of characters
+typedef TextAbstraction::Length Length; ///< The length of an array
+typedef TextAbstraction::BidiInfoIndex BidiInfoIndex; ///< Index to the bidirectional info for a paragraph.
+typedef TextAbstraction::Script Script; ///< The character's script.
+typedef TextAbstraction::LineBreakInfo LineBreakInfo; ///< Line break info (must break, allow break, no break). Possible values are: @e LINE_MUST_BREAK, @e LINE_ALLOW_BREAK and @e LINE_NO_BREAK (in the TextAbstraction namespace).
+typedef TextAbstraction::WordBreakInfo WordBreakInfo; ///< Word break info (break, no break). Possible values are: @e WORD_BREAK and @e WORD_NO_BREAK (in the TextAbstraction namespace).
+
+typedef uint32_t GlyphIndex; ///< An index into an array of glyphs
+typedef bool CharacterDirection; ///< The character's direction: @e false is left to right, @e true is right to left.
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_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 <dali-toolkit/public-api/text/text-view-interface.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+ViewInterface::ViewInterface()
+{
+}
+
+ViewInterface::~ViewInterface()
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
+#define __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+struct Vector2;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Abstract interface to provide the information necessary displaying text.
+ *
+ * This includes:
+ * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
+ * - The visual position of each glyph within the layout
+ * - A window into the text layout e.g. which page of a document to view
+ */
+class ViewInterface
+{
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ ViewInterface();
+
+ /**
+ * @brief Virtual destructor
+ */
+ virtual ~ViewInterface();
+
+ /**
+ * Retrieves the number of glyphs.
+ *
+ * @return The number of glyphs.
+ */
+ virtual Length GetNumberOfGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves glyphs in the given buffer.
+ *
+ * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs.
+ * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
+ * @param[in] glyphIndex Index to the first glyph.
+ * @param[in] numberOfGlyphs Number of glyphs to be copied.
+ */
+ virtual void GetGlyphs( GlyphIndex glyphIndex,
+ GlyphInfo* glyphs,
+ Length numberOfGlyphs ) const = 0;
+
+ /**
+ * @brief Retrieves the glyph positions.
+ *
+ * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions.
+ * @param[in] glyphIndex Index to the first glyph position.
+ * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
+ * @param[in] numberOfGlyphs The number of positions to be copied.
+ */
+ virtual void GetGlyphPositions( GlyphIndex glyphIndex,
+ Vector2* glyphPositions,
+ Length numberOfGlyphs ) const = 0;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_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 <dali-toolkit/public-api/text/text-view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct View::Impl
+{
+ VisualModelPtr mVisualModel;
+};
+
+View::View()
+: mImpl( NULL )
+{
+ mImpl = new View::Impl();
+}
+
+View::~View()
+{
+ delete mImpl;
+}
+
+void View::SetVisualModel( VisualModelPtr visualModel )
+{
+ mImpl->mVisualModel = visualModel;
+}
+
+Length View::GetNumberOfGlyphs() const
+{
+ if( mImpl->mVisualModel )
+ {
+ return mImpl->mVisualModel->GetNumberOfGlyphs();
+ }
+
+ return 0;
+}
+
+void View::GetGlyphs( GlyphIndex glyphIndex,
+ GlyphInfo* glyphs,
+ Length numberOfGlyphs ) const
+{
+ if( mImpl->mVisualModel )
+ {
+ mImpl->mVisualModel->GetGlyphs( glyphIndex, glyphs, numberOfGlyphs );
+ }
+}
+
+void View::GetGlyphPositions( GlyphIndex glyphIndex,
+ Vector2* glyphPositions,
+ Length numberOfGlyphs ) const
+{
+ if( mImpl->mVisualModel )
+ {
+ mImpl->mVisualModel->GetGlyphPositions( glyphIndex, glyphPositions, numberOfGlyphs );
+ }
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_VIEW_H__
+#define __DALI_TOOLKIT_TEXT_VIEW_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-view-interface.h>
+#include <dali-toolkit/public-api/text/visual-model.h>
+
+namespace Dali
+{
+
+struct Vector2;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief View provides an interface between the Text layout engine and rendering back-end.
+ */
+class View : public ViewInterface
+{
+public:
+
+ /**
+ * @brief Create a new instance of a View.
+ */
+ View();
+
+ /**
+ * @brief Virtual destructor.
+ */
+ virtual ~View();
+
+ /**
+ * @brief Set the visual model.
+ *
+ * @param[in] visualModel The visual model used by the View.
+ */
+ void SetVisualModel( VisualModelPtr visualModel );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
+ */
+ virtual Length GetNumberOfGlyphs() const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
+ */
+ virtual void GetGlyphs( GlyphIndex glyphIndex,
+ GlyphInfo* glyphs,
+ Length numberOfGlyphs ) const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphPositions()
+ */
+ virtual void GetGlyphPositions( GlyphIndex glyphIndex,
+ Vector2* glyphPositions,
+ Length numberOfGlyphs ) const;
+
+private:
+
+ // Undefined
+ View( const View& handle );
+
+ // Undefined
+ View& operator=( const View& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_VIEW_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 <dali-toolkit/public-api/text/visual-model.h>
+
+// EXTERNAL INCLUDES
+#include <string.h>
+#include <vector>
+#include <dali/public-api/math/vector2.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct VisualModel::Impl
+{
+ Vector<GlyphInfo> mGlyphs;
+ Vector<CharacterIndex> mGlyphsToCharacters;
+ Vector<Length> mCharactersPerGlyph;
+ std::vector<Vector2> mGlyphPositions;
+};
+
+VisualModelPtr VisualModel::New()
+{
+ return VisualModelPtr( new VisualModel() );
+}
+
+void VisualModel::SetGlyphs( const GlyphInfo* glyphs,
+ const CharacterIndex* characterIndices,
+ const Length* charactersPerGlyph,
+ Length numberOfGlyphs )
+{
+ Vector<GlyphInfo>& modelGlyphs = mImpl->mGlyphs;
+ modelGlyphs.Resize( numberOfGlyphs );
+ memcpy( &modelGlyphs[0], glyphs, numberOfGlyphs*sizeof(GlyphInfo) );
+
+ Vector<CharacterIndex>& glyphsToCharacters = mImpl->mGlyphsToCharacters;
+ glyphsToCharacters.Resize( numberOfGlyphs );
+ memcpy( &glyphsToCharacters[0], characterIndices, numberOfGlyphs*sizeof(CharacterIndex) );
+
+ Vector<Length>& modelCharactersPerGlyph = mImpl->mCharactersPerGlyph;
+ modelCharactersPerGlyph.Resize( numberOfGlyphs );
+ memcpy( &modelCharactersPerGlyph[0], charactersPerGlyph, numberOfGlyphs*sizeof(Length) );
+}
+
+Length VisualModel::GetNumberOfGlyphs() const
+{
+ return mImpl->mGlyphs.Count();
+}
+
+void VisualModel::GetGlyphs( GlyphIndex glyphIndex,
+ GlyphInfo* glyphs,
+ Length numberOfGlyphs ) const
+{
+ Vector<GlyphInfo>& modelGlyphs = mImpl->mGlyphs;
+ memcpy( glyphs, &modelGlyphs[glyphIndex], numberOfGlyphs*sizeof(GlyphInfo) );
+}
+
+CharacterIndex VisualModel::GetCharacterIndex( GlyphIndex glyphIndex ) const
+{
+ return mImpl->mGlyphsToCharacters[glyphIndex];
+}
+
+Length VisualModel::GetCharactersPerGlyph( GlyphIndex glyphIndex ) const
+{
+ return mImpl->mCharactersPerGlyph[glyphIndex];
+}
+
+GlyphIndex VisualModel::GetGlyphIndex( CharacterIndex characterIndex ) const
+{
+ GlyphIndex index( 0 );
+
+ for( unsigned int i=0; i<mImpl->mGlyphsToCharacters.Count(); ++i )
+ {
+ if( mImpl->mGlyphsToCharacters[i] == characterIndex )
+ {
+ index = i;
+ break;
+ }
+ }
+
+ return index;
+}
+
+void VisualModel::SetGlyphPositions( const Vector2* glyphPositions,
+ Length numberOfGlyphs )
+{
+ std::vector<Vector2>& modelPositions = mImpl->mGlyphPositions;
+ modelPositions.resize( numberOfGlyphs );
+ memcpy( &modelPositions[0], glyphPositions, numberOfGlyphs*sizeof(Vector2) );
+}
+
+void VisualModel::GetGlyphPositions( GlyphIndex glyphIndex,
+ Vector2* glyphPositions,
+ Length numberOfGlyphs ) const
+{
+ std::vector<Vector2>& modelPositions = mImpl->mGlyphPositions;
+ memcpy( glyphPositions, &modelPositions[0], numberOfGlyphs*sizeof(Vector2) );
+}
+
+VisualModel::~VisualModel()
+{
+ delete mImpl;
+}
+
+VisualModel::VisualModel()
+: mImpl( NULL )
+{
+ mImpl = new VisualModel::Impl();
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_VISUAL_MODEL_H__
+#define __DALI_TOOLKIT_TEXT_VISUAL_MODEL_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 <dali/public-api/common/intrusive-ptr.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-definitions.h>
+
+namespace Dali
+{
+
+struct Vector2;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class VisualModel;
+typedef IntrusivePtr<VisualModel> VisualModelPtr;
+
+/**
+ * @brief A visual text model contains layout specific information.
+ *
+ * This includes:
+ * - A series of glyphs in visual order i.e. after the bidirectional reordering.
+ * - The position of each glyph within a 2D bounding box.
+ */
+class VisualModel : public RefObject
+{
+public:
+
+ /**
+ * @brief Create a new instance of a VisualModel.
+ *
+ * @return A pointer to a new VisualModel.
+ */
+ static VisualModelPtr New();
+
+ // Glyph interface.
+
+ /**
+ * @brief Replaces any glyphs previously set.
+ *
+ * @param[in] glyphs An array of glyphs in the visual order.
+ * @param[in] characterIndices An array containing the first character in the logical model that each glyph relates to.
+ * @param[in] charactersPerGlyph An array of containing the number of characters per glyph.
+ * @param[in] numberOfGlyphs The number of glyphs.
+ */
+ void SetGlyphs( const GlyphInfo* glyphs,
+ const CharacterIndex* characterIndices,
+ const Length* charactersPerGlyph,
+ Length numberOfGlyphs );
+
+ /**
+ * Retrieves the number of glyphs.
+ *
+ * @return The number of glyphs.
+ */
+ Length GetNumberOfGlyphs() const;
+
+ /**
+ * @brief Retrieves glyphs in the given buffer.
+ *
+ * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs.
+ * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
+ * @param[in] glyphIndex Index to the first glyph.
+ * @param[in] numberOfGlyphs Number of glyphs to be copied.
+ */
+ void GetGlyphs( GlyphIndex glyphIndex,
+ GlyphInfo* glyphs,
+ Length numberOfGlyphs ) const;
+
+ // Character <--> Glyph conversion
+
+ /**
+ * @brief Retrieves the first character in the logical model which a glyph represents.
+ *
+ * @note After shaping several characters may be represented by the same glyph.
+ * Alternatively several glyphs may be required to display a character.
+ * @param[in] glyphIndex The glyph index.
+ * @return The character index.
+ */
+ CharacterIndex GetCharacterIndex( GlyphIndex glyphIndex ) const;
+
+ /**
+ * @brief Query the number of characters the glyph represents.
+ *
+ * @param[in] glyphIndex The glyph index.
+ * @return The number of characters represented by the glyph.
+ */
+ Length GetCharactersPerGlyph( GlyphIndex glyphIndex ) const;
+
+ /**
+ * Retrieves the first glyph in the visual model which represents a given character.
+ *
+ * @note After shaping several characters may be represented by the same glyph.
+ * Alternatively several glyphs may be required to display a character.
+ * @param[in] characterIndex The character index.
+ * @return The glyph index.
+ */
+ GlyphIndex GetGlyphIndex( CharacterIndex characterIndex ) const;
+
+ // Position interface
+
+ /**
+ * @brief Replaces any glyph positions previously set.
+ *
+ * @param[in] glyphPositions An array of visual positions for each glyph.
+ * @param[in] numberOfGlyphs The number of positions.
+ */
+ void SetGlyphPositions( const Vector2* glyphPositions,
+ Length numberOfGlyphs );
+
+ /**
+ * @brief Retrieves the glyph positions.
+ *
+ * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions.
+ * @param[in] glyphIndex Index to the first glyph position.
+ * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
+ * @param[in] numberOfGlyphs The number of positions to be copied.
+ */
+ void GetGlyphPositions( GlyphIndex glyphIndex,
+ Vector2* glyphPositions,
+ Length numberOfGlyphs ) const;
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~VisualModel();
+
+private:
+
+ /**
+ * @brief Private constructor.
+ */
+ VisualModel();
+
+ // Undefined
+ VisualModel( const VisualModel& handle );
+
+ // Undefined
+ VisualModel& operator=( const VisualModel& handle );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+};
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_VISUAL_MODEL_H__
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
- Version: 1.0.28
+ Version: 1.0.29
Release: 1
Group: System/Libraries
License: Apache-2.0
BuildRequires: boost-devel
BuildRequires: pkgconfig(dali)
BuildRequires: pkgconfig(dali-core)
-BuildRequires: fribidi-devel
%description
The OpenGLES Canvas Core Library Toolkit - a set of controls that provide