Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5757 → Rev 5756

/programs/cmm/lib/font.h
13,7 → 13,6
{
word width,height;
signed offset_x,offset_y;
float offset_i,w_italic;
byte text;
byte TMP_WEIGHT;
};
20,7 → 19,7
:struct FONT
{
__SIZE size;
byte width,height,offsetLine,r,g,b,weight,italic;
byte width,height,offsetLine,r,g,b,weight;
dword color;
dword file_size;
dword buffer;
33,12 → 32,10
byte symbol(word x;byte s;dword c);
byte symbol_size(byte s);
dword text(word x,y;dword text1);
byte textcenter(word x,y,w,h;dword txt);
dword getsize(dword text1);
dword textarea(word x,y;dword text,c);
byte changeSIZE();
void PixelRGB(word x,y);
dword GetPixel(word x,y);
dword tmp_y,tmp_height,tmp_x;
byte no_bg_copy;
dword bg_color;
45,18 → 42,6
};
FONT font = 0;
 
:dword FONT::GetPixel(word x,y)
{
dword tmp;
tmp = y*size.width*3;
tmp += x*3;
tmp += buffer;
r = DSBYTE[tmp];
tmp++;
g = DSBYTE[tmp];
tmp++;
b = DSBYTE[tmp];
}
:void FONT::PixelRGB(dword x,y)
{
dword tmp;
95,15 → 80,7
return true;
}
:proc_info Form_SELF_FONTS;
:byte FONT::textcenter(word x,y,w,h;dword txt)
{
getsize(txt);
EDX = w/2;
ECX = size.width/2;
EDX -= ECX;
x += EDX;
return text(x,y,txt);
}
 
:dword FONT::getsize(dword text1)
{
size.height = size.width = 0;
120,13 → 97,6
size.height += size.offset_y;
size.width += size.offset_x;
size.width++;
IF(italic)
{
size.w_italic = -size.height/3;
size.offset_i = -size.w_italic/size.height;
size.offset_x+=size.w_italic;
size.width += math.ceil(size.w_italic+4);
}
return size.width;
}
:byte FONT::symbol_size(byte s)
227,7 → 197,7
}
}
ELSE CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),size.width,size.height);
len = size.offset_x;
 
WHILE(DSBYTE[text1])
{
IF(DSBYTE[text1]=='_') len--;
248,11 → 218,11
dword xi,yi;
dword tmp,_;
dword iii;
float ital = -size.w_italic;
dword ___x;
word TMP;
byte _TMP_WEIGHT;
byte rw=0;
x += size.offset_x;
IF(s==32)return width/4;
IF(s==9)return width;
yi = 0;
275,8 → 245,7
{
IF(xi>rw)rw=xi;
___x = x+xi;
IF(italic)___x+=math.ceil(ital);
if(___x<Form_SELF_FONTS.cwidth)&&(tmp_y+yi<Form_SELF_FONTS.cheight)
IF(___x<Form_SELF_FONTS.cwidth)&&(tmp_y+yi<Form_SELF_FONTS.cheight)
{
PixelRGB(___x,TMP);
_TMP_WEIGHT = size.TMP_WEIGHT;
291,7 → 260,6
iii++;
}
yi++;
IF(italic) ital-=size.offset_i;
}
return rw;
}
300,13 → 268,15
dword tmp;
buffer_size = 0;
IF(data)free(data);
if (!io.read(path))
if (!io.readKPACK(path))
{
debug("Error while loading font: ");
debugln(path);
return false;
}
begin = tmp = data = io.buffer_data;
data = io.buffer_data;
tmp = data;
begin = data;
size_file = io.FILES_SIZE;
tmp +=size_file;
tmp--;