gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
+1.3. MOBILE Profile
+-------------------
+ gbs build -A [TARGET_ARCH] --spec dali-toolkit-mobile.spec
2. Building for Ubuntu desktop
==============================
dataReadOnlyDir=${prefix}/share/dali/
fi
+DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDALI_PROFILE_${enable_profile}"
+AM_CONDITIONAL([COMMON_PROFILE], [test x$enable_profile = xCOMMON])
+AM_CONDITIONAL([MOBILE_PROFILE], [test x$enable_profile = xMOBILE])
+
AC_SUBST(dataReadWriteDir)
AC_SUBST(dataReadOnlyDir)
AC_SUBST(DALI_TOOLKIT_CFLAGS)
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
+if MOBILE_PROFILE
+toolkit_styles_dir = ../../../dali-toolkit/styles/mobile
+else
+toolkit_styles_dir = ../../../dali-toolkit/styles
+endif
+
include ../../../dali-toolkit/images/file.list
include ../../../dali-toolkit/sounds/file.list
include ../../../dali-toolkit/styles/file.list
$(toolkit_src_dir)/text/shaper.cpp \
$(toolkit_src_dir)/text/text-control-interface.cpp \
$(toolkit_src_dir)/text/text-controller.cpp \
+ $(toolkit_src_dir)/text/text-io.cpp \
$(toolkit_src_dir)/text/text-view.cpp \
$(toolkit_src_dir)/text/text-view-interface.cpp \
$(toolkit_src_dir)/text/visual-model.cpp \
#include <dali-toolkit/internal/text/logical-model.h>
#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/script-run.h>
+#include <dali-toolkit/internal/text/text-io.h>
namespace Dali
{
// The font is not valid. Set to zero and a default one will be set.
fontId = 0u;
}
- else
+ else if( !IsValidForAllScripts( character ) )
{
// Add the font to the valid font cache.
validateFontsPerScript = new ValidateFontsPerScript();
}
}
}
- }
+ } // !isDefault
// The font has not been validated. Find a default one.
if( 0u == fontId )
return 0.0f;
}
+void Controller::GetDefaultFonts( Vector<FontRun>& fonts, Length numberOfCharacters )
+{
+ if( mImpl->mFontDefaults )
+ {
+ FontRun fontRun;
+ fontRun.characterRun.characterIndex = 0;
+ fontRun.characterRun.numberOfCharacters = numberOfCharacters;
+ fontRun.fontId = mImpl->mFontDefaults->GetFontId( mImpl->mFontClient );
+ fontRun.isDefault = true;
+
+ fonts.PushBack( fontRun );
+ }
+}
+
void Controller::EnableTextInput( DecoratorPtr decorator )
{
if( !mImpl->mTextInput )
text.clear();
}
+ const Length numberOfCharacters = mImpl->mLogicalModel->GetNumberOfCharacters();
+
Vector<LineBreakInfo> lineBreakInfo;
if( GET_LINE_BREAKS & operations )
{
const bool validateFonts = VALIDATE_FONTS & operations;
Vector<ScriptRun> scripts;
- Vector<FontRun> fonts;
-
- if( mImpl->mFontDefaults )
- {
- // TODO - pass into ValidateFonts
- }
+ Vector<FontRun> validFonts;
if( getScripts || validateFonts )
{
if( validateFonts )
{
+ // Copy the requested font defaults received via the property system.
+ // These may not be valid i.e. may not contain glyphs for the necessary scripts.
+ GetDefaultFonts( validFonts, numberOfCharacters );
+
// Validates the fonts. If there is a character with no assigned font it sets a default one.
// After this call, fonts are validated.
multilanguageSupport.ValidateFonts( utf32Characters,
scripts,
- fonts );
+ validFonts );
// Sets the fonts into the model.
- mImpl->mLogicalModel->SetFonts( fonts.Begin(), fonts.Count() );
+ mImpl->mLogicalModel->SetFonts( validFonts.Begin(), validFonts.Count() );
}
}
// after the first time the text has been laid out.
// Fill the vectors again.
- const Length numberOfCharacters = mImpl->mLogicalModel->GetNumberOfCharacters();
-
if( 0u == utf32Characters.Count() )
{
utf32Characters.Resize( numberOfCharacters );
Vector<Length> charactersPerGlyph;
if( SHAPE_TEXT & operations )
{
+ if( 0u == validFonts.Count() )
+ {
+ validFonts.Resize( mImpl->mLogicalModel->GetNumberOfFontRuns( 0u,
+ numberOfCharacters ) );
+ mImpl->mLogicalModel->GetFontRuns( validFonts.Begin(),
+ 0u,
+ numberOfCharacters );
+ }
+
// Shapes the text.
ShapeText( utf32Characters,
lineBreakInfo,
scripts,
- fonts,
+ validFonts,
glyphs,
glyphsToCharactersMap,
charactersPerGlyph );
// EXTERNAL INCLUDES
#include <string>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/math/vector3.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
+#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-view.h>
float GetDefaultPointSize() const;
/**
+ * @brief Retrieve the default fonts.
+ *
+ * @param[out] fonts The default font family, style and point sizes.
+ * @param[in] numberOfCharacters The number of characters in the logical model.
+ */
+ void GetDefaultFonts( Dali::Vector<FontRun>& fonts, Length numberOfCharacters );
+
+ /**
* @brief Called to enable text input.
*
* @note Only selectable or editable controls should calls this.
--- /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/text-io.h>
+
+// EXTERNAL INCLUDES
+#include <iostream>
+#include <dali/public-api/text-abstraction/font-client.h>
+#include <dali/public-api/text-abstraction/script.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+std::ostream& operator<< (std::ostream& o, const Vector<Character>& text)
+{
+ o << std::hex;
+
+ for( unsigned int i=0; i<text.Count(); ++i )
+ {
+ o << text[i];
+ if( i+1 < text.Count() )
+ {
+ o << " ";
+ }
+ }
+
+ return o << std::dec;
+}
+
+std::ostream& operator<< (std::ostream& o, const Vector<ScriptRun>& scriptRun)
+{
+ for( unsigned int i=0; i<scriptRun.Count(); ++i )
+ {
+ // e.g. Print "0->9: LATIN" for a ten character run staring from beginning of the model
+ o << scriptRun[i].characterRun.characterIndex << "->" << (scriptRun[i].characterRun.characterIndex + scriptRun[i].characterRun.numberOfCharacters ) << ": ";
+ o << TextAbstraction::ScriptName[scriptRun[i].script];
+
+ if( i+1 < scriptRun.Count() )
+ {
+ o << ", ";
+ }
+ }
+
+ return o << std::dec;
+}
+
+std::ostream& operator<< (std::ostream& o, const Vector<FontRun>& fontRun)
+{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ for( unsigned int i=0; i<fontRun.Count(); ++i )
+ {
+ // e.g. Print "0->9: ID:1 TizenSansKorean style:Regular size:10.0" for a ten character run staring from beginning of the model
+ o << fontRun[i].characterRun.characterIndex << "->" << (fontRun[i].characterRun.characterIndex + fontRun[i].characterRun.numberOfCharacters ) << ": ";
+
+ FontId id = fontRun[i].fontId;
+ TextAbstraction::FontDescription fontDescription;
+ fontClient.GetDescription( id, fontDescription );
+ o << "ID:" << id << ", " << fontDescription.family << " style:" << fontDescription.style << " size:" << (fontClient.GetPointSize(id) / 64);
+
+ if( i+1 < fontRun.Count() )
+ {
+ o << ", ";
+ }
+ }
+
+ return o << std::dec;
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TEXT_ABSTRACTION_TEXT_IO_H__
+#define __DALI_TEXT_ABSTRACTION_TEXT_IO_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 <iosfwd>
+#include <dali/public-api/common/dali-vector.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/font-run.h>
+#include <dali-toolkit/internal/text/script-run.h>
+#include <dali-toolkit/internal/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Print a vector of characters.
+ *
+ * @param [in] o The output stream operator.
+ * @param [in] text The text to print.
+ * @return The output stream operator.
+ */
+std::ostream& operator<< (std::ostream& o, const Vector<Character>& text);
+
+/**
+ * @brief Print a vector of script runs.
+ *
+ * @param [in] o The output stream operator.
+ * @param [in] scriptRuns The script runs to print.
+ * @return The output stream operator.
+ */
+std::ostream& operator<< (std::ostream& o, const Vector<ScriptRun>& scriptRuns);
+
+/**
+ * @brief Print a vector of font runs.
+ *
+ * @param [in] o The output stream operator.
+ * @param [in] fontRuns The font runs to print.
+ * @return The output stream operator.
+ */
+std::ostream& operator<< (std::ostream& o, const Vector<FontRun>& fontRuns);
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TEXT_ABSTRACTION_TEXT_IO_H__
--- /dev/null
+/*
+Copyright (c) 2000-2014 Samsung Electronics Co., Ltd All Rights Reserved
+
+This file is part of Dali Toolkit
+
+PROPRIETARY/CONFIDENTIAL
+
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
+disclose such Confidential Information and shall use it only in
+accordance with the terms of the license agreement you entered
+into with SAMSUNG ELECTRONICS.
+
+SAMSUNG make no representations or warranties about the suitability
+of the software, either express or implied, including but not limited
+to the implied warranties of merchantability, fitness for a particular
+purpose, or non-infringement. SAMSUNG shall not be liable for any
+damages suffered by licensee as a result of using, modifying or
+distributing this software or its derivatives.
+*/
+
+
+
+//******************************************************************************
+//
+// Default style theme for Tizen dark theme, The values should come from
+// UX design document.
+//
+//******************************************************************************
+
+{
+ "styles":
+ {
+ "textlabel":
+ {
+ "font-family":"SamsungSans",
+ "font-style":"Regular",
+ "point-size":12
+ },
+ "textfield":
+ {
+ "font-family":"SamsungSans",
+ "font-style":"Regular",
+ "point-size":12
+ },
+ "scrollview":
+ {
+ "overshoot-effect-color":"B018"
+ }
+ }
+}
--- /dev/null
+./tizen-dark-theme.json
\ No newline at end of file
{
"textlabel":
{
- "font-family":"TizenSansFallback",
+ "font-family":"UbuntuMono",
"font-style":"Regular",
- "point-size":10
+ "point-size":13
},
"textfield":
{
- "font-family":"TizenSansFallback",
+ "font-family":"DejaVuSans",
"font-style":"Regular",
"point-size":10
},
--- /dev/null
+Name: dali-toolkit
+Summary: The OpenGLES Canvas Core Library Toolkit
+Version: 1.0.33
+Release: 1
+Group: System/Libraries
+License: Apache-2.0
+URL: https://review.tizen.org/git/?p=platform/core/uifw/dali-toolkit.git;a=summary
+Source0: %{name}-%{version}.tar.gz
+
+%define dali_profile MOBILE
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+Requires: dali
+# Do NOT put an adaptor here - it is an application choice which adaptor to use
+BuildRequires: pkgconfig
+BuildRequires: pkgconfig(dlog)
+BuildRequires: boost-devel
+BuildRequires: pkgconfig(dali)
+BuildRequires: pkgconfig(dali-core)
+
+%description
+The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
+user interface functionality.
+
+##############################
+# devel
+##############################
+%package devel
+Summary: Application development package for the OpenGLES Canvas toolkit
+Group: Development/Building
+Requires: %{name} = %{version}-%{release}
+Requires: boost-devel
+
+%description devel
+Application development package for the OpenGLES Canvas toolkit - headers and package config
+
+##############################
+# Preparation
+##############################
+%prep
+%setup -q
+%define dali_data_rw_dir /opt/usr/share/dali/
+%define dali_data_ro_dir /usr/share/dali/
+%define dali_toolkit_image_files %{dali_data_ro_dir}/toolkit/images/
+%define dali_toolkit_sound_files %{dali_data_ro_dir}/toolkit/sounds/
+%define dali_toolkit_style_files %{dali_data_ro_dir}/toolkit/styles/
+%define dev_include_path %{_includedir}
+
+##############################
+# Build
+##############################
+%build
+PREFIX="/usr"
+CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
+LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
+
+libtoolize --force
+cd %{_builddir}/dali-toolkit-%{version}/build/tizen
+autoreconf --install
+DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
+DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
+%configure --enable-profile=%{dali_profile}
+make %{?jobs:-j%jobs}
+
+##############################
+# Installation
+##############################
+%install
+rm -rf %{buildroot}
+cd build/tizen
+%make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
+
+# LICENSE
+mkdir -p %{buildroot}/usr/share/license
+cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{name}
+
+##############################
+# Post Install
+##############################
+%post
+/sbin/ldconfig
+exit 0
+
+##############################
+# Post Uninstall
+##############################
+%postun
+/sbin/ldconfig
+exit 0
+
+##############################
+# Files in Binary Packages
+##############################
+%files
+%manifest dali-toolkit.manifest-smack
+%defattr(-,root,root,-)
+%{_libdir}/lib%{name}.so*
+%{dali_toolkit_image_files}/*
+%{dali_toolkit_sound_files}/*
+%{dali_toolkit_style_files}/*
+%{_datadir}/license/%{name}
+
+%files devel
+%defattr(-,root,root,-)
+%{dev_include_path}/%{name}/*
+%{_libdir}/pkgconfig/*.pc
+