*/
// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
/**
* Implementation of the BidirectionalSupport
*/
-class BidirectionalSupport : public Dali::BaseObject
+class BidirectionalSupport : public BaseObject
{
public:
return false;
}
- bool FindSystemFont( Character charcode, FontDescription& systemFont )
+ void GetDescription( FontId id, FontDescription& fontDescription ) const
{
- // TODO - Use FcCharSetHasChar()
+ // TODO
+ }
- return false;
+ PointSize26Dot6 GetPointSize( FontId id )
+ {
+ return 12*64;
+ }
+
+ FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
+ {
+ // TODO - Use FcCharSetHasChar()
+ return FontId(0);
}
FontId GetFontId( const std::string& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
return id;
}
+ FontId GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize,
+ FaceIndex faceIndex )
+ {
+ return 0u;
+ }
+
GlyphIndex GetGlyphIndex( FontId fontId, Character charcode )
{
GlyphIndex index( 0 );
return id;
}
- FontId FindDefaultFont( Character charcode )
- {
- // TODO - Return cached results based on script
- return FontId(0);
- }
-
void GetFontMetrics( FontId fontId, FontMetrics& metrics )
{
if( fontId > 0 &&
}
}
+void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
+{
+ CreatePlugin();
+}
+
+PointSize26Dot6 FontClient::GetPointSize( FontId id )
+{
+ CreatePlugin();
+
+ return mPlugin->GetPointSize( id );
+}
+
void FontClient::GetSystemFonts( FontList& systemFonts )
{
CreatePlugin();
mPlugin->GetSystemFonts( systemFonts );
}
-bool FontClient::FindSystemFont( Character charcode, FontDescription& systemFont )
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
{
CreatePlugin();
- return mPlugin->FindSystemFont( charcode, systemFont );
+ return mPlugin->FindDefaultFont( charcode, pointSize );
}
FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
return mPlugin->GetFontId( path, pointSize, faceIndex );
}
-FontId FontClient::FindDefaultFont( Character charcode )
+FontId FontClient::GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize,
+ FaceIndex faceIndex )
{
CreatePlugin();
- return mPlugin->FindDefaultFont( charcode );
+ return mPlugin->GetFontId( fontFamily,
+ fontStyle,
+ pointSize,
+ faceIndex );
}
void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
/**
* Implementation of the FontClient
*/
-class FontClient : public Dali::BaseObject
+class FontClient : public BaseObject
{
public:
void GetSystemFonts( FontList& systemFonts );
/**
- * @copydoc Dali::FontClient::FindSystemFont()
+ * @copydoc Dali::FontClient::GetDescription()
*/
- bool FindSystemFont( Character charcode, FontDescription& systemFont );
+ void GetDescription( FontId id, FontDescription& fontDescription );
/**
- * @copydoc Dali::FontClient::GetFontId()
+ * @copydoc Dali::FontClient::GetPointSize()
*/
- FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
+ PointSize26Dot6 GetPointSize( FontId id );
/**
* @copydoc Dali::FontClient::FindDefaultFont()
*/
- FontId FindDefaultFont( Character charcode );
+ FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize );
+
+ /**
+ * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+ */
+ FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
+
+ /**
+ * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+ */
+ FontId GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize,
+ FaceIndex faceIndex );
/**
* @copydoc Dali::FontClient::GetFontMetrics()
}
else // create and register the object
{
- segmentationHandle = TextAbstraction::Segmentation( new Segmentation);
+ segmentationHandle = TextAbstraction::Segmentation( new Segmentation );
service.Register( typeid( segmentationHandle ), segmentationHandle );
}
}
- return segmentationHandle;
+ return segmentationHandle;
}
void Segmentation::GetLineBreakPositions( const Character* const text,
* Implementation of the Segmentation
*/
-class Segmentation : public Dali::BaseObject
+class Segmentation : public BaseObject
{
public:
/**
* Implementation of the Shaping
*/
-class Shaping : public Dali::BaseObject
+class Shaping : public BaseObject
{
public:
*/
// INTERNAL INCLUDES
-#include <dali/public-api/text-abstraction/text-abstraction.h>
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
namespace TextAbstraction
{
+const PointSize26Dot6 FontClient::DEFAULT_POINT_SIZE = 768u; // 12*64
+
FontClient FontClient::Get()
{
return Internal::FontClient::Get();
GetImplementation(*this).GetSystemFonts( systemFonts );
}
-bool FontClient::FindSystemFont( Character charcode, FontDescription& systemFont )
+void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
+{
+ GetImplementation(*this).GetDescription( id, fontDescription );
+}
+
+PointSize26Dot6 FontClient::GetPointSize( FontId id )
+{
+ return GetImplementation(*this).GetPointSize( id );
+}
+
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
{
- return GetImplementation(*this).FindSystemFont( charcode, systemFont );
+ return GetImplementation(*this).FindDefaultFont( charcode, pointSize );
}
FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
return GetImplementation(*this).GetFontId( path, pointSize, faceIndex );
}
-FontId FontClient::FindDefaultFont( Character charcode )
+FontId FontClient::GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize,
+ FaceIndex faceIndex )
{
- return GetImplementation(*this).FindDefaultFont( charcode );
+ return GetImplementation(*this).GetFontId( fontFamily,
+ fontStyle,
+ pointSize,
+ faceIndex );
}
void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
*
*/
+// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/images/bitmap-image.h>
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/public-api/text-abstraction/glyph-info.h>
#include <dali/public-api/text-abstraction/font-list.h>
#include <dali/public-api/text-abstraction/font-metrics.h>
*/
class DALI_IMPORT_API FontClient : public BaseHandle
{
+public:
+ static const PointSize26Dot6 DEFAULT_POINT_SIZE; ///< The default point size.
+
public:
/**
*/
FontClient& operator=( const FontClient& handle );
+ ////////////////////////////////////////
+ // Font management and validation.
+ ////////////////////////////////////////
+
/**
* @brief Set the DPI of the target window.
*
void GetSystemFonts( FontList& systemFonts );
/**
- * @brief Find an appropriate system-font for displaying a UTF-32 character.
+ * @brief Retrieves the font description of a given font @p id.
+ *
+ * @param[in] id The font id.
+ * @param[out] fontDescription The path, family & style describing the font.
+ */
+ void GetDescription( FontId id, FontDescription& fontDescription );
+
+ /**
+ * @brief Retrieves the font point size of a given font @p id.
+ *
+ * @param[in] id The font id.
+ *
+ * @return The point size in 26.6 fractional points.
+ */
+ PointSize26Dot6 GetPointSize( FontId id );
+
+ /**
+ * @brief Find an appropriate font for displaying a UTF-32 character.
*
* This is useful when localised strings are provided for multiple languages
* i.e. when a single default font does not work for all languages.
* @param[in] charcode The character for which a font is needed.
- * @param[out] systemFont The path, family & style describing the font.
- * @return True if an appropriate system font was found.
+ * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+ * @return A valid font ID, or zero if the font does not exist.
*/
- bool FindSystemFont( Character charcode, FontDescription& systemFont );
+ FontId FindDefaultFont( Character charcode,
+ PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE );
/**
* @brief Retrieve the unique identifier for a font.
* @param[in] faceIndex The index of the font face (optional).
* @return A valid font ID, or zero if the font does not exist.
*/
- FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = 12*64, FaceIndex faceIndex = 0 );
+ FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 );
/**
- * @brief Retrieve the ID of the default font for displaying a UTF-32 character.
+ * @brief Retrieve the unique identifier for a font.
*
- * This is useful when localised strings are provided for multiple languages
- * i.e. when a single default font does not work for all languages.
- * @param[in] charcode The character for which a font is needed.
- * @return A valid font ID, or zero if no appropriate font was found.
+ * @param[in] fontFamily The font family name.
+ * @param[in] fontStyle The font style.
+ * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+ * @param[in] faceIndex The index of the font face (optional).
+ * @return A valid font ID, or zero if the font does not exist.
*/
- FontId FindDefaultFont( Character charcode );
+ FontId GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+ FaceIndex faceIndex = 0 );
+
+ ////////////////////////////////////////
+ // Font metrics, glyphs and bitmaps.
+ ////////////////////////////////////////
/**
* @brief Query the metrics for a font.
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
+#define __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+/**
+ * @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
+
+#endif // __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
*/
// INTERNAL INCLUDES
-#include <dali/public-api/text-abstraction/text-abstraction.h>
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
*/
// INTERNAL INCLUDES
-#include <dali/public-api/text-abstraction/text-abstraction.h>
+#include <dali/public-api/text-abstraction/script.h>
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
namespace TextAbstraction
{
+struct GlyphInfo;
+
namespace Internal DALI_INTERNAL
{
public:
/**
- * @brief Create an uninitialized TextAbstraction handle.
+ * @brief Create an uninitialized Shaping handle.
*
*/
Shaping();
/**
* @brief Retrieve a handle to the Shaping instance.
*
- * @return A handle to the Shaping
+ * @return A handle to the Shaping.
*/
static Shaping Get();
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
*
*/
-#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+#include <dali/public-api/text-abstraction/bidirectional-support.h>
#include <dali/public-api/text-abstraction/font-client.h>
#include <dali/public-api/text-abstraction/font-metrics.h>
#include <dali/public-api/text-abstraction/glyph-info.h>
-#include <dali/public-api/text-abstraction/bidirectional-support.h>
+#include <dali/public-api/text-abstraction/script.h>
#include <dali/public-api/text-abstraction/segmentation.h>
#include <dali/public-api/text-abstraction/shaping.h>
# Add local source files here
text_abstraction_src_files = \
+ $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/font-client.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/font-list.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/font-metrics.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/glyph-info.cpp \
- $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/segmentation.cpp \
$(text_src_dir)/dali/public-api/text-abstraction/shaping.cpp \
- $(text_src_dir)/dali/internal/text-abstraction/font-client-impl.cpp \
$(text_src_dir)/dali/internal/text-abstraction/bidirectional-support-impl.cpp \
+ $(text_src_dir)/dali/internal/text-abstraction/font-client-impl.cpp \
$(text_src_dir)/dali/internal/text-abstraction/segmentation-impl.cpp \
$(text_src_dir)/dali/internal/text-abstraction/shaping-impl.cpp
text_abstraction_header_files = \
+ $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.h \
$(text_src_dir)/dali/public-api/text-abstraction/font-client.h \
$(text_src_dir)/dali/public-api/text-abstraction/font-list.h \
$(text_src_dir)/dali/public-api/text-abstraction/font-metrics.h \
$(text_src_dir)/dali/public-api/text-abstraction/glyph-info.h \
- $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.h \
+ $(text_src_dir)/dali/public-api/text-abstraction/script.h \
$(text_src_dir)/dali/public-api/text-abstraction/segmentation.h \
$(text_src_dir)/dali/public-api/text-abstraction/shaping.h \
$(text_src_dir)/dali/public-api/text-abstraction/text-abstraction.h \