[Fix] Font width issues..
This commit is contained in:
parent
e09c9ad071
commit
74b7a22b6e
@ -279,6 +279,7 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base,
|
|||||||
GLubyte* expanded_data;
|
GLubyte* expanded_data;
|
||||||
int w, h;
|
int w, h;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
if(FT_Load_Glyph(face, FT_Get_Char_Index(face, ch), FT_LOAD_FORCE_AUTOHINT))
|
if(FT_Load_Glyph(face, FT_Get_Char_Index(face, ch), FT_LOAD_FORCE_AUTOHINT))
|
||||||
WARN("FT_Load_Glyph failed");
|
WARN("FT_Load_Glyph failed");
|
||||||
@ -324,11 +325,8 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base,
|
|||||||
glTranslated(bitmap_glyph->left, bitmap_glyph->top-bitmap.rows, 0);
|
glTranslated(bitmap_glyph->left, bitmap_glyph->top-bitmap.rows, 0);
|
||||||
|
|
||||||
// Take the opengl POT wrapping into account.
|
// Take the opengl POT wrapping into account.
|
||||||
double x = (double)bitmap.width/(double)w;
|
x = (double)bitmap.width/(double)w;
|
||||||
double y = (double)bitmap.rows/(double)h;
|
y = (double)bitmap.rows/(double)h;
|
||||||
|
|
||||||
// Give the width a value.
|
|
||||||
width_base[(int)ch] = bitmap.width;
|
|
||||||
|
|
||||||
// Draw the texture mapped quad.
|
// Draw the texture mapped quad.
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
||||||
@ -345,6 +343,7 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base,
|
|||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glTranslated(face->glyph->advance.x >> 6, 0,0);
|
glTranslated(face->glyph->advance.x >> 6, 0,0);
|
||||||
|
width_base[(int)ch] = (int)(face->glyph->advance.x >> 6);
|
||||||
|
|
||||||
// End of the display list.
|
// End of the display list.
|
||||||
glEndList();
|
glEndList();
|
||||||
|
12
src/land.c
12
src/land.c
@ -97,8 +97,8 @@ static void commodity_exchange(void) {
|
|||||||
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH/2, 20, 0,
|
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH/2, 20, 0,
|
||||||
"txtDInfo", &gl_smallFont, &cBlack, NULL);
|
"txtDInfo", &gl_smallFont, &cBlack, NULL);
|
||||||
|
|
||||||
window_addText(secondary_wid, -40, -80, BUTTON_WIDTH-20, 60, 0,
|
window_addText(secondary_wid, -40, -80, BUTTON_WIDTH-20,
|
||||||
"txtDesc", &gl_smallFont, &cBlack, NULL);
|
BUTTON_WIDTH, 0, "txtDesc", &gl_smallFont, &cBlack, NULL);
|
||||||
|
|
||||||
goods = malloc(sizeof(char*)*planet->ncommodities);
|
goods = malloc(sizeof(char*)*planet->ncommodities);
|
||||||
for(i = 0; i < planet->ncommodities; i++)
|
for(i = 0; i < planet->ncommodities; i++)
|
||||||
@ -219,7 +219,7 @@ static void outfits(void) {
|
|||||||
250, 96, 0, "txtDDesc", &gl_smallFont, &cBlack, NULL);
|
250, 96, 0, "txtDDesc", &gl_smallFont, &cBlack, NULL);
|
||||||
|
|
||||||
window_addText(secondary_wid, 20+200+40, -200,
|
window_addText(secondary_wid, 20+200+40, -200,
|
||||||
OUTFITS_WIDTH-360, 200, 0, "txtDescription",
|
OUTFITS_WIDTH-300, 200, 0, "txtDescription",
|
||||||
&gl_smallFont, NULL, NULL);
|
&gl_smallFont, NULL, NULL);
|
||||||
|
|
||||||
// Set up the outfits to buy/sell.
|
// Set up the outfits to buy/sell.
|
||||||
@ -401,7 +401,7 @@ static void shipyard(void) {
|
|||||||
|
|
||||||
|
|
||||||
window_addText(secondary_wid, 20+200+40, -160,
|
window_addText(secondary_wid, 20+200+40, -160,
|
||||||
SHIPYARD_WIDTH-360, 200, 0, "txtDescription",
|
SHIPYARD_WIDTH-300, 200, 0, "txtDescription",
|
||||||
&gl_smallFont, NULL, NULL);
|
&gl_smallFont, NULL, NULL);
|
||||||
|
|
||||||
// Setup the ships to buy/sell.
|
// Setup the ships to buy/sell.
|
||||||
@ -474,7 +474,7 @@ static void spaceport_bar(void) {
|
|||||||
secondary_wid = window_create("SpacePort Bar", -1, -1, BAR_WIDTH, BAR_HEIGHT);
|
secondary_wid = window_create("SpacePort Bar", -1, -1, BAR_WIDTH, BAR_HEIGHT);
|
||||||
|
|
||||||
window_addText(secondary_wid, 20, -30,
|
window_addText(secondary_wid, 20, -30,
|
||||||
BAR_WIDTH-140, BAR_HEIGHT - 40 - BUTTON_HEIGHT, 0,
|
BAR_WIDTH-40, BAR_HEIGHT - 40 - BUTTON_HEIGHT, 0,
|
||||||
"txtDescription", &gl_smallFont, &cBlack, planet->bar_description);
|
"txtDescription", &gl_smallFont, &cBlack, planet->bar_description);
|
||||||
|
|
||||||
window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
@ -524,7 +524,7 @@ void land(Planet* p) {
|
|||||||
|
|
||||||
// Pretty display.
|
// Pretty display.
|
||||||
window_addImage(land_wid, 20, -40, "imgPlanet", p->gfx_exterior);
|
window_addImage(land_wid, 20, -40, "imgPlanet", p->gfx_exterior);
|
||||||
window_addText(land_wid, 440, 80, 200, 460, 0,
|
window_addText(land_wid, 440, 80, LAND_WIDTH-460, 460, 0,
|
||||||
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
||||||
// Buttons.
|
// Buttons.
|
||||||
window_addButton(land_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
window_addButton(land_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
#define MAIN_WIDTH 120
|
#define MAIN_WIDTH 130
|
||||||
#define MAIN_HEIGHT 250
|
#define MAIN_HEIGHT 250
|
||||||
|
|
||||||
#define MENU_WIDTH 120
|
#define MENU_WIDTH 130
|
||||||
#define MENU_HEIGHT 200
|
#define MENU_HEIGHT 200
|
||||||
|
|
||||||
#define INFO_WIDTH 320
|
#define INFO_WIDTH 320
|
||||||
@ -22,10 +22,10 @@
|
|||||||
#define OUTFITS_WIDTH 400
|
#define OUTFITS_WIDTH 400
|
||||||
#define OUTFITS_HEIGHT 200
|
#define OUTFITS_HEIGHT 200
|
||||||
|
|
||||||
#define DEATH_WIDTH 120
|
#define DEATH_WIDTH 130
|
||||||
#define DEATH_HEIGHT 150
|
#define DEATH_HEIGHT 150
|
||||||
|
|
||||||
#define BUTTON_WIDTH 80
|
#define BUTTON_WIDTH 90
|
||||||
#define BUTTON_HEIGHT 30
|
#define BUTTON_HEIGHT 30
|
||||||
|
|
||||||
#define menu_Open(f) (menu_open |= (f))
|
#define menu_Open(f) (menu_open |= (f))
|
||||||
|
@ -542,7 +542,7 @@ void player_render(void) {
|
|||||||
credits2str(str, player_credits, 2);
|
credits2str(str, player_credits, 2);
|
||||||
|
|
||||||
i = gl_printWidth(&gl_smallFont, str);
|
i = gl_printWidth(&gl_smallFont, str);
|
||||||
gl_print(&gl_smallFont, gui.misc.x + gui.misc.w - 15 - i, j,
|
gl_print(&gl_smallFont, gui.misc.x + gui.misc.w - 8 - i, j,
|
||||||
NULL, str);
|
NULL, str);
|
||||||
|
|
||||||
// Cargo and co.
|
// Cargo and co.
|
||||||
|
Loading…
Reference in New Issue
Block a user