summaryrefslogtreecommitdiff
path: root/src/gfx_layout.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-06 17:35:11 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-06 17:35:11 +0000
commitbd02761b554cf9b5ddbca05f75aba7dcc4ecb4e5 (patch)
treeccdce16bbd7a0e297a6cfcc6093994ae9671d5dc /src/gfx_layout.cpp
parent2770a24f9f662c702ed6f3b469950d0e65d8423a (diff)
downloadopenttd-bd02761b554cf9b5ddbca05f75aba7dcc4ecb4e5.tar.xz
(svn r25696) -Fix (r25651): Missing function in the non-ICU paragraph layouter.
Diffstat (limited to 'src/gfx_layout.cpp')
-rw-r--r--src/gfx_layout.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index bcd5add36..8f18ff1be 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -157,6 +157,7 @@ ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_c
font(font), glyph_count(char_count)
{
this->glyphs = MallocT<GlyphID>(this->glyph_count);
+ this->glyph_to_char = MallocT<int>(this->glyph_count);
/* Positions contains the location of the begin of each of the glyphs, and the end of the last one. */
this->positions = MallocT<float>(this->glyph_count * 2 + 2);
@@ -167,6 +168,7 @@ ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_c
this->glyphs[i] = font->fc->MapCharToGlyph(chars[i]);
this->positions[2 * i + 2] = this->positions[2 * i] + font->fc->GetGlyphWidth(this->glyphs[i]);
this->positions[2 * i + 3] = 0;
+ this->glyph_to_char[i] = i;
}
}
@@ -174,6 +176,7 @@ ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_c
ParagraphLayout::VisualRun::~VisualRun()
{
free(this->positions);
+ free(this->glyph_to_char);
free(this->glyphs);
}
@@ -214,6 +217,15 @@ float *ParagraphLayout::VisualRun::getPositions() const
}
/**
+ * Get the glyph-to-character map for this visual run.
+ * @return The glyph-to-character map.
+ */
+const int *ParagraphLayout::VisualRun::getGlyphToCharMap() const
+{
+ return this->glyph_to_char;
+}
+
+/**
* Get the height of this font.
* @return The height of the font.
*/