Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-07-07 12:15:19 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:19:43 +0300
commit28f41f6d8e7d9613e58deb87bdbdbf9cddc988f3 (patch)
tree3901b90b85e1f1b2e6ae940c99a5edb849539bc7 /drape/font_texture.hpp
parent68aa14d25318266a09cf9cc521f16c460181cfba (diff)
[drape] resource based font loading and usage
Diffstat (limited to 'drape/font_texture.hpp')
-rw-r--r--drape/font_texture.hpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp
new file mode 100644
index 0000000000..9edb92fc68
--- /dev/null
+++ b/drape/font_texture.hpp
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "pointers.hpp"
+#include "texture.hpp"
+
+#include "../std/map.hpp"
+#include "../std/vector.hpp"
+#include "../std/string.hpp"
+
+class FontTexture : public Texture
+{
+public:
+ class GlyphKey : public Key
+ {
+ public:
+ GlyphKey(int32_t unicode) : m_unicode(unicode) {}
+
+ ResourceType GetType() const { return Texture::Glyph; }
+ int32_t GetUnicodePoint() const { return m_unicode; }
+
+ private:
+ int32_t m_unicode;
+ };
+
+ class GlyphInfo : public ResourceInfo
+ {
+ public:
+ GlyphInfo(m2::RectF const & texRect, float xOffset,
+ float yOffset, float advance);
+
+ virtual ResourceType GetType() const { return Texture::Glyph; }
+ void GetMetrics(float & xOffset, float & yOffset, float & advance) const;
+
+ private:
+ float m_xOffset, m_yOffset;
+ float m_advance;
+ };
+
+public:
+ ResourceInfo const * FindResource(Key const & key) const;
+
+ void Add(int unicodePoint, GlyphInfo const & glyphInfo);
+
+private:
+ typedef map<int, GlyphInfo> glyph_map_t;
+ glyph_map_t m_glyphs;
+};
+
+void LoadFont(string const & resourcePrefix, vector<TransferPointer<Texture> > & textures);