mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r25696) -Fix (r25651): Missing function in the non-ICU paragraph layouter.
This commit is contained in:
parent
2770a24f9f
commit
bd02761b55
|
@ -157,6 +157,7 @@ ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_c
|
||||||
font(font), glyph_count(char_count)
|
font(font), glyph_count(char_count)
|
||||||
{
|
{
|
||||||
this->glyphs = MallocT<GlyphID>(this->glyph_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. */
|
/* 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);
|
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->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 + 2] = this->positions[2 * i] + font->fc->GetGlyphWidth(this->glyphs[i]);
|
||||||
this->positions[2 * i + 3] = 0;
|
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()
|
ParagraphLayout::VisualRun::~VisualRun()
|
||||||
{
|
{
|
||||||
free(this->positions);
|
free(this->positions);
|
||||||
|
free(this->glyph_to_char);
|
||||||
free(this->glyphs);
|
free(this->glyphs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +216,15 @@ float *ParagraphLayout::VisualRun::getPositions() const
|
||||||
return this->positions;
|
return this->positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Get the height of this font.
|
||||||
* @return The height of the font.
|
* @return The height of the font.
|
||||||
|
|
|
@ -125,6 +125,7 @@ public:
|
||||||
Font *font; ///< The font used to layout these.
|
Font *font; ///< The font used to layout these.
|
||||||
GlyphID *glyphs; ///< The glyphs we're drawing.
|
GlyphID *glyphs; ///< The glyphs we're drawing.
|
||||||
float *positions; ///< The positions of the glyphs.
|
float *positions; ///< The positions of the glyphs.
|
||||||
|
int *glyph_to_char; ///< The char index of the glyphs.
|
||||||
int glyph_count; ///< The number of glyphs.
|
int glyph_count; ///< The number of glyphs.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -135,6 +136,7 @@ public:
|
||||||
const GlyphID *getGlyphs() const;
|
const GlyphID *getGlyphs() const;
|
||||||
float *getPositions() const;
|
float *getPositions() const;
|
||||||
int getLeading() const;
|
int getLeading() const;
|
||||||
|
const int *getGlyphToCharMap() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A single line worth of VisualRuns. */
|
/** A single line worth of VisualRuns. */
|
||||||
|
|
Loading…
Reference in New Issue