53 byte data[2] = { c, 0x00 };
83 std::map<uint32, Char>::const_iterator cC =
_chars.find(c);
90 return cC->second.width +
_spaceR;
107 glVertex2f(0.0f , 0.0f);
108 glVertex2f(width, 0.0f);
113 glTranslatef(width +
_spaceR, 0.0f, 0.0f);
117 std::map<uint32, Char>::const_iterator cC =
_chars.find(c);
127 for (
int i = 0; i < 4; i++) {
128 glTexCoord2f(cC->second.tX[i], cC->second.tY[i]);
129 glVertex2f (cC->second.vX[i], cC->second.vY[i]);
133 glTranslatef(cC->second.width +
_spaceR, 0.0f, 0.0f);
154 std::map<uint32, Char>::const_iterator cC =
_chars.find(c);
165 for (
int i = 0; i < 4; ++i) {
166 v_uv[i*2] = cC->second.tX[i];
167 v_uv[i*2 +1] = cC->second.tY[i];
168 v_pos[i*3] = x + cC->second.vX[i];
169 v_pos[i*3 +1] = y + cC->second.vY[i];
170 v_pos[i*3 +2] = 0.0f;
171 v_rgba[i*4] = rgba[0];
172 v_rgba[i*4 +1] = rgba[1];
173 v_rgba[i*4 +2] = rgba[2];
174 v_rgba[i*4 +3] = rgba[3];
177 x += cC->second.width +
_spaceR;
203 if ((uls.size() < charCount) || (lrs.size() < charCount))
209 double textureRatio = ((double) texture.
getWidth()) / ((
double) texture.
getHeight());
219 for (
uint32 i = 0; i < charCount; i++) {
223 std::pair<std::map<uint32, Char>::iterator,
bool> result;
231 Char &c = result.first->second;
234 c.
tX[0] = ul.
x; c.
tY[0] = lr.
y;
235 c.
tX[1] = lr.
x; c.
tY[1] = lr.
y;
236 c.
tX[2] = lr.
x; c.
tY[2] = ul.
y;
237 c.
tX[3] = ul.
x; c.
tY[3] = ul.
y;
239 double height =
ABS(lr.
y - ul.
y);
240 double width =
ABS(lr.
x - ul.
x);
241 double ratio = ((height != 0.0f) ? (width / height) : 0.0f) * textureRatio;
244 c.
vX[0] = 0.00f; c.
vY[0] = 0.00f;
void render(float *pos, float *uv, float *rgba)
Dynamic data prior to render call.
const TXI & getTXI() const
Return the TXI.
Texture & getTexture() const
A class holding an UTF-8 string.
#define TextureMan
Shortcut for accessing the texture manager.
VertexBuffer * getVertexBuffer()
#define SurfaceMan
Shortcut for accessing the shader manager.
void * getVariableData(uint32 index) const
std::vector< Coords > upperLeftCoords
The Aurora texture manager.
static uint32 convertToUTF32(byte c, Common::Encoding encoding)
virtual void renderUnbind() const
ShaderSurface * getSurface()
virtual void render(uint32 c, float &x, float &y, float *rgba) const
Shader::ShaderRenderable * _renderable
void bindProgram(Shader::ShaderProgram *program)
float getHeight() const
Return the height of a character.
Basic exceptions to throw.
Graphics::Aurora::TextureHandle handle
Utility templates and functions.
Types and functions related to language.
float getWidth(uint32 c) const
Return the width of a character.
Utility functions for working with differing string encodings.
bool empty() const
Is the string empty?
The global shader surface manager.
Low-level type definitions to handle fixed width types portably.
ShaderProgram * getProgram()
std::vector< Coords > lowerRightCoords
Shader::ShaderMaterial * _material
void bindProgram(Shader::ShaderProgram *program)
void renderBind()
Follows the steps of renderImmediate, but broken into different functions.
#define MeshMan
Shortcut for accessing the shader manager.
Plain, unextended ASCII (7bit clean).
Shader sampler is used to bind a texture to a texture unit.
#define LangMan
Shortcut for accessing the language manager.
A texture as used in the Aurora engines.
#define ShaderMan
Shortcut for accessing the shader manager.
UString readString(SeekableReadStream &stream, Encoding encoding)
Read a string with the given encoding of a stream.
float getLineSpacing() const
Return the size of space between lines.
const Features & getFeatures() const
A texture font, as used by NWN and KotOR/KotOR2.
bool isValidCodepoint(Encoding encoding, uint32 cp)
Return whether the given codepoint is valid in this encoding.
virtual void renderBind(const glm::mat4 &transform) const
Bind the font for rendering.
std::map< uint32, Char > _chars
TextureFont(const Common::UString &name)
void draw(uint32 c) const
Draw this character.