From a6353da2870ec342e158fe1c71d5f371300ad394 Mon Sep 17 00:00:00 2001 From: ExMix Date: Sun, 10 Aug 2014 20:22:36 +0300 Subject: [PATCH] [drape] direct access for glyph advance --- drape/font_texture.cpp | 5 +++++ drape/font_texture.hpp | 1 + drape/texture_set_holder.cpp | 6 ++++++ drape/texture_set_holder.hpp | 1 + 4 files changed, 13 insertions(+) diff --git a/drape/font_texture.cpp b/drape/font_texture.cpp index 1fe1b234eb..d8709aa42c 100644 --- a/drape/font_texture.cpp +++ b/drape/font_texture.cpp @@ -49,6 +49,11 @@ void FontTexture::GlyphInfo::GetMetrics(float & xOffset, float & yOffset, float advance = m_advance; } +float FontTexture::GlyphInfo::GetAdvance() const +{ + return m_advance; +} + //////////////////////////////////////////////////////////////////////// Texture::ResourceInfo const * FontTexture::FindResource(Texture::Key const & key) const diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp index d3750d32da..b467348b56 100644 --- a/drape/font_texture.hpp +++ b/drape/font_texture.hpp @@ -33,6 +33,7 @@ public: virtual ResourceType GetType() const { return Texture::Glyph; } void GetMetrics(float & xOffset, float & yOffset, float & advance) const; + float GetAdvance() const; private: float m_xOffset, m_yOffset; diff --git a/drape/texture_set_holder.cpp b/drape/texture_set_holder.cpp index 3385693db3..b59c1a17e2 100644 --- a/drape/texture_set_holder.cpp +++ b/drape/texture_set_holder.cpp @@ -71,4 +71,10 @@ void TextureSetHolder::GlyphRegion::GetMetrics(float & xOffset, float & yOffset, info->GetMetrics(xOffset, yOffset, advance); } +float TextureSetHolder::GlyphRegion::GetAdvance() const +{ + ASSERT(m_info->GetType() == Texture::Glyph, ()); + return static_cast(m_info)->GetAdvance(); +} + } // namespace dp diff --git a/drape/texture_set_holder.hpp b/drape/texture_set_holder.hpp index c2ec0e0329..b74c3b0be4 100644 --- a/drape/texture_set_holder.hpp +++ b/drape/texture_set_holder.hpp @@ -57,6 +57,7 @@ public: GlyphRegion(); void GetMetrics(float & xOffset, float & yOffset, float & advance) const; + float GetAdvance() const; }; virtual void GetSymbolRegion(string const & symbolName, SymbolRegion & region) const = 0;