Chameleon

Chameleon Commit Details

Date:2011-12-11 17:14:49 (12 years 4 months ago)
Author:JrCs
Commit:1719
Parents: 1718
Message:Fix the vertical centering of text
Changes:
M/trunk/i386/boot2/gui.c

File differences

trunk/i386/boot2/gui.c
13651365
13661366
13671367
1368
13681369
13691370
13701371
13711372
1373
13721374
1375
1376
13731377
13741378
13751379
......
13831387
13841388
13851389
1386
1390
13871391
1388
1389
1390
13911392
13921393
13931394
int i = 0;
int width = 0;
int max_width = 0;
int height = font->height;
// calculate the width in pixels
for (i=0; i < strlen(text); i++) {
if (text[i] == '\n')
{
width = 0;
height += font->height;
}
else if (text[i] == '\t')
width += TAB_PIXELS_WIDTH;
else
}
p.x = ( p.x - ( max_width / 2 ) );
p.y = ( p.y - ( font->height / 2 ) );
p.y = ( p.y - ( height / 2 ) );
if ( p.x == -6 )
p.x = 0;
drawStr(text, font, blendInto, p);
}

Archive Download the corresponding diff file

Revision: 1719