Added support for a new 'Text font' in the menu, with big_t, large_t, medium_t and small_t ids/sizes for the menu XML files ; associated to data/data/fonts/liberation-sans-normal.glf which is a copy of data/data/fonts/liberation-sans-bold.glf for the moment ; your's Eckhard, for making it really 'normal' ;-) ; used it in the credits menu to show it works

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3850 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d6f220dcebb0f9378a05934076196c75b2566b9b
Former-commit-id: 3ea556bca21bde2c136bbd74353288cbe03f15e5
This commit is contained in:
pouillot 2011-08-31 21:11:41 +00:00
parent 08ee94bc23
commit 71dea300f5
4 changed files with 37 additions and 12 deletions

View file

@ -66,30 +66,36 @@ void gfuiLoadFonts(void)
void *param;
int size;
int i;
int nFontId = 0;
sprintf(buf, "%s%s", GfLocalDir(), GFSCR_CONF_FILE);
param = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
sprintf(buf, "data/fonts/%s", GfParmGetStr(param, "Menu Font", "name", "b5.glf"));
for(i = 0; i < 4; i++) {
for(i = 0; i < 4; i++, nFontId++) {
size = (int)GfParmGetNum(param, "Menu Font", keySize[i], (char*)NULL, 10.0);
gfuiFont[i] = new GfuiFontClass(buf);
gfuiFont[i]->create(size);
gfuiFont[nFontId] = new GfuiFontClass(buf);
gfuiFont[nFontId]->create(size);
}
sprintf(buf, "data/fonts/%s", GfParmGetStr(param, "Text Font", "name", "b6.glf"));
for(i = 0; i < 4; i++, nFontId++) {
size = (int)GfParmGetNum(param, "Text Font", keySize[i], (char*)NULL, 10.0);
gfuiFont[nFontId] = new GfuiFontClass(buf);
gfuiFont[nFontId]->create(size);
}
sprintf(buf, "data/fonts/%s", GfParmGetStr(param, "Console Font", "name", "b7.glf"));
for(i = 0; i < 4; i++) {
for(i = 0; i < 4; i++, nFontId++) {
size = (int)GfParmGetNum(param, "Console Font", keySize[i], (char*)NULL, 10.0);
gfuiFont[i+4] = new GfuiFontClass(buf);
gfuiFont[i+4]->create(size);
gfuiFont[nFontId] = new GfuiFontClass(buf);
gfuiFont[nFontId]->create(size);
}
sprintf(buf, "data/fonts/%s", GfParmGetStr(param, "Digital Font", "name", "digital.glf"));
size = (int)GfParmGetNum(param, "Digital Font", keySize[0], (char*)NULL, 8.0);
gfuiFont[8] = new GfuiFontClass(buf);
gfuiFont[8]->create(size);
gfuiFont[nFontId] = new GfuiFontClass(buf);
gfuiFont[nFontId]->create(size);
GfParmReleaseHandle(param);
}

View file

@ -100,6 +100,11 @@ static const TMapFontSize::value_type AMapFontSize[] =
TMapFontSize::value_type("medium_c", GFUI_FONT_MEDIUM_C),
TMapFontSize::value_type("small_c", GFUI_FONT_SMALL_C),
TMapFontSize::value_type("big_t", GFUI_FONT_BIG_T),
TMapFontSize::value_type("large_t", GFUI_FONT_LARGE_T),
TMapFontSize::value_type("medium_t", GFUI_FONT_MEDIUM_T),
TMapFontSize::value_type("small_t", GFUI_FONT_SMALL_T),
TMapFontSize::value_type("digit", GFUI_FONT_DIGIT),
};

View file

@ -16,7 +16,7 @@
<!DOCTYPE params SYSTEM "../tgf/params.dtd">
<params name="Screen" version="1.7">
<params name="Screen" version="1.8">
<section name="Validated Screen Properties">
@ -41,6 +41,16 @@
</section>
<section name="Text Font">
<attstr name="name" val="liberation-sans-normal.glf"/>
<attnum name="size big" val="320"/>
<attnum name="size large" val="230"/>
<attnum name="size medium" val="175"/>
<attnum name="size small" val="150"/>
</section>
<section name="Console Font">
<attstr name="name" val="b7.glf"/>

View file

@ -404,7 +404,11 @@ TGFCLIENT_API void GfuiUnSelectCurrent(void);
#define GFUI_FONT_LARGE_C 5
#define GFUI_FONT_MEDIUM_C 6
#define GFUI_FONT_SMALL_C 7
#define GFUI_FONT_DIGIT 8
#define GFUI_FONT_BIG_T 8
#define GFUI_FONT_LARGE_T 9
#define GFUI_FONT_MEDIUM_T 10
#define GFUI_FONT_SMALL_T 11
#define GFUI_FONT_DIGIT 12
TGFCLIENT_API int GfuiFontHeight(int font);
TGFCLIENT_API int GfuiFontWidth(int font, const char* text);