return shapingHandle;
}
+Length Shaping::Shape( const Character* const text,
+ Length numberOfCharacters,
+ FontId fontId,
+ Script script )
+{
+ return 0u;
+}
+
+void Shaping::GetGlyphs( GlyphInfo* glyphInfo,
+ CharacterIndex* glyphToCharacterMap )
+{
+}
+
} // namespace Internal
} // namespace TextAbstraction
*/
static TextAbstraction::Shaping Get();
+ /**
+ * @copydoc Dali::Shaping::Shape()
+ */
+ Length Shape( const Character* const text,
+ Length numberOfCharacters,
+ FontId fontId,
+ Script script );
+
+ /**
+ * @copydoc Dali::Shaping::GetGlyphs()
+ */
+ void GetGlyphs( GlyphInfo* glyphInfo,
+ CharacterIndex* glyphToCharacterMap );
+
private:
// Undefined copy constructor.
return Internal::Shaping::Get();
}
+Length Shaping::Shape( const Character* const text,
+ Length numberOfCharacters,
+ FontId fontId,
+ Script script )
+{
+ return GetImplementation( *this ).Shape( text,
+ numberOfCharacters,
+ fontId,
+ script );
+}
+
+void Shaping::GetGlyphs( GlyphInfo* glyphInfo,
+ CharacterIndex* glyphToCharacterMap )
+{
+ GetImplementation( *this ).GetGlyphs( glyphInfo,
+ glyphToCharacterMap );
+}
} // namespace TextAbstraction
* limitations under the License.
*
*/
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction.h>
+
+// EXTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
namespace Dali
} // Internal
-} // TextAbstraction
-
-namespace TextAbstraction
-{
-
/**
- * Shaping API
+ * @brief Shaping provides an interface to retrieve glyphs from complex text.
+ *
+ * This module shapes text for a unique font id and script. If the text contains different fonts and scripts
+ * it needs to be split in runs of consecutive characters with the same font id and script.
+ *
+ * @code
+ * Shaping shaping = Shaping::Get();
+ *
+ * // Shapes a number of characters with the given font id and script.
+ * const Length numberOfGlyphs = shaping.Shape( text, numberOfCharacters, fontId, script );
+ *
+ * // Allocate memory to retrieve the glyphs and the character to glyph conversion map.
+ * GlyphInfo* glyphInfo = reinterpret_cast<GlyphInfo*>( malloc( numberOfGlyphs * sizeof( GlyphInfo ) ) );
+ * CharacterIndex* glyphToCharacterMap = reinterpret_cast<CharacterIndex*>( malloc( numberOfGlyphs * sizeof( CharacterIndex ) ) );
*
+ * // Retrieve the glyphs and the conversion map.
+ * shaping.GetGlyphs( glyphInfo, glyphToCharacterMap );
+ * @endcode
*/
class DALI_IMPORT_API Shaping : public BaseHandle
{
/**
* @brief This constructor is used by Shaping::Get().
*
- * @param[in] shaping A pointer to the internal shaping object.
+ * @param[in] implementation A pointer to the internal shaping object.
*/
- explicit DALI_INTERNAL Shaping( Internal::Shaping* shaping);
+ explicit DALI_INTERNAL Shaping( Internal::Shaping* implementation );
/**
* @brief Retrieve a handle to the Shaping instance.
*/
static Shaping Get();
+ /**
+ * Shapes the text.
+ *
+ * Call GetGlyphs() to retrieve the glyphs.
+ *
+ * @param[in] text Pointer to the first character of the text coded in UTF32.
+ * @param[in] numberOfCharacters The number of characters to be shaped
+ * @param[in] fontId The font to be used to shape the text.
+ * @param[in] script The text's script.
+ *
+ * @return The size of the buffer required to get the shaped text.
+ */
+ Length Shape( const Character* const text,
+ Length numberOfCharacters,
+ FontId fontId,
+ Script script );
+
+ /**
+ * Gets the shaped text data.
+ *
+ * @pre @p glyphInfo and @p glyphToCharacterMap must have enough space allocated for the number of glyphs.
+ * Call first Shape() to shape the text and get the number of glyphs.
+ *
+ * @param[out] glyphInfo Vector with indices to the glyph within the font, glyph's metrics and advance.
+ * @param[out] glyphToCharacterMap The glyph to character conversion map.
+ */
+ void GetGlyphs( GlyphInfo* glyphInfo,
+ CharacterIndex* glyphToCharacterMap );
};
} // namespace TextAbstraction
WORD_NO_BREAK = 1u, ///< Text can't be broken into a new word.
};
+/*
+ * @brief Script is the writing system used by a language.
+ * Typically one script can be used to write different languages although one language could be written in different scrips.
+ */
+enum Script
+{
+ LATIN, ///< The latin script. Used by many western languages and others around the world.
+ ARABIC, ///< The arabic script. Used by Arab and Urdu among others.
+ DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
+ BENGALI, ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
+ GURMUKHI, ///< The Gurmukhi script. Used by Punjabi.
+ GUJARATI, ///< The Gujarati script. Used by Gujarati.
+ ORIYA, ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
+ TAMIL, ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
+ TELUGU, ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
+ KANNADA, ///< The Kannada script. Used by Kannada and Tulu.
+ MALAYALAM, ///< The Malayalam script. Used by Malayalam.
+ SINHALA, ///< The Sinhala script. Used by Sinhala and Pali.
+ CJK, ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
+ HANGUL, ///< The Hangul jamo script. Used by Korean.
+ KHMER, ///< The Khmer script. Used by the Khmer language.
+ LAO, ///< The Lao script. Used by the Lao language.
+ THAI, ///< The Thai script. Used by the Thai language
+ BURMESE, ///< The Burmese script. Used by the Burmese (Myanmar) language.
+ UNKNOWN ///< The script is unknown.
+};
+
} // namespace TextAbstraction
} // namespace Dali