X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fglyph-metrics-helper.h;h=dac57f02aeb12953ea409de593e6038113c805fe;hp=2c2c848400f5653b845c2ba8bf255d7c34b13107;hb=7956f5a39044145c9f6af24fa6d291a9943800cf;hpb=726e147d14bb18ef193b102a36d8068b62db89ed diff --git a/dali-toolkit/internal/text/glyph-metrics-helper.h b/dali-toolkit/internal/text/glyph-metrics-helper.h index 2c2c848..dac57f0 100644 --- a/dali-toolkit/internal/text/glyph-metrics-helper.h +++ b/dali-toolkit/internal/text/glyph-metrics-helper.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H__ -#define __DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H__ +#ifndef DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H +#define DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -23,13 +23,10 @@ namespace Dali { - namespace Toolkit { - namespace Text { - /** * @brief Some characters can be shaped in more than one glyph. * This struct is used to retrieve metrics from these group of glyphs. @@ -37,23 +34,25 @@ namespace Text struct GlyphMetrics { GlyphMetrics() - : fontId( 0u ), - fontHeight( 0.f ), - width( 0.f ), - advance( 0.f ), - ascender( 0.f ), - xBearing( 0.f ) - {} + : fontId(0u), + fontHeight(0.f), + width(0.f), + advance(0.f), + ascender(0.f), + xBearing(0.f) + { + } ~GlyphMetrics() - {} + { + } FontId fontId; ///< The font id of the glyphs. float fontHeight; ///< The font's height of those glyphs. - float width; ///< The sum of all the widths of all the glyphs. + float width; ///< The width of the group. float advance; ///< The sum of all the advances of all the glyphs. float ascender; ///< The font's ascender. - float xBearing; ///< The x bearing of the first glyph. + float xBearing; ///< The x bearing of the group. }; /** @@ -65,9 +64,9 @@ struct GlyphMetrics * * @return The number of glyphs of the group. */ -Length GetNumberOfGlyphsOfGroup( GlyphIndex glyphIndex, - GlyphIndex lastGlyphPlusOne, - const Length* const charactersPerGlyphBuffer ); +Length GetNumberOfGlyphsOfGroup(GlyphIndex glyphIndex, + GlyphIndex lastGlyphPlusOne, + const Length* const charactersPerGlyphBuffer); /** * @brief Get some glyph's metrics of a group of glyphs formed as a result of shaping one character. @@ -78,11 +77,33 @@ Length GetNumberOfGlyphsOfGroup( GlyphIndex glyphIndex, * @param[in] glyphsBuffer The glyphs buffer. * @param[in] metrics Used to access metrics from FontClient. */ -void GetGlyphsMetrics( GlyphIndex glyphIndex, - Length numberOfGlyphs, - GlyphMetrics& glyphMetrics, - const GlyphInfo* const glyphsBuffer, - MetricsPtr& metrics ); +void GetGlyphsMetrics(GlyphIndex glyphIndex, + Length numberOfGlyphs, + GlyphMetrics& glyphMetrics, + const GlyphInfo* const glyphsBuffer, + MetricsPtr& metrics); + +/** + * @brief Takes the character index, obtains the glyph index (and the number of Glyphs) from it and finally gets the glyph metrics. + * + * @param[in] index The character index. + * @param[in] glyphInfoBuffer The glyphs buffer. + * @param[in] charactersToGlyphBuffer A vector containing the glyph index for each character. + * @param[in] glyphsPerCharacterBuffer A vector containing the number of glyphs in each character. + * @param[in] metrics Used to access metrics from FontClient. + * @param[out] glyphMetrics Some glyph metrics (font height, advance, ascender and x bearing). + * @param[out] glyphIndex The glyph index obtained from the character index. + * @param[out] numberOfGlyphs The number of glyphs in the character of which the index was passed to the function. + * + */ +void GetGlyphMetricsFromCharacterIndex(CharacterIndex index, + const GlyphInfo* const glyphInfoBuffer, + const GlyphIndex* const charactersToGlyphBuffer, + const Length* const glyphsPerCharacterBuffer, + MetricsPtr& metrics, + GlyphMetrics& glyphMetrics, + GlyphIndex& glyphIndex, + Length& numberOfGlyphs); } // namespace Text @@ -90,4 +111,4 @@ void GetGlyphsMetrics( GlyphIndex glyphIndex, } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H__ +#endif // DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H