#pragma once #include "common_structures.hpp" #include "shape_view_params.hpp" #include "intrusive_vector.hpp" #include "../drape/pointers.hpp" #include "../drape/texture_set_holder.hpp" #include "../drape/overlay_handle.hpp" #include "../geometry/spline.hpp" #include "../base/string_utils.hpp" #include "../base/buffer_vector.hpp" #include "../std/vector.hpp" #include "../std/shared_ptr.hpp" namespace df { class TextLayout { typedef dp::TextureSetHolder::GlyphRegion GlyphRegion; public: TextLayout(strings::UniString const & string, df::FontDecl const & font, dp::RefPointer textures); void InitPathText(float depth, vector & texCoord, vector & fontColor, vector & outlineColor) const; void LayoutPathText(m2::Spline::iterator const & iterator, float const scalePtoG, IntrusiveVector & positions, bool isForwardDirection, vector & rects, const ScreenBase & screen) const; uint32_t GetGlyphCount() const; uint32_t GetTextureSet() const; float GetPixelLength() const; float GetPixelHeight() const; private: float AccumulateAdvance(double const & currentValue, GlyphRegion const & reg2) const; void InitMetric(strings::UniChar const & unicodePoint, dp::RefPointer textures); void GetTextureQuad(GlyphRegion const & region, float depth, glsl_types::Quad4 & quad) const; void GetMetrics(int32_t const index, float & xOffset, float & yOffset, float & advance, float & halfWidth, float & halfHeight) const; private: buffer_vector m_metrics; df::FontDecl m_font; float m_textSizeRatio; friend dp::OverlayHandle * LayoutText(const FeatureID & featureID, m2::PointF const & pivot, vector::iterator & layoutIter, vector::iterator & pixelOffsetIter, float depth, vector & positions, vector & texCoord, vector & color, vector & index, dp::RefPointer textures, int count); }; class SharedTextLayout { public: SharedTextLayout(TextLayout * layout); bool IsNull() const; void Reset(TextLayout * layout); TextLayout * operator->(); TextLayout const * operator->() const; private: shared_ptr m_layout; }; }