I had to ask some things to make some word-processing easier/faster. Feel free to adjust anything that's crooked.

This was SVN commit r1395.
This commit is contained in:
Gee 2004-11-24 23:47:48 +00:00
parent 0adc8f6ca2
commit caff02e8da
5 changed files with 23 additions and 3 deletions

View File

@ -137,7 +137,7 @@ struct HDATA
// which the index can't currently handle)
H_Type type;
const char* fn;
u8 user[HDATA_USER_SIZE];

View File

@ -1,5 +1,5 @@
/*
$Id: unifont.cpp,v 1.19 2004/10/14 10:09:51 gee Exp $
$Id: unifont.cpp,v 1.20 2004/11/24 23:47:48 gee Exp $
Unicode OpenGL texture font
@ -210,6 +210,17 @@ int unifont_height(const Handle h)
return f->Height;
}
int unifont_character_width(const Handle h, const wchar_t& c)
{
H_DEREF(h, UniFont, f);
glyphmap_size::iterator it = f->glyphs_size->find(c);
if (it == f->glyphs_size->end())
it = f->glyphs_size->find(0xFFFD); // Use the missing glyph symbol
return it->second;
}
void glwprintf(const wchar_t* fmt, ...)
{
const int buf_size = 1024;

View File

@ -1,4 +1,4 @@
// $Id: unifont.h,v 1.8 2004/10/14 10:09:51 gee Exp $
// $Id: unifont.h,v 1.9 2004/11/24 23:47:48 gee Exp $
#ifndef __UNIFONT_H__
#define __UNIFONT_H__
@ -40,6 +40,9 @@ int unifont_stringsize(const Handle h, const wchar_t* text, int& width, int& hei
// Get only the height
int unifont_height(const Handle h);
// Get only the width of one character
int unifont_character_width(const Handle h, const wchar_t& c);
// Return spacing in pixels from one line of text to the next
int unifont_linespacing(const Handle h);

View File

@ -72,6 +72,11 @@ int CFont::GetHeight()
return unifont_height(h);
}
int CFont::GetCharacterWidth(const wchar_t& c)
{
return unifont_character_width(h, c);
}
void CFont::CalculateStringSize(const CStrW& string, int& width, int& height)
{
unifont_stringsize(h, (const wchar_t*)string, width, height);

View File

@ -30,6 +30,7 @@ public:
void Bind();
int GetLineSpacing();
int GetHeight();
int GetCharacterWidth(const wchar_t& c);
void CalculateStringSize(const CStrW& string, int& w, int& h);
private: