}
/**
+ * @copydoc PlatformAbstraction::GetDefaultFontDescription()
+ */
+void TestPlatformAbstraction::GetDefaultFontDescription( std::string& family, std::string& style ) const
+{
+ // TODO
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetDefaultFontSize()
+ */
+int TestPlatformAbstraction::GetDefaultFontSize() const
+{
+ // TODO
+ return int();
+}
+
+/**
* @copydoc PlatformAbstraction::SetDpi()
*/
void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
virtual bool IsLoading();
/**
+ * @copydoc PlatformAbstraction::GetDefaultFontDescription()
+ */
+ virtual void GetDefaultFontDescription( std::string& family, std::string& style ) const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetDefaultFontSize()
+ */
+ virtual int GetDefaultFontSize() const;
+
+ /**
* @copydoc PlatformAbstraction::SetDpi()
*/
virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
NavigationControl naviControl = NavigationControl::New();
stage.Add( naviControl );
+ Toolkit::NaviTitleBarStyle titleBarStyle( background, 720, 111, 68, 48, 34, 16, 11, 45, 63, 26, 14, 22 );
+ naviControl.CreateNavigationTitleBar( titleBarStyle, titleBarStyle );
+
Page naviItem = Page::New();
PushButton firstControl = PushButton::New();
[enable_debug=$enableval],
[enable_debug=no])
-# option for JavaScript plugin
-AC_ARG_ENABLE(javascript,
+# option to build JavaScript plugin
+# configure settings and output
+# --enable-javascript // enable_javascript = yes
+# --enable-javascript=yes // enable_javascript = yes
+# --enable-javascript=no // enable_javascript = no
+# --disable-javascript // enable_javascript = no
+# no setting // enable_javascript = automatic ( enable if v8 present)
+AC_ARG_ENABLE([javascript],
[AC_HELP_STRING([--enable-javascript],
- [Enable JavaScript plugin])] ,
- [enable_javascript=yes],
- [enable_javascript=no])
+ [Enable JavaScript plugin])] ,
+ [enable_javascript=$enableval],
+ [enable_javascript=automatic])
+
if test "x$enable_debug" = "xyes"; then
DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED"
- DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED"
fi
if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then
DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
- DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
fi
-#set a variable for the makefile to conditionally compile the plugin
-AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$enable_javascript = xyes])
+
# Tizen Profile options
AM_CONDITIONAL([COMMON_PROFILE], [test x$enable_profile = xCOMMON])
AM_CONDITIONAL([MOBILE_PROFILE], [test x$enable_profile = xMOBILE])
+# v8 version 4+ requires c++11
+PKG_CHECK_MODULES(V8, v8 = 3.32.7, [ pkg_check_v8=yes ], [ pkg_check_v8=no ] )
+
+# Rules for building JavaScript plugin
+# If enable_javascript=yes and v8 installed = build javascript
+# If enable_javascript=automatic and v8 installed = build javascript
+# If enable_javascript=yes and v8 not installed = throw an error
+build_javascript_plugin=no
+if test x$enable_javascript = xyes; then
+ if test x$pkg_check_v8 = xno; then
+ [build_javascript_plugin=no]
+ AC_MSG_ERROR("V8 not found or incorrect version installed")
+ AC_MSG_NOTICE("To disable building of JavaScript plugin use --disable-javascript")
+ else
+ [build_javascript_plugin=yes]
+ AC_MSG_NOTICE(V8 library found. Building DALi JavaScript plugin)
+ fi
+fi
+if test x$enable_javascript = xautomatic && test x$pkg_check_v8 = xyes; then
+ [build_javascript_plugin=yes]
+ AC_MSG_NOTICE( V8 library found. Automatic building of JavaScript plugin. Use use --disable-javascript to disable)
+fi
+
+
+#set a variable for the makefile to force compile the JAvaSplugin
+AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$build_javascript_plugin = xyes])
+
AC_SUBST(dataReadWriteDir)
AC_SUBST(dataReadOnlyDir)
AC_SUBST(DALI_TOOLKIT_CFLAGS)
-AC_SUBST(DALI_SCRIPTV8_CFLAGS)
-AC_SUBST(DALI_SCRIPTV8_LIBS)
+
# Specify the include directory for development headers
#devincludepath=${includedir}/dali/internal
-------------
Prefix: $prefix
Debug Build: $enable_debug
- JavaScript support (V8 required) $enable_javascript
+ JavaScript support (V8 required) $build_javascript_plugin
Profile: $dali_profile
Data Dir (Read/Write): $dataReadWriteDir
Data Dir (Read Only): $dataReadOnlyDir
include ../../../plugins/dali-script-v8/file.list
-DALI_SCRIPTV8_LIBS="-lv8 -lpthread"
lib_LTLIBRARIES = libdali-script-plugin-v8.la
-DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
$(DALI_CFLAGS) \
$(DLOG_CFLAGS) \
- $(DALI_SCRIPTV8_CFLAGS) \
-I../../.. \
$(script_plugin_v8_includes) \
+ $(V8_CFLAGS) \
-Werror -Wall
libdali_script_plugin_v8_la_LIBADD = \
$(DALICORE_LIBS) \
$(DALI_LIBS) \
$(DLOG_LIBS) \
- $(DALI_SCRIPTV8_LIBS)
+ $(V8_LIBS)
libdali_script_plugin_v8_la_LDFLAGS = \
-rdynamic
#include <dali-toolkit/internal/text/bidirectional-support.h>
// EXTERNAL INCLUDES
+#include <memory.h>
#include <dali/public-api/text-abstraction/bidirectional-support.h>
namespace Dali
// Reorders the line.
bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex,
- line.characterRun.characterIndex,
+ line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex,
line.characterRun.numberOfCharacters,
lineInfoRun.visualToLogicalMap );
mirroredText.Count() );
}
+void GetCharactersDirection( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<CharacterDirection>& directions )
+{
+ // Handle to the bidirectional info module in text-abstraction.
+ TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get();
+
+ CharacterIndex index = 0u;
+ CharacterDirection* directionsBuffer = directions.Begin();
+ for( Vector<BidirectionalParagraphInfoRun>::ConstIterator it = bidirectionalInfo.Begin(),
+ endIt = bidirectionalInfo.End();
+ it != endIt;
+ ++it )
+ {
+ const BidirectionalParagraphInfoRun& paragraph = *it;
+
+ // Fills with left to right those paragraphs without right to left characters.
+ memset( directionsBuffer + index, false, ( paragraph.characterRun.characterIndex - index ) * sizeof( bool ) );
+ index += paragraph.characterRun.numberOfCharacters;
+
+ bidirectionalSupport.GetCharactersDirection( paragraph.bidirectionalInfoIndex,
+ directionsBuffer + paragraph.characterRun.characterIndex,
+ paragraph.characterRun.numberOfCharacters );
+ }
+
+ // Fills with left to right those paragraphs without right to left characters.
+ memset( directionsBuffer + index, false, ( directions.Count() - index ) * sizeof( bool ) );
+}
+
} // namespace Text
} // namespace Toolkit
Length numberOfCharactersToInsert );
/**
- * Sets the visual to logical and logical to visual map tables.
+ * Sets the visual to logical map tables.
*
* Any map tables previously set are removed.
*
*
* @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
* @param[in] lineRuns The line runs converted to characters.
- * @param[out] lineInfoRuns line runs with the visual to logical and logical to visual conversion maps.
+ * @param[out] lineInfoRuns line runs with the visual to logical conversion maps.
*/
void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
const Vector<LineRun>& lineRuns,
*/
bool GetMirroredText( const Vector<Character>& text,
Vector<Character>& mirroredText );
+
+/**
+ * @brief Retrieves the character's directions.
+ *
+ * @pre The @p logicalModel needs to have a text set.
+ * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
+ *
+ * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
+ * @param[out] directions The direction, @e false is left to right and @e true is right to left, of each character of the paragraph.
+ */
+void GetCharactersDirection( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<CharacterDirection>& directions );
+
} // namespace Text
} // namespace Toolkit
if( TextAbstraction::LINE_MUST_BREAK == lineBreakInfo )
{
- if( glyphIndex == lastGlyphIndex )
+ // Must break the line. Update the line layout and return.
+ lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
+ lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
+ lineLayout.length += tmpLineLayout.length;
+
+ if( 0.f < tmpLineLayout.length )
+ {
+ lineLayout.length += lineLayout.wsLengthEndOfLine;
+
+ lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
+ }
+ else
{
- // Must break the line. Update the line layout and return.
- lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
- lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
- lineLayout.length += tmpLineLayout.length;
-
- if( 0.f < tmpLineLayout.length )
- {
- lineLayout.length += lineLayout.wsLengthEndOfLine;
-
- lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
- }
- else
- {
- lineLayout.wsLengthEndOfLine += tmpLineLayout.wsLengthEndOfLine;
- }
-
- if( tmpLineLayout.height > lineLayout.height )
- {
- lineLayout.height = tmpLineLayout.height;
- }
-
- if( tmpLineLayout.ascender > lineLayout.ascender )
- {
- lineLayout.ascender = tmpLineLayout.ascender;
- }
+ lineLayout.wsLengthEndOfLine += tmpLineLayout.wsLengthEndOfLine;
+ }
+
+ if( tmpLineLayout.height > lineLayout.height )
+ {
+ lineLayout.height = tmpLineLayout.height;
+ }
+
+ if( tmpLineLayout.ascender > lineLayout.ascender )
+ {
+ lineLayout.ascender = tmpLineLayout.ascender;
}
tmpLineLayout.numberOfCharacters = 0u;
{
}
+void LogicalModel::SetCharacterDirections( const CharacterDirection* const directions,
+ Length numberOfCharacters )
+{
+ if( 0u == numberOfCharacters )
+ {
+ mCharacterDirections.Clear();
+ }
+ else
+ {
+ mCharacterDirections.Resize( numberOfCharacters );
+ memcpy( mCharacterDirections.Begin(), directions, numberOfCharacters * sizeof( CharacterDirection ) );
+ }
+}
+
void LogicalModel::GetCharacterDirections( CharacterDirection* directions,
CharacterIndex characterIndex,
Length numberOfCharacters ) const
{
+ if( 0u == mCharacterDirections.Count() )
+ {
+ // Nothing to retrieve if the model has no right to left characters.
+ return;
+ }
+
+ memcpy( directions, mCharacterDirections.Begin() + characterIndex, numberOfCharacters * sizeof( CharacterDirection ) );
}
CharacterDirection LogicalModel::GetCharacterDirection( CharacterIndex characterIndex ) const
{
- return false;
+ if( characterIndex >= mCharacterDirections.Count() )
+ {
+ // The model has no right to left characters, so the vector of directions is void.
+ return false;
+ }
+
+ return *( mCharacterDirections.Begin() + characterIndex );
}
void LogicalModel::SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo,
Length numberOfCharacters ) const;
/**
- * Retrieves a character.
+ * @brief Retrieves a character.
*
* @param[in] characterIndex Index to a character.
*
Character GetCharacter( CharacterIndex characterIndex ) const;
/**
- * Replaces characters from the text.
+ * @brief Replaces characters from the text.
*
* If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
* If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
// Language support interface.
/**
- * Sets the script runs.
+ * @brief Sets the script runs.
*
* Replaces any scripts previously set.
*
Length numberOfRuns );
/**
- * Retrieves the number of script runs and the index to the first one for the given range of characters.
+ * @brief Retrieves the number of script runs and the index to the first one for the given range of characters.
*
* A run is a group of consecutive characters. A script run contains the script for a run.
*
Length& numberOfScriptRuns ) const;
/**
- * Retrieves the script runs for the given range of characters.
+ * @brief 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.
Length numberOfCharacters ) const;
/**
- * Retrieves the script for the given character index.
+ * @brief Retrieves the script for the given character index.
*
* @param[in] characterIndex Index to the character.
*
Script GetScript( CharacterIndex characterIndex ) const;
/**
- * Replaces script runs for the given range of characters.
+ * @brief Replaces script runs for the given range of characters.
*
* If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
* If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
Length numberOfCharactersToInsert );
/**
- * Sets the font runs.
+ * @brief Sets the font runs.
*
* Replaces any fonts previously set.
*
Length numberOfRuns );
/**
- * Retrieves the number of font runs and the index of the first one for the given range of characters.
+ * @brief Retrieves the number of font runs and the index of the first one for the given range of characters.
*
* A run is a group of consecutive characters. A font run contains the font id for a run.
*
Length& numberOfFontRuns ) const;
/**
- * Retrieves the font runs for the given range of characters.
+ * @brief 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.
Length numberOfCharacters ) const;
/**
- * Retrieves the font id for the given character index.
+ * @brief Retrieves the font id for the given character index.
*
* @param[in] characterIndex Index to the first character.
*
FontId GetFont( CharacterIndex characterIndex ) const;
/**
- * Replaces font runs for the given range of characters.
+ * @brief Replaces font runs for the given range of characters.
*
* If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
* If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
// Break info interface.
/**
- * Sets the line break info.
+ * @brief Sets the line break info.
*
* See GetLineBreakInfo() to get how the line break info is encoded.
*
Length length );
/**
- * Retrieves the line break info in the given buffer.
+ * @brief 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.
*
Length numberOfItems ) const;
/**
- * Retrieves the line break info for the given item index.
+ * @brief 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;
/**
- * Replaces line break info.
+ * @brief Replaces line break info.
*
* See GetLineBreakInfo() to get how the line break info is encoded.
*
Length numberOfItemsToInsert );
/**
- * Sets the word break info.
+ * @brief Sets the word break info.
*
* See GetWordBreakInfo() to get how the word break info is encoded.
*
Length length );
/**
- * Retrieves the word break info in the given buffer.
+ * @brief 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.
*
Length numberOfItems ) const;
/**
- * Retrieves the word break info for the given item index.
+ * @brief 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;
/**
- * Replaces word break info.
+ * @brief Replaces word break info.
*
* See GetWordBreakInfo() to get how the word break info is encoded.
*
// Bidirectional support interface.
/**
- * Sets the bidirectional info runs.
+ * @brief Sets the bidirectional info runs.
*
* Replaces any bidirectional info previously set.
*
Length numberOfRuns );
/**
- * Retrieves the number of bidirectional info runs and the index to the first one for the given range of characters.
+ * @brief Retrieves the number of bidirectional info runs and the index to the first one for the given range of characters.
*
* It may be zero if there is no right to left scripts.
*
Length& numberOfFontRuns ) const;
/**
- * Retrieves the bidirectional paragraph info runs for the given range of characters.
+ * @brief Retrieves the bidirectional paragraph info runs for the given range of characters.
*
* The @p bidirectionalInfo buffer needs to be big enough to copy the number of bidirectional
* paragraph info runs.
Length numberOfCharacters ) const;
/**
- * Replaces bidirectional info runs for the given range of characters.
+ * @brief Replaces bidirectional info runs for the given range of characters.
*
* If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
* If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
Length numberOfCharactersToInsert );
/**
- * Retrieves the direction of the characters.
+ * @brief Replaces the direction of the characters.
*
- * It sets @c true for right to left characters and @c false for left to right.
+ * @note If the number of characters is zero the directions buffer is cleared.
+ *
+ * @param[in] directions The directions of the characters.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void SetCharacterDirections( const CharacterDirection* const directions,
+ Length numberOfCharacters );
+
+ /**
+ * @brief Retrieves the direction of the characters.
+ *
+ * It sets @e true for right to left characters and @e 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.
*
+ * @pre the @p directions vector should be initialized to @e false (left to right) as this method is not going
+ * to update it if there is no right to left characters.
+ *
* @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.
Length numberOfCharacters ) const;
/**
- * Retrieves the direction of a characters.
+ * @brief Retrieves the direction of a characters.
*
* See GetCharacterDirections().
*
// Visual <--> Logical conversion tables.
/**
- * Sets the visual to logical and the logical to visual map tables.
+ * @brief Sets the visual to logical and the logical to visual map tables.
*
* Replaces any map tables previously set.
*
Length numberOfRuns );
/**
- * Replaces the visual to logical and logical to visual map tables for the given range of characters.
+ * @brief Replaces the visual to logical and logical to visual map tables for the given range of characters.
*
* If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
* If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
Length numberOfCharactersToInsert );
/**
- * Retrieves the visual character index for the given logical character index.
+ * @brief Retrieves the visual character index for the given logical character index.
*
* @param[in] logicalCharacterIndex The logical character index.
*
CharacterIndex GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const;
/**
- * Retrieves the logical character index for the given visual character index.
+ * @brief Retrieves the logical character index for the given visual character index.
*
* @param[in] visualCharacterIndex The visual character index.
*
CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const;
/**
- * Retrieves the whole or part of the logical to visual conversion map.
+ * @brief 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.
*
Length numberOfCharacters ) const;
/**
- * Retrieves the whole or part of the visual to logical conversion map.
+ * @brief 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.
*
Vector<LineBreakInfo> mLineBreakInfo;
Vector<WordBreakInfo> mWordBreakInfo;
Vector<BidirectionalParagraphInfoRun> mBidirectionalParagraphInfo;
-
+ Vector<CharacterDirection> mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ).
Vector<BidirectionalLineInfoRun> mBidirectionalLineInfo;
- Vector<CharacterIndex> mLogicalToVisualMap; ///< Bidirectional logical to visual conversion table.
- Vector<CharacterIndex> mVisualToLogicalMap; ///< Bidirectional visual to logical conversion table.
+ Vector<CharacterIndex> mLogicalToVisualMap; ///< Bidirectional logical to visual conversion table.
+ Vector<CharacterIndex> mVisualToLogicalMap; ///< Bidirectional visual to logical conversion table.
};
} // namespace Text
}
}
- // Check if the current index is a white space. Do not want to shape a \n.
+ // Check if the current index is a new paragraph character.
+ // A \n is going to be shaped in order to not to mess the conversion tables.
+ // After the \n character is shaped, the glyph is going to be reset to its
+ // default in order to not to get any metric or font index for it.
+ const bool isNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + currentIndex ) );
+
// The last character is always a must-break even if it's not a \n.
Length numberOfCharactersToShape = currentIndex - previousIndex;
- if( mustBreak && !TextAbstraction::IsWhiteSpace( *( textBuffer + currentIndex ) ) )
+ if( mustBreak )
{
+ // Add one more character to shape.
++numberOfCharactersToShape;
}
shaping.GetGlyphs( glyphsBuffer + glyphIndex,
glyphToCharacterMapBuffer + glyphIndex );
+ if( isNewParagraph )
+ {
+ // TODO : This is a work around to avoid drawing a square in the
+ // place of a new line character.
+
+ // If the last character is a \n, it resets the glyph to the default
+ // to avoid getting any metric for it.
+ GlyphInfo& glyph = *( glyphsBuffer + glyphIndex + ( numberOfGlyphs - 1u ) );
+
+ glyph = GlyphInfo();
+ }
+
// Update indices.
if( 0u != glyphIndex )
{
mImpl->mLogicalModel->mLineBreakInfo.Clear();
mImpl->mLogicalModel->mWordBreakInfo.Clear();
mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
+ mImpl->mLogicalModel->mCharacterDirections.Clear();
mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
mImpl->mLogicalModel->mLineBreakInfo.Clear();
mImpl->mLogicalModel->mWordBreakInfo.Clear();
mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
+ mImpl->mLogicalModel->mCharacterDirections.Clear();
mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
mImpl->mLogicalModel->mLineBreakInfo.Clear();
mImpl->mLogicalModel->mWordBreakInfo.Clear();
mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
+ mImpl->mLogicalModel->mCharacterDirections.Clear();
mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
// TODO: consider if the mirrored string can be stored as well.
textMirrored = GetMirroredText( utf32Characters, mirroredUtf32Characters );
+
+ // Only set the character directions if there is right to left characters.
+ Vector<CharacterDirection>& directions = mImpl->mLogicalModel->mCharacterDirections;
+ directions.Resize( numberOfCharacters );
+
+ GetCharactersDirection( bidirectionalInfo,
+ directions );
}
- }
+ else
+ {
+ // There is no right to left characters. Clear the directions vector.
+ mImpl->mLogicalModel->mCharacterDirections.Clear();
+ }
+
+ }
Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
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 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 TextAbstraction::CharacterDirection CharacterDirection; ///< The character's direction: @e false is left to right, @e true is right to left.
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.
typedef uint32_t ScriptRunIndex; ///< An index into an array of script runs.
typedef uint32_t FontRunIndex; ///< An index into an array of font runs.
typedef uint32_t BidirectionalRunIndex; ///< An index into an array of font runs.
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 33;
+const unsigned int TOOLKIT_MICRO_VERSION = 34;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
{
"textlabel":
{
- "font-family":"UbuntuMono",
+ "font-family":"HelveticaNeue",
"font-style":"Regular",
- "point-size":13
+ "point-size":18
},
"textfield":
{
- "font-family":"UbuntuMono",
+ "font-family":"HelveticaNeue",
"font-style":"Regular",
- "point-size":13
+ "point-size":18
},
"scrollview":
{
* - \link hello-world Hello World - explained \endlink
*
* \section Actors Actors
- * - \link image-text-mesh-actor Image, Text and Mesh actors \endlink
+ * - \link image-mesh-actor Image and Mesh actors \endlink
* - \link event-system Event Handling \endlink
* - \link custom-actor Custom Actor \endlink
*
* - \link constraints-intro Introduction to Constraints \endlink
*
* \section UIControls UI Controls
+ * - \link text-label Text Label \endlink
* - \link item-view Item View \endlink
- * - \link text-view Text View \endlink
- * - \link text-input Text Input \endlink
* - \link scroll-view Scroll View \endlink
- * - \link markup-processor Markup Processor \endlink
* - \link size-negotiation Size Negotiation \endlink
* - \link type-registration Type Registration \endlink
* - \link properties Properties \endlink
</td>
</table>
-This can be used for ALL existing controls like TextView as well:
+This can be used for ALL existing controls like TextLabel as well:
@code
-Dali::Toolkit::TextView textView = Dali::Toolkit::TextView::New( "Hello World" );
-textView.SetBackgroundColor( Dali::Color::RED );
+Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( "Hello World" );
+label.SetBackgroundColor( Dali::Color::RED );
@endcode
<table border=0 cellpadding=10><tr>
<td>
-\image html BackgroundTextView.png
+\image html BackgroundTextLabel.png
</td>
</table>
-/*! \page image-text-mesh-actor Image, Text and Mesh actors
+/*! \page image-mesh-actor Image and Mesh actors
*
*
* <h1 class="pg">Overview</h1>
- * The Dali::ImageActor, Dali::TextActor, Dali::MeshActor are inherited from Dali::Actor and provide means to display resources like Images, Text and Geometries (Triangle meshes) on the stage.
+ * The Dali::ImageActor & Dali::MeshActor are inherited from Dali::Actor and provide means to display resources like Images and Geometries (Triangle meshes) on the stage.
* All the Dali::Actor methods can be called on them.<br>
*
* - <b>ImageActor:</b> An actor for displaying Images. It allows the developer to display a Dali::Image object on the stage.<br>
- * - <b>TextActor:</b> An actor for displaying text.<br>
* - <b>MeshActor:</b> An actor for displaying one or more mesh geometries. It may have children, which may be plain actors or other mesh actors.<br>
*
* <h1 class="pg">Image Actor</h1>
* @endcode
*
*
- *
- *
- *
- * <h1 class="pg">Text Actor</h1>
- *
- *
- * <h2 class="pg">Displaying Text</h2>
- * The text displayed by the text actor is initialised/set on construction, which can be changed later.
- *
- * @code
- * Dali::TextActor myTextActor = Dali::TextActor::New("Hi");
- * std::string str("Hello");
- * if (myTextActor.GetText() != str)
- * {
- * myTextActor.SetText(str);
- * }
- * @endcode
- *
- *
- * <h2 class="pg">Fonts</h2>
- * It's possible to specify a font for the text displayed by the text actor.
- * @code
- * Dali::Font freeSerif = Dali::Font::New("FreeSerif", 8);
- * myTextActor.SetFont(freeSerif);
- * @endcode
- *
- *
- * <h2 class="pg">Ellipsis</h2>
- * It is possible to display an ellipsis in the TextActor when the text is truncated.
- * @code
- * std::string str("...");
- * if (myTextActor.GetEllipsis() != str)
- * {
- * myTextActor.SetEllipsis(str);
- * }
- * @endcode
- *
- * <h2 class="pg">Style</h2>
- *
- * By calling the Dali::TextActor::SetTextStyle or by passing a Dali::TextStyle to the constructor, it's possible to define styling parameters such as color, font, size, outline, glow, shadow, italics or bold.
- * @code
- * TextStyle style;
- * style.SetItalic( true );
- *
- * myTextActor.SetTextStyle( style );
- * @endcode
- *
- * @see Dali::TextActor::SetTextStyle()
- *
- * It is possible to specify the text fit style for the text actor. The developer can specify whether the ellipsis should appear on the left, centre, or at the end
- * @code
- * // default : NONE
- * myTextActor.SetTextFitStyle(TextUtilities::EllipsizeRight);
- * @endcode
- *
- * <h2 class="pg">Loading state</h2>
- * It is possible to get the font loading status for the text and do processing accordingly.
- * @code
- * // observe text loading and do some processing when it's done
- * if( Dali::ResourceLoadingSucceeded == myTextActor.GetLoadingState() )
- * {
- * // text already loaded, Do the processing here
- * OnTextFontLoaded();
- * }
- * else
- * {
- * // text not yet loaded, Connect to the SignalTextAvailable signal and Do the processing when it occurs
- * myTextActor.SignalTextAvailable().Connect(this, &MyClass::OnTextFontLoaded);
- * }
- * @endcode
- *
- *
- *
- *
* <h1 class="pg">Mesh Actor</h1>
*
* <h2 class="pg">Construction</h2>
+++ /dev/null
-/*! \page markup-processor Markup processor
- *
- * <h1 class="pg">Overview</h1>
- *
- * Dali::Toolkit::MarkupProcessor functions provide mechanisms to build and modify a Dali::Toolkit::MarkupProcessor::StyledTextArray used to store text with style.
- *
- * <h1 class="pg">Build a styled text array from a markup string</h1>
- *
- * Dali::Toolkit::MarkupProcessor::GetStyledTextArray() could be used to convert an html-ish markup string into a styled text array. This string uses html-ish tags to
- * define the text's style as follows:
- *
- * <ul>
- * <li>\e \<b\>\</b\> Bold text.
- * i.e. \<b\>Bold text\</b\>"
- * \image html text-view/Bold.png
- *
- * <li>\e \<i\>\</i\> Italic text.
- * i.e. \<i\>Italic text\</i\>"
- * \image html text-view/Italic.png
- *
- * <li>\e \<u\>\</u\> Underlined text.
- * i.e. \<u\>Underline text\</u\>"
- * \image html text-view/Underline.png
- *
- * <li>\e \<br /\> New line.
- *
- * <li>\e \<font\>\</font\> Specifies font properties:
- * <ul>
- * <li> \e face The name of a font or font family.
- * <li> \e style The style of a font.
- * <li> \e size Font point size. @see Dali::PointSize.
- * <li> \e color Font color. See the \ref color section for more details.
- * </ul>
- *
- * i.e. \<font face='FreeSerif' style='Regular'\>FreeSerif font\</font\>
- * \image html text-view/FreeSerifFont.png
- *
- * <li>\e \<shadow\>\</shadow\> Specifies shadow properties.
- * <ul>
- * <li> \e paramx X offset.
- * <li> \e paramy Y offset.
- * <li> \e color Shadow color. See the \ref color section for more details.
- * </ul>
- *
- * i.e. \<shadow color='black' paramx='1.5' paramy='1.5'\>Black shadow\</shadow\>
- * \image html text-view/Black-Shadow.png
- *
- * @see Dali::TextActor::SetShadow()
- * <br><br>
- * <li>\e \<glow\>\</glow\> Specifies glow properties.
- * <ul>
- * <li> \e param Glow around the text.
- * <li> \e color Glow color. See the \ref color section for more details.
- * </ul>
- *
- * i.e. \<smooth param='0.65'\>\<glow color='blue' param='0.05'\>Blue glow\</glow\>\</smooth\>
- * \image html text-view/Blue-Glow.png
- *
- * @see Dali::TextActor::SetGlow()
- * <br><br>
- * <li>\e \<outline\>\</outline\> Specifies outline properties.
- * <ul>
- * <li> \e paramx X thickness.
- * <li> \e paramy Y thickness.
- * <li> \e color Outline color. See the \ref color section for more details.
- * </ul>
- *
- * i.e. \<outline color='red' paramx='0.5' paramy='0.5'\>Red outline\</outline\>
- * \image html text-view/Red-Outline.png
- *
- * @see Dali::TextActor::SetOutline()
- * <br><br>
- * <li>\e \<smooth\>\</smooth\> Specify the smooth edge.
- * <ul>
- * <li> \e param Distance field.
- * </ul>
- *
- * i.e. \<smooth param='0.3'\>Smooth text\</smooth\>
- * \image html text-view/Smooth-Text.png
- *
- * @see Dali::TextActor::SetSmoothEdge()
- * </ul>
- *
- * See also \ref color, \ref special_characters and \ref example for more details.
- *
- * <h1 class="pg">Get a markup string from a styled text array</h1>
- *
- * Dali::Toolkit::MarkupProcessor::GetMarkupString() could be used to convert a styled text array into an html-ish markup string.
- *
- * <h1 class="pg">Modify a styled text array</h1>
- *
- * Different functions are provided to modify whole or part of a styled text array with a given style. A mask could be used to modify only some properties of the style.
- *
- * @see Dali::Toolkit::MarkupProcessor::SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask )
- * @see Dali::Toolkit::MarkupProcessor::SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask )
- * @see Dali::Toolkit::MarkupProcessor::SetTextStyleToRange( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask, std::size_t begin, std::size_t end )
- *
- * <h1 class="pg">Appendix</h1>
- * \section color Color
- *
- * Different options could be used to define a color:
- *
- * <ul>
- * <li> Hexadecimal with alpha channel. 0xAARRGGBB with the alpha channel in the most significant bits.
- * <li> Hexadecimal without alpha channel. 0xRRGGBB.
- * <li> Web color format (six or three digits). \#RRGGBB, \#RGB
- * <li> Some colors could be defined with natural language: <em>black, white, red, green, blue, yellow, magenta, cyan</em> and \e transparent.
- * </ul>
- *
- * \section special_characters Special characters
- *
- * \< and \> characters are used to build the html-ish tags. To type them is needed to add a back slash character in front of them.
- * @note in c and c++ the back slash is represented with a double back slash '\\\\'.
- *
- * i.e. text.SetText("a \\< b \\< c");
- * \image html text-view/AlessBlessC.png
- *
- * It transform any pair CR+LF new line characters into a single LF new line character.
- *
- * \section fonts Font Style, Weight and Smooth
- *
- * This appendix shows the differences and relations between the font style, the font weight, the smoothness and the italics.
- *
- * When a font is loaded, Dali uses different mechanisms to modify the render of glyphs.<br><br>
- * i.e \<font face='Samsung Sans' size='24'\>Hello World\</font\> produces the "Hello World" bellow.
- * \image html text-view/FontAppendix01.png
- * By adding the \<i\> \<b\> \<smooth\> tags to the markup string or using the Dali::TextStyle::SetItalics(), Dali::TextStyle::SetWeight() or Dali::TextStyle::SetSmoothEdge() methods,
- * Dali modifies how glyphs of the same font are rendered.<br><br>
- * i.e \<i\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</i\>
- * \image html text-view/FontAppendix02.png
- * i.e \<b\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</b\>
- * \image html text-view/FontAppendix03.png
- *
- * The smooth parameter can be used to adjust the thickness of the rendered glyphs.<br><br>
- * i.e<br> \<smooth param=0.65\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</smooth\>\<br /\><br>
- * \<font face='Samsung Sans' size='24'\>Hello World\</font\>\<br /\><br>
- * \<smooth param=0.4\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</smooth\>\<br /\><br>
- * \<b\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</b\>\<br /\><br>
- * \<smooth param=0.2\>\<font face='Samsung Sans' size='24'\>Hello World\</font\>\</smooth\>
- *
- * \image html text-view/FontAppendix04.png
- *
- * All "Hello World" above have been rendered using the same font, saving some memory. Alternatively, the platform can provide fonts with different styles.<br>
- *
- * i.e. Samsung platform provides among others:<br>
- * Samsung Sans:style=Light<br>
- * Samsung Sans:style=Regular<br>
- * Samsung Sans:style=Medium<br>
- *
- * \<font face='Samsung Sans' style='Light' size='24'\>Hello World\</font\>\<br /\><br>
- * \<font face='Samsung Sans' style='Regular' size='24'\>Hello World\</font\>\<br /\><br>
- * \<font face='Samsung Sans' style='Medium' size='24'\>Hello World\</font\>
- * \image html text-view/FontAppendix05.png
- *
- * The three "Hello World" above have been rendered with three different fonts.<br>
- *
- * The <i>fc-list</i> command can be executed on the platform command line to check with fonts and which styles are supported.
- *
- * \section example Example
- *
- * \code
- * const std::string text( "<font size='16' color='black'>"
- * "<i>Italics: 기울임 꼴</i><br/>"
- * "<u>Underline: 밑줄</u><br/>"
- * "<b>Bold: 두꺼운</b><br/>"
- * "<font face='FreeSerif'>Font FreeSerif</font><br/>"
- * "<font color='white'><shadow color='black' paramx='1.5' paramy='1.5'>Shadow: 그림자</shadow></font><br/>"
- * "<font color='white'><smooth param='0.75'><glow color='blue' param='0.1'>Glow: 빛나다</glow></smooth></font><br/>"
- * "<font color='white'><outline color='red' paramx='0.5' paramy='0.5'>Outline: 윤곽선</outline></font><br/>"
- * "<smooth param='0.3'>Smooth: 부드럽게</smooth><br/>"
- * "</font>" );
- *
- * Toolkit::MarkupProcessor::StyledTextArray styledText;
- * Toolkit::MarkupProcessor::GetStyledTextArray( text, styledText, true );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New( styledText );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- *
- * \image html text-view/text-view.png
- * Text generated with the example above.
- */
+++ /dev/null
-/*! \page text-input Text Input
- *
- TextInput is a Dali::Actor which allows the input of text from an on-screen virtual keyboard or attached hardware keyboard.
-
-
-<h2 class="pg">Basic Text Input Set-up</h2>
-
- The below code creates a new TextInput
-
- @code
- Dali::Toolkit::TextInput myTextInput;
- myTextInput = Dali::Toolkit::TextInput::New();
- @endcode
-
- The following code sets the size and adds it to the stage
- @code
- myTextInput.SetParentOrigin(ParentOrigin::CENTER);
- myTextInput.SetSize(stageWidth*0.25f, stageWidth*0.5f);
- Stage::GetCurrent().Add(myTextInput);
- @endcode
-
- For a TextInput to receive input from the keyboard it must be in edit mode.
-
- To enter edit mode the below call can be made. If the virtual on-screen keyboard is supported then it will be displayed.
- Internally TextInput will set focus to this TextInput and key events will be sent to it.
-
- @code myTextInput.SetEditable(true);@endcode
-
- After this call the TextInput will receive any key press. If you have more than one TextInput the focus will change between them when the edit mode is
- initiated on any Text Input.
-
- To automatically start edit mode when the TextInput is "tapped" you can call the following:
-
- @code myTextInput.SetEditOnTouch()@endcode
-
- You will then need to end edit mode by making the call below or swiping away the keyboard (Virtual On-screen Keyboard)
- @code myTextInput.SetEditable(false);@endcode
-
- The call will hide the virtual keyboard if previously shown by Text Input.
-
- Then the input string as plain text can be retrieved using
- @code Dali::Toolkit::TextInput::GetText()@endcode
-
-<h2 class="pg"> Text Selection </h2>
-
- The SetTextSelectable API when set to true enables text to be highlighted, once highlighted the text style can be changed,
- the text can be cut, or copied, overwritten with new text or deleted.
-
- The user does a Long-Press on the text to get the option of text selection.
-
- @code Dali::Toolkit::TextInput::SetTextSelectable( true ) @endcode
-
-<h2 class="pg"> Text Styling </h2>
-
- In conjunction with TextView and the Markup processor, TextInput enables text to be styled.
-
- There are 3 ways to effect the text styling.
-
- SetActiveStyle, new input text is set to the Red glow style
- @code
- TextStyle style;
- style.SetGlow ( true, Dali::Color::RED );
- myTextInput.SetActiveStyle( style, MarkupProcessor::GLOW );
- @endcode
-
- ApplyStyle, selected/highlighted text now has the Red glow style
- @code
- TextStyle style;
- style.SetGlow ( true, Dali::Color::RED );
- myTextInput.ApplyStyle( style, MarkupProcessor::GLOW );
- @endcode
-
- ApplyStyleToAll, all text now has the Red glow style
- @code
- TextStyle style;
- style.SetGlow ( true, Dali::Color::RED );
- myTextInput.ApplyStyleToAll( style, MarkupProcessor::GLOW );
- @endcode
-
- Then the input string with Mark-up defining the style can be retrieved using
- @code Dali::Toolkit::TextInput::GetMarkupText()@endcode
- This would be usefull if you wish to save the styled text the user has input so it can be re-displayed another time.
-
- Signals are emitted when style changes.
-
- See Dali::Toolkit::TextInput::StyleMask for available styling options.
-
-
-
-
- */
-
--- /dev/null
+/*! \page text-label Text Label
+ *
+\section overview Overview
+The Dali::Toolkit::TextLabel is a Dali::Toolkit::Control which renders a short text string.\n
+Text labels are lightweight, non-editable and do not respond to user input.
+
+\subsection basictextlabelusage Basic usage
+
+To display a TextLabel the TEXT property must be set using a UTF-8 string.
+
+\code
+TextLabel label = TextLabel::New();
+label.SetProperty( TextLabel::Property::TEXT, "Hello World" );
+Stage::GetCurrent().Add( label );
+\endcode
+
+The label must also be added to the stage, or to an actor which is on the stage.\n
+In this example the text-label will be automatically given a natural size i.e. large enough to fit the text.\n
+The position of the label on-screen is dependent on the parent-origin and anchor-point properties:
+
+<table border=0 cellpadding=10>
+<tr>
+ <td>
+ \image html TextLabelTopLeft.png
+ </td>
+ <td>
+ \image html TextLabelCenter.png
+ </td>
+</tr>
+<tr>
+ <td>
+ (ParentOrigin::TOP_LEFT, AnchorPoint::TOP_LEFT)
+ </td>
+ <td>
+ (ParentOrigin::CENTER, AnchorPoint::CENTER)
+ </td>
+</tr>
+</table>
+
+\subsection fontselection Font Selection
+
+By default TextLabel will automatically select a suitable font from the platform.\n
+Typically fonts do not support all scripts, for example Latin fonts often do not provide Arabic glyphs.\n
+Therefore you should expect TextLabel to select different fonts for each script.
+
+Alternatively a font may be requested using eiter or all of FONT_FAMILY, FONT_STYLE, and POINT_SIZE properties:
+\code
+label.SetProperty( TextLabel::Property::FONT_FAMILY, "HelveticaNue" );
+label.SetProperty( TextLabel::Property::FONT_STYLE, "Regular" );
+label.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
+\endcode
+However the TextLabel will fall-back to using the default font, if the requested font does not support the required scripts.
+
+\subsection fontselection Text Alignment
+
+Wrapping can be enabled using the MULTI_LINE property:\n
+\code
+label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+\endcode
+
+The text can be either aligned to the start, end, or center of the available area:
+\code
+label.SetProperty( TextLabel::Property::ALIGNMENT, "BEGIN" ); // "CENTER" or "END"
+\endcode
+
+<table border=0 cellpadding=10>
+<tr>
+ <td>
+ Here is the "BEGIN" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
+ </td>
+</tr>
+<tr>
+ <td>
+ \image html LatinBegin.png
+ </td>
+ <td>
+ \image html ArabicBegin.png
+ </td>
+</tr>
+<tr>
+ <td>
+ Here is the "CENTER" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
+ </td>
+</tr>
+<tr>
+ <td>
+ \image html LatinCenter.png
+ </td>
+ <td>
+ \image html ArabicCenter.png
+ </td>
+</tr>
+<tr>
+ <td>
+ Here is the "END" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
+ </td>
+</tr>
+<tr>
+ <td>
+ \image html LatinEnd.png
+ </td>
+ <td>
+ \image html ArabicEnd.png
+ </td>
+</tr>
+</table>
+
+*/
+++ /dev/null
-/*! \page text-view Text View
- *
- * \section overview Overview
- *
- * The Dali::Toolkit::TextView class is a UI Dali::Toolkit::Control designed to extend the capabilities of the basic Dali::TextActor.
- * It provides support for multi-line wrapping, multi-language font detection, text alignment, scrolling and styling.
- *
- * Dali::Toolkit::TextView also provides text layout information which could be used in other UI Dali::Toolkit::Control classes or other applications.
- *
- * \section multiline Multi-line wrapping
- *
- * Different multi-line and exceed policies could be set to layout the given text.
- *
- * Both multi-line and exceed policies work together.
- * Dali::Toolkit::TextView::MultilinePolicy policies define how to wrap a line if it doesn't fit inside the boundary's width
- * whereas Dali::Toolkit::TextView::ExceedPolicy policies define what to do if the wrapped text is bigger than the text view's boundary.
- *
- * i.e. \e SplitByWord could be used as 'multi-line policy' to wrap a line if it's too long. If one of the words is longer than the text-view's width, \e Split could be
- * used as 'width exceed policy' to split a word in different lines. If the text is too long and exceeds the text-view's height, \e EllipsizedEnd could be
- * used as 'height exceed policy' to render only the text which fits inside the boundaries of the text-view.
- *
- * @see more \ref examples.
- *
- * \subsection multiline_policies Multi-line policies
- *
- * <ul>
- * <li><em>Split by new line character</em>.
- * Text will be wrapped when an <em>end of line \\n</em> or <em>\<br /\></em> is found.
- *
- * <li><em>Split by word</em>.
- * Text will be wrapped when an <em>end of line \\n</em> or <em>\<br /\></em> is found or if the text doesn't fit in the text view width.
- * In that case, some words will be moved to a new line.
- *
- * <li><em>Split by character</em>.
- * Text will be wrapped when an <em>end of line \\n</em> or <em>\<br /\></em> is found or if the text doesn't fit in the text view width.
- * In that case, words which don't fit will be wrapped in two and the remaining text moved to a new line.
- * </ul>
- * Dali::Toolkit::TextView::SplitByNewLineChar is set by default.
- *
- * \subsection exceed_policies Exceed policies
- *
- * <ul>
- * <li><em>Original size</em>.
- * Text will be displayed with its original size.
- *
- * <li><em>Fade</em>.
- * Text will be faded out.
- *
- * <li><em>Split</em>.
- * Text will be wrapped and moved to a new line.
- *
- * <li><em>Shrink to fit</em>.
- * Text will be shrunk to fit in the text view's boundary.
- *
- * <li><em>Ellipsize at the end</em>.
- * Text will be truncated to fit in the text view's boundary and the ellipsize text will be added. ( '...' by default).
- * </ul>
- * Dali::Toolkit::TextView::Original is set by default.
- *
- * @see Dali::Toolkit::TextView::SetMultilinePolicy
- * @see Dali::Toolkit::TextView::SetWidthExceedPolicy
- * @see Dali::Toolkit::TextView::SetHeightExceedPolicy
- * @see Dali::Toolkit::TextView::SetFadeBoundary
- * @see Dali::Toolkit::TextView::SetEllipsizeText
- *
- * @note Multiple combinations are possible but not all of them are already implemented.
- * @see \ref exceed_policies_combinations table to check which combinations are implemented
- *
- * \section scroll Scroll
- *
- * Text could be scrolled if it exceeds the boundaries of the text-view.
- *
- * @see Dali::Toolkit::TextView::SetScrollEnabled
- * @see Dali::Toolkit::TextView::SetScrollPosition
- *
- * \section line_height_spacing Line height spacing
- *
- * The default space between lines could be modified by setting an offset with Dali::Toolkit::TextView::SetLineHeightOffset().
- *
- * <h1 class="pg">Font support and multi-language detection</h1>
- *
- * Dali::Toolit::TextView uses the font specified in the styled text array to display the given text.
- *
- * See \link markup-processor Markup Processor \endlink for more details on how to create styling markup strings and styled text arrays.
- *
- * To support multi-language texts, text-view does the following actions per character:
- * <ul>
- * <li> Check if there is a font defined in the styled text array.
- * <li> If there isn't, try to use the default platform font.
- * <li> Check if the character is supported by the font.
- * <li> If isn't, find the most suitable font for the character.
- * </ul>
- *
- * \section text_alignment Text alignment and justification
- *
- * Dali::Toolkit::TextView provides a method to align the whole text inside the text view's boundary as well as a method to justify each line
- * inside the text.
- *
- * The Dali::Toolkit::Alignment::Type is used to align the whole text in the text view's area.
- * A text could be horizontally aligned (left, center, right) and/or vertically aligned (top, center, bottom).
- * Dali::Toolkit::Alignment::HorizontalCenter | Dali::Toolkit::Alignment::VerticalCenter is set by default.
- *
- * The Dali::Toolkit::TextView::LineJustification is used to justify each line inside the text (left, center, right, justified).
- * Dali::Toolkit::TextView::Left is set by default.
- *
- * @see Dali::Toolkit::TextView::SetTextAlignment @see Dali::Toolkit::TextView::SetLineJustification
- *
- * \section text_styling Text styling
- *
- * Dali::Toolkit::TextView supports all text styling features provided by Dali::TextActor (font type, color, size, outline, etc).
- *
- * Different techniques are provided to set or modify the text view's style:
- *
- * <ul>
- * <li> By setting a Dali::Toolkit::MarkupProcessor::StyledTextArray with the Dali::Toolkit::TextView::SetText(const MarkupProcessor::StyledTextArray& text) method.
- * <li> By setting a new Dali::TextStyle to the current text with the Dali::Toolkit::TextView::SetStyleToCurrentText() method.
- * <li> By setting an html-ish markup string which contains both text and style with the Dali::Toolkit::TextView::SetText(const std::string& text) method.
- @note By default the style markup processor is disabled. @see Dali::Toolkit::TextView::SetMarkupProcessingEnabled to enable the markup processing.
- * </ul>
- *
- * See \link markup-processor Markup Processor \endlink for more details on how to create styling markup strings and styled text arrays.
- *
- * \section retrieve Retrieve text layout information
- *
- * The Dali::Toolkit::TextView::GetTextLayoutInfo() retrieves how the input text has been laid out.
- *
- * For each character it retrieves its size and position, visibility, etc. @see Dali::Toolkit::TextView::CharacterLayoutInfo.
- *
- * For each laid-out line it retrieves the index of the first character of the line, size, etc. @see Dali::Toolkit::TextView::LineLayoutInfo.
- *
- * \section appendix Appendix
- * \subsection examples Examples
- *
- * The following examples show how to use TextView. The grey square is an actor which has been added just to show the size of the text-view.
- *
- * Creation of a text view actor with all its parameters by default.
- * \code
- * Toolkit::TextView textView = Toolkit::TextView::New( "Hello world!" );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- *
- * This example wraps the text in lines only when a \\n character is found. The size of the text-view will be automatically resized to fit the whole text inside.
- * \code
- * const std::string text( "<font color='black'>"
- * "Lorem ipsum dolor sit amet, consectetur adipisicing elit,\n"
- * "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
- * "</font>" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New( "" );
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByNewLineChar );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Original );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::Original );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-01.png
- *
- * This example wraps the lines by the next word when it exceeds the width of the text-view. The height exceed policy is set to \e Original so it may exceed the height of the text-view.
- *
- * \code
- * const std::string text( "<font color='black'>"
- * "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
- * "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
- * "</font>" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New( "" );
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- * textView.SetSize( 300.f, 125.f );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Original );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::Original );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-02.png
- *
- * This example wraps the lines by the next word when it exceeds the width of the text-view. If a word is bigger than the text-view's width, it splits the word. If the text exceeds the height of the text-view, the text is ellipsized.
- *
- * \code
- * const std::string text( "<font color='black'>"
- * "Loremipsumdolorsitametconsectetur adipisicing elit,\n"
- * "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
- * "</font>" );
- * const std::string ellipsizeText( "<font color='black'>...</font>" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New( "" );
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetEllipsizeText( ellipsizeText );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- * textView.SetSize( 300.f, 125.f );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Split );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::EllipsizeEnd );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-03.png
- *
- * This example is similar to the one above but the ellipsized text has been set to "" so nothing is shown.
- *
- * \code
- * const std::string text( "<font color='black'>"
- * "Loremipsumdolorsitametconsecteturadipisicingelit"
- * "seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua."
- * "</font>" );
- * const std::string ellipsizeText( "" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New( "" );
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetEllipsizeText( ellipsizeText );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- * textView.SetSize( 300.f, 125.f );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Split );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::EllipsizeEnd );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-04.png
- *
- * This example shows how to fade the text out when it exceeds the boundaries of the text-view.
- *
- * \code
- * const std::string text( "<font color='black'>"
- * "Lorem ipsum dolor sit amet,\n"
- * "consectetur adipisicing elit,\n"
- * "sed do eiusmod tempor incididunt\n"
- * "ut labore et dolore magna aliqua."
- * "</font>" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New();
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- * textView.SetSize( 300.f, 100.f );
- *
- * Toolkit::TextView::FadeBoundary fadeBoundary( PixelSize( 10 ), PixelSize( 10 ), PixelSize( 10 ), PixelSize( 10 ) );
- * textView.SetFadeBoundary( fadeBoundary );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByNewLineChar );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Fade );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::Fade );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-05.png
- *
- * This example enables the scroll feature. The screen-shots show three different images of the same text in different scroll positions.
- *
- * \code
- * const std::string text( "<font color='black'>"
- * "Lorem ipsum dolor sit amet, consectetur adipisicing elit,\n"
- * "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
- * "</font>" );
- *
- * Toolkit::TextView textView = Toolkit::TextView::New();
- * textView.SetMarkupProcessingEnabled( true );
- * textView.SetText( text );
- * textView.SetParentOrigin( ParentOrigin::CENTER );
- * textView.SetSize( 300.f, 60.f );
- *
- * textView.SetMultilinePolicy( Toolkit::TextView::SplitByNewLineChar );
- * textView.SetWidthExceedPolicy( Toolkit::TextView::Original );
- * textView.SetHeightExceedPolicy( Toolkit::TextView::Original );
- * textView.SetLineJustification( Toolkit::TextView::Center );
- *
- * textView.SetScrollEnabled( true );
- *
- * Stage::GetCurrent().Add( textView );
- * \endcode
- * \image html text-view/text-view-example-06.png
- * \image html text-view/text-view-example-07.png
- * \image html text-view/text-view-example-08.png
- *
- * See \link markup-processor Markup Processor \endlink \ref example for more styling markup string examples.
- *
- * \subsection exceed_policies_combinations Implemented exceed policies combinations
- *
- * The following tables show which exceed policies are implemented for each multi-line policy. Each column has one width exceed policy (Original, Fade, Split, ShrinkToFit and EllipsizeEnd),
- * each row has one height exceed policy (Original, Fade, ShrinkToFit and EllipsizeEnd).
- *
- * @note The Split value is not valid for the height exceed policy.
- *
- * \htmlonly
- * <table border="1" align="center">
- * <tr align="center">
- * <th align="center" colspan="7">SplitByNewLineChar</th>
- * </tr>
- * <tr align="center">
- * <th colspan="2" rowspan="2"></th><th align="center" colspan="6">Width exceed policies</th>
- * </tr>
- * <tr>
- * <th>Original</th><th>Fade</th><th>Split</th><th>ShrinkToFit</th><th>EllipsizeEnd</th>
- * </tr>
- * <tr align="center">
- * <th rowspan="4">Height<br />exceed<br />policies</th>
- * <th>Original</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * </tr>
- * <tr align="center">
- * <th>Fade</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>ShrinkToFit</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>EllipsizeEnd</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * </tr>
- * </table>
- * \endhtmlonly
- *
- * \n
- *
- * \htmlonly
- * <table border="1" align="center">
- * <tr align="center">
- * <th align="center" colspan="7">SplitByWord</th>
- * </tr>
- * <tr align="center">
- * <th colspan="2" rowspan="2"></th><th align="center" colspan="6">Width exceed policies</th>
- * </tr>
- * <tr>
- * <th>Original</th><th>Fade</th><th>Split</th><th>ShrinkToFit</th><th>EllipsizeEnd</th>
- * </tr>
- * <tr align="center">
- * <th rowspan="4">Height<br />exceed<br />policies</th>
- * <th>Original</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * </tr>
- * <tr align="center">
- * <th>Fade</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>ShrinkToFit</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>EllipsizeEnd</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#0A0>✓</font></td>
- * </tr>
- * </table>
- * \endhtmlonly
- *
- * \n
- *
- * \htmlonly
- * <table border="1" align="center">
- * <tr align="center">
- * <th align="center" colspan="7">SplitByChar</th>
- * </tr>
- * <tr align="center">
- * <th colspan="2" rowspan="2"></th><th align="center" colspan="6">Width exceed policies</th>
- * </tr>
- * <tr>
- * <th>Original</th><th>Fade</th><th>Split</th><th>ShrinkToFit</th><th>EllipsizeEnd</th>
- * </tr>
- * <tr align="center">
- * <th rowspan="4">Height<br />exceed<br />policies</th>
- * <th>Original</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>Fade</th>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#0A0>✓</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>ShrinkToFit</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * <tr align="center">
- * <th>EllipsizeEnd</th>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * <td><font color=#A00>✗</font></td>
- * </tr>
- * </table>
- * \endhtmlonly
- */
-
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.0.33
+Version: 1.0.34
Release: 1
Group: System/Libraries
License: Apache-2.0
var anim = new dali.Animation( 4 );
var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
- anim.animateBy( actor, "rotation", rotation );
+ anim.animateBy( actor, "orientation", rotation );
anim.play();
return true;
}
function createAnimation() {
var startRotation = new dali.Rotation(180, -180, 0);
- myActor1.rotation = startRotation;
- myActor2.rotation = startRotation;
+ myActor1.orientation = startRotation;
+ myActor2.orientation = startRotation;
dali.stage.add( myActor1 );
dali.stage.add( myActor2 );
var endRotation = new dali.Rotation(0,0,0);
animOptions.alpha = "easeInOutSine";
- anim.animateTo(myActor1, "rotation", endRotation, animOptions);
+ anim.animateTo(myActor1, "orientation", endRotation, animOptions);
// Delay the myActor2 by a second
animOptions.delay = 0.0;
// rotate back to correct orientation
animOptions.alpha = "easeInOutSine";
- anim.animateTo(myActor2, "rotation", endRotation, animOptions);
+ anim.animateTo(myActor2, "orientation", endRotation, animOptions);
return anim;
}
// also rotate the imageActor 90 degrees at the same time.
var rotation = new dali.Rotation(90,0,0,1);
-shaderAnim.animateTo(imageActor, "rotation", rotation, { alpha:"linear", duration:duration, delay:delay });
+shaderAnim.animateTo(imageActor, "orientation", rotation, { alpha:"linear", duration:duration, delay:delay });
shaderAnim.play();
dali.stage.add( imageActor );
// start it of tilted around the y-axis
-imageActor.rotation=new dali.Rotation(90, 0, 1, 0);
+imageActor.orientation=new dali.Rotation(90, 0, 1, 0);
var twistEffect = createTwistEffect();
imageActor.setShaderEffect( twistEffect );
$(v8_plugin_dir)/actors/actor-wrapper.cpp \
$(v8_plugin_dir)/actors/actor-api.cpp \
$(v8_plugin_dir)/actors/layer-api.cpp \
- $(v8_plugin_dir)/actors/text-actor-api.cpp \
$(v8_plugin_dir)/actors/image-actor-api.cpp \
$(v8_plugin_dir)/actors/camera-actor-api.cpp \
$(v8_plugin_dir)/actors/mesh-actor-api.cpp \
$(v8_plugin_dir)/actors/renderable-actor-api.cpp \
$(v8_plugin_dir)/constants/constants-wrapper.cpp \
- $(v8_plugin_dir)/text/font-api.cpp \
- $(v8_plugin_dir)/text/font-wrapper.cpp \
$(v8_plugin_dir)/animation/animation-api.cpp \
$(v8_plugin_dir)/animation/animation-wrapper.cpp \
$(v8_plugin_dir)/animation/path-api.cpp \
#include "actor-api.h"
// EXTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
// INTERNAL INCLUDES
#include <v8-utils.h>
} //unanmed namespace
-namespace TextViewApi
+namespace TextLabelApi
{
Actor New( const v8::FunctionCallbackInfo< v8::Value >& args )
{
- return Dali::Toolkit::TextView::New();
+ return Dali::Toolkit::TextLabel::New();
}
}
*
* @for Actor
* @method getActorType
- * @return {String} Actor, ImageActor, TextActor, MeshActor, Layer, CameraActor ...
+ * @return {String} Actor, ImageActor, MeshActor, Layer, CameraActor ...
*/
void ActorApi::GetActorType( const v8::FunctionCallbackInfo<v8::Value>& args )
{
bool found( false );
Property::Value rotation = V8Utils::GetPropertyValueParameter( PARAMETER_0, found, isolate, args );
- if( rotation.GetType() != Property::ORIENTATION )
+ if( rotation.GetType() != Property::ROTATION )
{
DALI_SCRIPT_EXCEPTION( isolate, "Rotation parameter missing" );
return;
namespace V8Plugin
{
-namespace TextViewApi
+namespace TextLabelApi
{
/**
* Temporary TextView constructor
#include <actors/layer-api.h>
#include <actors/actor-api.h>
#include <actors/image-actor-api.h>
-#include <actors/text-actor-api.h>
#include <actors/mesh-actor-api.h>
#include <actors/camera-actor-api.h>
#include <actors/renderable-actor-api.h>
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mImageActorTemplate;
-v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mMeshActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mCameraActorTemplate;
v8::Persistent<v8::ObjectTemplate> ActorWrapper::mLayerActorTemplate;
-v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextViewTemplate;
+v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextLabelTemplate;
namespace
{
{
{ &ActorWrapper::mActorTemplate }, // ACTOR
{ &ActorWrapper::mImageActorTemplate }, // IMAGE_ACTOR
- { &ActorWrapper::mTextActorTemplate }, // TEXT_ACTOR
{ &ActorWrapper::mMeshActorTemplate }, // MESH_ACTOR
{ &ActorWrapper::mLayerActorTemplate }, // LAYER_ACTOR
{ &ActorWrapper::mCameraActorTemplate}, // CAMERA_ACTOR
- { &ActorWrapper::mTextViewTemplate }
+ { &ActorWrapper::mTextLabelTemplate }
};
/**
ACTOR_API = 1 << 0,
RENDERABLE_ACTOR_API = 1 << 1,
IMAGE_ACTOR_API = 1 << 2,
- TEXT_ACTOR_API = 1 << 3,
- MESH_ACTOR_API = 1 << 4,
- LAYER_API = 1 << 5,
- CAMERA_ACTOR_API = 1 << 6,
+ MESH_ACTOR_API = 1 << 3,
+ LAYER_API = 1 << 4,
+ CAMERA_ACTOR_API = 1 << 5,
};
/**
{
{"Actor", ActorWrapper::ACTOR, ActorApi::New, ACTOR_API },
{"ImageActor", ActorWrapper::IMAGE_ACTOR, ImageActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | IMAGE_ACTOR_API },
- {"TextActor", ActorWrapper::TEXT_ACTOR, TextActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | TEXT_ACTOR_API },
{"MeshActor", ActorWrapper::MESH_ACTOR, MeshActorApi::New, ACTOR_API | RENDERABLE_ACTOR_API | MESH_ACTOR_API },
{"Layer", ActorWrapper::LAYER_ACTOR, LayerApi::New, ACTOR_API | LAYER_API },
{"CameraActor",ActorWrapper::CAMERA_ACTOR, CameraActorApi::New, ACTOR_API | CAMERA_ACTOR_API },
- {"TextView", ActorWrapper::TEXT_VIEW, TextViewApi::New, ACTOR_API },
+ {"TextLabel", ActorWrapper::TEXT_LABEL, TextLabelApi::New, ACTOR_API },
};
else
{
// run the constructor for this type of actor so it can pull out
- // custom parameters, e.g. new TextActor("hello world"); or ImageActor( MyImage );
+ // custom parameters, e.g. new ImageActor( MyImage );
actor = (ActorApiLookup[actorType].constructor)( args );
}
return actor;
// ignore GetFadeInDuration use imageActor.fadeInDuration
//{ "GetCurrentImageSize", ImageActorApi::GetCurrentImageSize, IMAGE_ACTOR_API },
-
- /**************************************
- * Text Actor API (in order of text-actor.h)
- **************************************/
- //ignore SetText use textActor.text
- { "SetToNaturalSize", TextActorApi::SetToNaturalSize, TEXT_ACTOR_API },
- // ignore GetFont use textActor.font
- // ignore SetFont use textActor.font
- // ignore SetGradient use textActor.gradientColor
- // ignore GetGradient textActor.gradientColor
- // ignore SetGradientStartPoint use textActor.gradientStartPoint
- // ignore GetGradientStartPoint textActor.gradientStartPoint
- // ignore SetGradientEndPoint use textActor.gradientEndPoint
- // ignore GetGradientEndPoint textActor.gradientEndPoint
- // @todo? SetTextStyle ( can use individual properties as a work around )
- // @todo? GetTextStyle ( can use individual properties as a work around )
- // ignore SetTextColor use textActor.textColor
- // ignore GetTextColor use textActor.textColor
- // ignore SetSmoothEdge use textActor.smoothEdge
- // ignore SetOutline use textActor.outLineEnable, outlineColor, thicknessWidth
- // ignore SetGlow use textActor.glowEnable, glowColor, glowIntensity
- // ignore SetShadow use textActor.shadowEnable, shadowColor, shadowOffset, shadowSize
- // ignore SetItalics use textActor.italicsAngle ?
- // ignore GetItalics @todo add italics flag? or just stick with angle
- // ignore GetItalicsAngle use textActor.italicsAngle
- // ignore SetUnderline use textActor.underline
- // ignore GetUnderline use textActor.underline
- // ignore SetWeight use textActor.weight
- // ignore GetWeight use textActor.weight
- // ignore SetFontDetectionAutomatic use textActor.fontDetectionAutomatic
- // ignore IsFontDetectionAutomatic use textActor.fontDetectionAutomatic
- // ignore GetLoadingState text is loaded synchronously
- // ignore TextAvailableSignal text is loaded synchronously
-
/**************************************
* Mesh Actor API (in order of mesh-actor.h)
**************************************/
return;
}
- // find out the callee function name...e.g. TextActor, ImageActor, MeshActor
+ // find out the callee function name...e.g. ImageActor, MeshActor
v8::Local<v8::Function> callee = args.Callee();
v8::Local<v8::Value> v8String = callee->GetName();
std::string typeName = V8Utils::v8StringToStdString( v8String );
UNKNOWN_ACTOR = -1,
ACTOR = 0,
IMAGE_ACTOR =1,
- TEXT_ACTOR =2,
- MESH_ACTOR =3,
- LAYER_ACTOR =4,
- CAMERA_ACTOR =5,
- LIGHT_ACTOR =6,
- TEXT_VIEW =7
+ MESH_ACTOR =2,
+ LAYER_ACTOR =3,
+ CAMERA_ACTOR =4,
+ LIGHT_ACTOR =5,
+ TEXT_LABEL =6
};
/**
// The Actor ObjectTemplates.
static v8::Persistent<v8::ObjectTemplate> mActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mImageActorTemplate;
- static v8::Persistent<v8::ObjectTemplate> mTextActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mMeshActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mCameraActorTemplate;
static v8::Persistent<v8::ObjectTemplate> mLayerActorTemplate;
- static v8::Persistent<v8::ObjectTemplate> mTextViewTemplate;
+ static v8::Persistent<v8::ObjectTemplate> mTextLabelTemplate;
/**
* @return the wrapped actor
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "text-actor-api.h"
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/text/text-actor-parameters.h>
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-#include <v8-utils.h>
-#include <object/property-value-wrapper.h>
-#include <text/font-api.h>
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace //unnamed name space
-{
-
-struct TextActorParametersInternal
-{
- TextActorParametersInternal()
- : fontDetection( true )
- {
- }
- bool fontDetection;
- Font font;
-};
-
-
-TextActor GetTextActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
- return TextActor::DownCast( handleWrapper->mHandle );
-}
-
-
-void GetTextOptions( v8::Isolate* isolate,
- v8::Local<v8::Value > options,
- TextActorParametersInternal& textParams )
-{
- // fontDetection: true / false ( default true)
- // font: dali font object
- v8::HandleScope handleScope( isolate );
-
- if( options->IsObject() )
- {
- v8::Local<v8::Object> obj = options->ToObject();
-
- v8::Local<v8::Value> fontDetect = obj->Get( v8::String::NewFromUtf8( isolate, "fontDetection" ) );
- if( fontDetect->IsBoolean() )
- {
-
- textParams.fontDetection = fontDetect->ToBoolean()->Value();
- }
-
- v8::Local<v8::Value> fontValue = obj->Get( v8::String::NewFromUtf8( isolate, "font" ) );
- if( fontValue->IsObject() )
- {
- textParams.font = FontApi::GetFont( isolate, fontValue );
- }
-
- }
-}
-
-}
-
-/**
- * @constructor
- * @for TextActor
- * @method TextActor
- * @param {String} text
- * @param {Object} [textOptions] data
- * Options text options struct
- * @param {Boolean} [textOptions.fontDetection]
- * if true the fontDetection is used to make sure the text is displayed.
- * E.g. if the current font used by the text-actor does not support certain characters
- * it will find a new font that does. Default = true.
- * @param {Object} [textOptions.font]
- * Dali font object
- * @return {Object} TextActor
- */
-Actor TextActorApi::New( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- //
- // TextActor( text, options (optional) )
- //
- // options =
- // {
- // font: font
- // fontDetection: true / false ( default true)
- // }
-
- // get the text (if passed in)
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
-
- TextActorParametersInternal params;
- TextActor actor;
-
- GetTextOptions( isolate, args[1], params );
-
- TextStyle style;
-
- if( params.font )
- {
- style.SetFontName( params.font.GetName() );
- style.SetFontStyle( params.font.GetStyle() );
- style.SetFontPointSize( PointSize(params.font.GetPointSize()));
-
- }
- TextActorParameters textActorParameters( style, params.fontDetection? TextActorParameters::FONT_DETECTION_OFF:TextActorParameters::FONT_DETECTION_ON );
-
- actor = TextActor::New( text, textActorParameters );
-
- return actor;
-
-}
-
-/**
- * Set text to the natural size of the text string.
- *
- * After this method the text actor always uses the natural size of the text
- * when SetText is called unless SetSize is called to override the size.
- *
- * @for TextActor
- * @method setToNaturalSize
- */
-void TextActorApi::SetToNaturalSize( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- TextActor textActor = GetTextActor( isolate, args );
- textActor.SetToNaturalSize();
-}
-
-} // namespace V8Plugin
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_V8PLUGIN_TEXT_ACTOR_API_H__
-#define __DALI_V8PLUGIN_TEXT_ACTOR_API_H__
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/public-api/actors/text-actor.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace TextActorApi
-{
- Actor New( const v8::FunctionCallbackInfo< v8::Value >& args );
- void SetToNaturalSize( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-}; // namespace TextActorApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_TEXT_ACTOR_API_H__
#include <stage/stage-wrapper.h>
#include <image/image-attributes-wrapper.h>
#include <image/image-wrapper.h>
-#include <text/font-wrapper.h>
#include <animation/path-wrapper.h>
#include <animation/animation-wrapper.h>
#include <events/pan-gesture-detector-wrapper.h>
{
{ "Rotation", PropertyValueWrapper::NewRotation},
{ "Matrix", PropertyValueWrapper::NewMatrix},
- { "Font", FontWrapper::NewFont },
{ "Path", PathWrapper::NewPath },
{ "Actor", ActorWrapper::NewActor },
{ "TextActor", ActorWrapper::NewActor },
// Context = multiple contexts can exist in a given Isolate, and share data between contexts
v8::Handle<v8::Context> context = v8::Context::New( mIsolate, NULL, global);
- mGlobalObjectTemplate.Reset( mIsolate, global);
+ mGlobalObjectTemplate.Reset( mIsolate, global);
mContext.Reset( mIsolate, context);
}
{
if( !mIsolate )
{
- v8::V8::Initialize();
v8::V8::InitializeICU();
+
+ v8::V8::Initialize();
+
+ // default isolate removed from V8 version 3.27.1 and beyond.
+ mIsolate = v8::Isolate::New();
+ mIsolate->Enter();
+
v8::V8::SetFatalErrorHandler( FatalErrorCallback );
- mIsolate = v8::Isolate::GetCurrent();
+
}
// if context is null, create it and add dali object to the global object.
if( mContext.IsEmpty())
v8::Local<v8::Object> stageObject = StageWrapper::WrapStage( mIsolate, Stage::GetCurrent() );
daliObject->Set( v8::String::NewFromUtf8( mIsolate, "stage") , stageObject );
- // fontObject provides static font functionality like GetFontList...
- v8::Local<v8::Object> fontObject = FontWrapper::GetStaticFontObject( mIsolate );
- daliObject->Set( v8::String::NewFromUtf8( mIsolate, "font") , fontObject );
-
// keyboard focus manager is a singleton
v8::Local<v8::Object> keyboardObject = KeyboardFocusManagerWrapper::WrapKeyboardFocusManager( mIsolate,Toolkit::KeyboardFocusManager::Get() );
daliObject->Set( v8::String::NewFromUtf8( mIsolate, "keyboardFocusManager") , keyboardObject );
const GeometryTypePair GeometryTypeTable[]=
{
{"image", GEOMETRY_TYPE_IMAGE },
- {"text", GEOMETRY_TYPE_TEXT },
{"mesh", GEOMETRY_TYPE_UNTEXTURED_MESH },
{"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH },
};
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "font-api.h"
-
-// INTERNAL INCLUDES
-#include <v8-utils.h>
-#include <text/font-wrapper.h>
-#include <object/property-value-wrapper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace // un named namespace
-{
-
-
-
-
-} //un named namespace
-
-/***************************************
- * IMAGE FUNCTIONS
- *
- ****************************************/
-Font FontApi::GetFont( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::HandleScope handleScope( isolate );
-
- v8::Local<v8::Object> object = args.This();
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast( object->GetInternalField(0) );
- void* ptr = field->Value();
-
- FontWrapper* wrapper = static_cast< FontWrapper *>(ptr);
- return wrapper->GetFont();
-}
-Font FontApi::GetFont( v8::Isolate* isolate, v8::Local<v8::Value>& value )
-{
- v8::HandleScope handleScope( isolate );
- v8::Local<v8::Object> object = value->ToObject();
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast( object->GetInternalField(0) );
- void* ptr = field->Value();
-
- FontWrapper* wrapper = static_cast< FontWrapper *>(ptr);
- return wrapper->GetFont();
-}
-
-struct FontParams
-{
- typedef enum
- {
- NO_SIZE_SET,
- USE_POINT_SIZE,
- USE_PIXEL_SIZE,
- USE_CAP_SIZE,
- } SizeType;
-
-
- FontParams()
- :pointSize( 0 ),
- pixelSize( 0 ),
- capsSize( 0 ),
- sizeType( FontParams::NO_SIZE_SET )
- {
- }
-
- std::string family;
- std::string style;
- PointSize pointSize;
- PixelSize pixelSize;
- CapsHeight capsSize;
- SizeType sizeType;
-
-
-};
-
-
-void ReadFontParameters( v8::Isolate* isolate,
- v8::Local<v8::Value > options,
- FontParams& fontParams )
-{
- // foont options is an optional parameter passed in which holds
- // optional settings
- // var fontOptions = {
- // family: "arial",
- // style: "bold",
- // // one of the following
- // pixelSize: xx
- // pointSize: xx
- // capsHeight:xx // height of a capital letter above the baseline for a particular typeface.
- //
- // };
- v8::HandleScope handleScope( isolate );
- if( !options->IsObject() )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 ( font parameters)" );
- return;
- }
- v8::Local<v8::Object> obj = options->ToObject();
-
- v8::Local<v8::Value> familyValue = obj->Get( v8::String::NewFromUtf8( isolate, "family" ) );
- if( familyValue->IsString() )
- {
- fontParams.family = V8Utils::v8StringToStdString( familyValue );
- }
-
- v8::Local<v8::Value> styleValue = obj->Get( v8::String::NewFromUtf8( isolate, "style" ) );
- if( styleValue->IsString() )
- {
- fontParams.style = V8Utils::v8StringToStdString( styleValue );
- }
-
- v8::Local<v8::Value> pixelSize = obj->Get( v8::String::NewFromUtf8( isolate, "pixelSize" ) );
- v8::Local<v8::Value> pointSize = obj->Get( v8::String::NewFromUtf8( isolate, "pointSize" ) );
- v8::Local<v8::Value> capsHeight = obj->Get( v8::String::NewFromUtf8( isolate, "capsHeight" ) );
-
- if( pixelSize->IsUint32() )
- {
- fontParams.pixelSize.value = pixelSize->ToUint32()->Value();
- fontParams.sizeType = FontParams::USE_PIXEL_SIZE;
- }
- else if( pointSize->IsUint32() )
- {
- fontParams.pointSize.value = pointSize->ToUint32()->Value();
- fontParams.sizeType = FontParams::USE_POINT_SIZE;
- }
- else if( capsHeight->IsUint32() )
- {
- fontParams.capsSize.value = capsHeight->ToUint32()->Value();
- fontParams.sizeType = FontParams::USE_CAP_SIZE;
- }
-
-}
-
-Font FontApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- // if no parameters just create a default font
- if ( args.Length() == 0)
- {
- return Font::New();
- }
- FontParams params;
-
- ReadFontParameters( isolate, args[0], params );
-
- FontParameters fontParams;
- // construct a dali font parameters object
- switch( params.sizeType)
- {
- case FontParams::USE_PIXEL_SIZE:
- {
- fontParams = FontParameters( params.family, params.style, params.pixelSize );
- break;
- }
- case FontParams::USE_POINT_SIZE:
- {
- fontParams = FontParameters( params.family, params.style, params.pointSize );
- break;
- }
- case FontParams::USE_CAP_SIZE:
- {
- fontParams = FontParameters( params.family, params.style, params.capsSize );
- break;
- }
- default:
- {
- fontParams = FontParameters( params.family, params.style, PointSize(0.f));
- break;
- }
- }
- return Font::New( fontParams );
-
-}
-
-
-void FontApi::GetFamilyForText( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
-
- bool foundString;
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, foundString, isolate, args );
- if( !foundString )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 ( text )" );
- return;
- }
- std::string family = Font::GetFamilyForText( text );
-
- args.GetReturnValue().Set( v8::String::NewFromUtf8( isolate, family.c_str()) );
-
-}
-void FontApi::GetLineHeightFromCapsHeight( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- FontParams params;
- ReadFontParameters( isolate, args[0], params );
- if( params.sizeType != FontParams::USE_CAP_SIZE )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "caps height not found" );
- return;
- }
-
- PixelSize size = Font::GetLineHeightFromCapsHeight( params.family, params.style, params.capsSize);
- args.GetReturnValue().Set( v8::Integer::New( isolate, size.value ) );
-}
-
-void FontApi::GetInstalledFonts( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- bool found( false );
- std::vector<std::string> fontList;
-
- std::string mode = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
-
- if( mode == "LIST_APPLICATION_FONTS" )
- {
- fontList = Font::GetInstalledFonts( Font::LIST_APPLICATION_FONTS );
- }
- else if( mode == "LIST_ALL_FONTS")
- {
- fontList = Font::GetInstalledFonts( Font::LIST_ALL_FONTS );
- }
- else // default
- {
- fontList = Font::GetInstalledFonts( Font::LIST_SYSTEM_FONTS );
- }
- // create a javascript array
- v8::Local<v8::Array> array = v8::Array::New(isolate, fontList.size() );
- for( std::size_t i = 0; i < fontList.size(); i++)
- {
- const char* fontName = fontList[i].c_str();
- array->Set(v8::Integer::New(args.GetIsolate(), i), v8::String::NewFromUtf8( isolate,fontName));
- }
-
- args.GetReturnValue().Set( array );
-}
-
-void FontApi::MeasureTextWidth( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- //float MeasureTextWidth(const std::string& text, float textHeightPx) const;
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
- if(! found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "text not found" );
- return;
- }
- int height = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0 );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing text height" );
- return;
- }
- float width = font.MeasureTextWidth( text, height );
-
- args.GetReturnValue().Set( v8::Integer::New( isolate, width ) );
-
-}
-void FontApi::MeasureTextHeight( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- //float MeasureTextHeight(const std::string& text, float textHeightPx) const;
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
- if(! found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "text not found" );
- return;
- }
- int width= V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0 );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing text height" );
- return;
- }
- float height = font.MeasureTextHeight( text, width );
-
- args.GetReturnValue().Set( v8::Integer::New( isolate, height ) );
-}
-void FontApi::MeasureText( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
- if(! found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "text not found" );
- return;
- }
-
- Vector3 vec3 = font.MeasureText( text );
- Dali::Property::Value value( vec3 );
- v8::Local <v8::Object> object = PropertyValueWrapper::WrapDaliProperty( isolate, value);
- args.GetReturnValue().Set( object );
-
-}
-void FontApi::AllGlyphsSupported( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
- if(! found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "text not found" );
- return;
- }
-
- bool supported = font.AllGlyphsSupported( text );
- args.GetReturnValue().Set( v8::Boolean::New( isolate, supported) );
-
-}
-
-// This one function is use to create a property map, instead of the many individual property
-// getters used by the C++ Dali API.
-// propertyMap
-// {
-// name:
-// style:
-// pointSize:
-// pixelSize:
-// lineHeight:
-// ascender:
-// underlineThickness:
-// underlinePosition:
-// isDefaultSystemFont:
-// isDefaultSystemSize:
-// }
-
-void FontApi::GetProperties( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- v8::Local<v8::Object> keyObject = v8::Object::New( isolate );
-
- keyObject->Set( v8::String::NewFromUtf8( isolate, "family" ), v8::String::NewFromUtf8( isolate, font.GetName().c_str() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "style" ), v8::String::NewFromUtf8( isolate, font.GetStyle().c_str() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "pointSize" ), v8::Integer::New( isolate, font.GetPointSize() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "pixelSize" ), v8::Integer::New( isolate, font.GetPixelSize() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "lineHeight" ), v8::Integer::New( isolate, font.GetLineHeight() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "ascender" ), v8::Integer::New( isolate, font.GetAscender() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "underlineThickness" ), v8::Integer::New( isolate, font.GetUnderlineThickness() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "underlinePosition" ), v8::Integer::New( isolate, font.GetUnderlinePosition()) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "isDefaultSystemFont" ), v8::Boolean::New( isolate, font.IsDefaultSystemFont() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "isDefaultSystemSize" ), v8::Boolean::New( isolate, font.IsDefaultSystemSize() ) );
-
- args.GetReturnValue().Set( keyObject );
-
-}
-
-void FontApi::GetMetrics( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Font font = GetFont( isolate, args );
-
- bool found( false );
- std::string text = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
-
- if(! found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "character not found" );
- return;
- }
-
- Text textObject( text );
-
- Font::Metrics metric = font.GetMetrics( textObject[0] );
-
- v8::Local<v8::Object> keyObject = v8::Object::New( isolate );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "advance" ), v8::Integer::New( isolate, metric.GetAdvance() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "bearing" ), v8::Integer::New( isolate, metric.GetBearing() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "width" ), v8::Integer::New( isolate, metric.GetWidth() ) );
- keyObject->Set( v8::String::NewFromUtf8( isolate, "height" ), v8::Integer::New( isolate, metric.GetHeight() ) );
-
- args.GetReturnValue().Set( keyObject );
-
-}
-
-
-void FontApi::PointsToPixels( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- bool found(false);
- int pointSize= V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing pointSize" );
- return;
- }
- args.GetReturnValue().Set( v8::Integer::New( isolate, Font::PointsToPixels(pointSize) ) );
-
-}
-void FontApi::PixelsToPoints( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- bool found(false);
- int pixelSize= V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing pixelSize" );
- return;
- }
- args.GetReturnValue().Set( v8::Integer::New( isolate, Font::PixelsToPoints(pixelSize) ) );
-}
-
-
-
-} // namespace V8Plugin
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_V8PLUGIN_FONT_API_H__
-#define __DALI_V8PLUGIN_FONT_API_H__
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/public-api/text/font.h>
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace FontApi
-{
- Font GetFont( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args );
- Font GetFont( v8::Isolate* isolate, v8::Local<v8::Value>& value );
-
- Font GetFontFromParams( int paramIndex,
- bool& found,
- v8::Isolate* isolate,
- const v8::FunctionCallbackInfo< v8::Value >& args );
-
- /**
- * Constructor
- */
- Font New( const v8::FunctionCallbackInfo< v8::Value >& args );
-
- /**
- * Font API see image.h for a description
- */
- void GetFamilyForText( const v8::FunctionCallbackInfo< v8::Value >& args );
- void GetLineHeightFromCapsHeight( const v8::FunctionCallbackInfo< v8::Value >& args );
- void GetInstalledFonts( const v8::FunctionCallbackInfo< v8::Value >& args );
- void MeasureTextWidth( const v8::FunctionCallbackInfo< v8::Value >& args );
- void MeasureTextHeight( const v8::FunctionCallbackInfo< v8::Value >& args );
- void MeasureText( const v8::FunctionCallbackInfo< v8::Value >& args );
- void AllGlyphsSupported( const v8::FunctionCallbackInfo< v8::Value >& args );
- void GetProperties( const v8::FunctionCallbackInfo< v8::Value >& args );
- void GetMetrics( const v8::FunctionCallbackInfo< v8::Value >& args );
- void PointsToPixels( const v8::FunctionCallbackInfo< v8::Value >& args );
- void PixelsToPoints( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-}; // namespace FontApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_FONT_API_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "font-wrapper.h"
-
-// INTERNAL INCLUDES
-#include <v8-utils.h>
-#include <dali-wrapper.h>
-#include <text/font-api.h>
-#include <shared/api-function.h>
-#include <shared/object-template-helper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace // un-named name space
-{
-
-/**
- * Contains a list of all functions that can be called on the font object
- */
-const ApiFunction FontFunctionTable[]=
-{
- /**************************************
- * Font API (in order of font.h)
- **************************************/
- { "MeasureTextWidth", FontApi::MeasureTextWidth },
- { "MeasureTextHeight", FontApi::MeasureTextHeight },
- { "MeasureText", FontApi::MeasureText },
- { "AllGlyphsSupported", FontApi::AllGlyphsSupported },
- { "GetProperties", FontApi::GetProperties }, // replace all getters
- { "GetMetrics", FontApi::GetMetrics },
-};
-
-const unsigned int FontFunctionTableCount = sizeof(FontFunctionTable)/sizeof(FontFunctionTable[0]);
-
-/**
- * Contains a list of all functions that can be called
- */
-const ApiFunction StaticFontFunctionTable[]=
-{
- /**************************************
- * Static font functions, called without a font object
- **************************************/
- { "GetFamilyForText", FontApi::GetFamilyForText },
- { "GetLineHeightFromCapsHeight", FontApi::GetLineHeightFromCapsHeight },
- { "GetInstalledFonts", FontApi::GetInstalledFonts },
- { "PointsToPixels", FontApi::PointsToPixels },
- { "PixelsToPoints", FontApi::PixelsToPoints },
-};
-
-const unsigned int StaticFontFunctionTableCount = sizeof(StaticFontFunctionTable)/sizeof(FontFunctionTable[0]);
-
-} //un-named space
-
-
-FontWrapper::FontWrapper( const Dali::Font& font, GarbageCollectorInterface& gc )
-: BaseWrappedObject( BaseWrappedObject::FONT , gc )
-{
- mFont = font;
-}
-
-v8::Handle<v8::Object> FontWrapper::WrapFont(v8::Isolate* isolate, const Dali::Font& font )
-{
- v8::EscapableHandleScope handleScope( isolate );
- v8::Local<v8::ObjectTemplate> objectTemplate;
-
- objectTemplate = MakeFontTemplate( isolate );
-
- // create an instance of the template
- v8::Local<v8::Object> localObject = objectTemplate->NewInstance();
-
- // create the Font wrapper
- FontWrapper* pointer = new FontWrapper( font, Dali::V8Plugin::DaliWrapper::Get().GetDaliGarbageCollector() );
-
- // assign the JavaScript object to the wrapper.
- pointer->SetJavascriptObject( isolate, localObject );
-
- printf("Created Font!\n");
- return handleScope.Escape( localObject );
-}
-
-
-v8::Handle<v8::ObjectTemplate> FontWrapper::MakeFontTemplate( v8::Isolate* isolate )
-{
- v8::EscapableHandleScope handleScope( isolate );
-
- v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New();
-
- objTemplate->SetInternalFieldCount( BaseWrappedObject::FIELD_COUNT );
-
- // add our function properties
- ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, FontFunctionTable, FontFunctionTableCount );
-
- return handleScope.Escape( objTemplate );
-}
-
-void FontWrapper::NewFont( const v8::FunctionCallbackInfo< v8::Value >& args)
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate);
-
- if(!args.IsConstructCall())
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Font constructor called without 'new'");
- return;
- }
-
- // attribs can be passed by value
- Dali::Font font = FontApi::New( args );
- if( !font )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "bad font parameters\n");
- return;
- }
-
- v8::Local<v8::Object> localObject = WrapFont( isolate, font );
- args.GetReturnValue().Set( localObject );
-}
-
-Font FontWrapper::GetFont()
-{
- return mFont;
-}
-
-v8::Handle<v8::Object> FontWrapper::GetStaticFontObject(v8::Isolate* isolate)
-{
- v8::EscapableHandleScope handleScope( isolate );
-
- v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New();
-
- // add our functions properties
- ObjectTemplateHelper::InstallFunctions( isolate, objTemplate, StaticFontFunctionTable, StaticFontFunctionTableCount );
-
- v8::Local<v8::Object> localObject = objTemplate->NewInstance();
-
- return handleScope.Escape( localObject );
-
- }
-
-
-} // namespace V8Plugin
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_V8PLUGIN_FONT_WRAPPER_H__
-#define __DALI_V8PLUGIN_FONT_WRAPPER_H__
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/public-api/text/font.h>
-
-// INTERNAL INCLUDES
-#include <shared/base-wrapped-object.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-
-/**
- * An Font wrapper.
- * Provides access to Font specific functionality and V8 memory handling.
- */
-class FontWrapper : public BaseWrappedObject
-{
-
-public:
-
- FontWrapper( const Font& font,
- GarbageCollectorInterface& gc );
-
- virtual ~FontWrapper()
- {
- };
-
- /**
- * @brief Creates a new Font wrapped inside a Javascript Object.
- * @note: the actor type ie 'FontFont' is expected to be the name of the callee function.
- * @param[in] args v8 function call arguments interpreted
- */
- static void NewFont( const v8::FunctionCallbackInfo< v8::Value >& args);
-
- /**
- * Wraps a font
- */
- static v8::Handle<v8::Object> WrapFont(v8::Isolate* isolate, const Dali::Font& );
-
- Font GetFont();
-
- static v8::Handle<v8::Object> GetStaticFontObject(v8::Isolate* isolate);
-
-private:
-
- Font mFont;
- static v8::Handle<v8::ObjectTemplate> MakeFontTemplate( v8::Isolate* isolate );
-
-};
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // __DALI_V8PLUGIN_FONT_WRAPPER_H__
#include <actors/actor-wrapper.h>
#include <image/image-wrapper.h>
#include <animation/animation-wrapper.h>
-#include <text/font-wrapper.h>
#include <shader-effects/shader-effect-wrapper.h>
v8::Local<v8::Object> image = ImageWrapper::WrapImage(isolate, Image::DownCast(handle) );
args.GetReturnValue().Set( image );
}
- if( typeName == "Font ")
- {
- v8::Local<v8::Object> font = FontWrapper::WrapFont(isolate, Font::DownCast(handle) );
- args.GetReturnValue().Set( font );
- }
if( typeName == "Shader")
{
v8::Local<v8::Object> shader = ShaderEffectWrapper::WrapShaderEffect(isolate, ShaderEffect::DownCast( handle ));
else if (value->IsBooleanObject() )
{
const v8::Local<v8::BooleanObject> object = v8::Local<v8::BooleanObject>::Cast(value);
- return object->ValueOf();
+ return object->BooleanValue();
}
DALI_SCRIPT_EXCEPTION(isolate, "no bool found");
return false;