forked from KolibriOS/kolibrios
Update lib font
git-svn-id: svn://kolibrios.org@5736 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -4,16 +4,13 @@
|
||||
|
||||
byte id,key;
|
||||
|
||||
FONT TimeNewRoman = 0;
|
||||
FONT Verdana = 0;
|
||||
void main()
|
||||
{
|
||||
|
||||
SetEventMask(1100111b);
|
||||
|
||||
Verdana.load("font/Verdana 15px original");
|
||||
font.load("font/Georgia 45px original");
|
||||
TimeNewRoman.load("font/Times New Roman 30px original");
|
||||
font.load("font/Verdana.kf");
|
||||
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
@@ -43,24 +40,20 @@ void main()
|
||||
}
|
||||
}
|
||||
}
|
||||
char buf[40];
|
||||
void draw_window()
|
||||
{
|
||||
proc_info Form;
|
||||
|
||||
int i =0;
|
||||
int i =8;
|
||||
int ii = 0;
|
||||
DefineAndDrawWindow(215,100,450,500,0x33,0xFFFFFF,"Window header");
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
|
||||
font.text(0,0,"Georgia 45px original",0x5522DD);
|
||||
font.text(3,43,"Ñúåøü åùå ýòèõ ìÿãêèõ ôðàíöóçêèõ áóëîê, äà âûïåé ÷àþ. 1234567890",0xDEDEDE);
|
||||
font.text(0,40,"Ñúåøü åùå ýòèõ ìÿãêèõ ôðàíöóçêèõ áóëîê, äà âûïåé ÷àþ. 1234567890",0x0);
|
||||
|
||||
|
||||
font.text(0,80,"Times New Roman 30px original",0x993366);
|
||||
TimeNewRoman.text(3,113,"Ñúåøü åùå ýòèõ ìÿãêèõ ôðàíöóçêèõ áóëîê, äà âûïåé ÷àþ. 1234567890",0xDEDEDE);
|
||||
TimeNewRoman.text(0,110,"Ñúåøü åùå ýòèõ ìÿãêèõ ôðàíöóçêèõ áóëîê, äà âûïåé ÷àþ. 1234567890",0x0);
|
||||
|
||||
Verdana.textarea(0,150,"Ýòîò ïðèìåð äåìîíñòðèðóåò âîçìîæíîñòè øðèôòà, \rêîòîðûé ñîçäàí ñïåöèàëüíî äëÿ êîëèáðèÎÑ.\r áëèæàéøåå âðåìÿ àêòèâíî äîáàâëÿþòñÿ øðèôòû.\rÐåäàêòèðîâàòü øðèôòû ìîæíî íà ñàéòå: http://font.ga.\rÄëÿ ðåäàêòèðîâàíèÿ øðèôòà, øðèôò äîëæåí áûòü â íåñæàòîì âèäå,\ròàêæå ñîîòâåòñòâîâàòü ñòàíäàðòó!\r ïëàíàõ ñäåëàòü êîìïàêòíûé ôàéë,\rêîòîðûé áóäåò ñîäåðæàòü ðàçíûå ðàçìåðû îäíîãî øðèôòà.\rÎðèãèíàëüíûé ôàéë (ò.å.) íå ñæàòûé ôàéë ìíîãî çàíèìàåò ìåñòà,\rïîýòîìó ðåêîìåíäóþ ñæèìàòü kpack. Øðèôòû íà çàêàç https://vk.com/pavelyakov39\rÏðîðèñîâêà ïîêà ÷òî ìåäëåííàÿ - âðåìåííî.Êîäèðîâêà øðèôòà ANSII.",0x5522DD);
|
||||
Verdana.text(30,350,"À òåïåðü...",0xAA4444);
|
||||
font.text(60,370,"Äî âñòðå÷è!!!",0xDD4444);
|
||||
while(i<=45)
|
||||
{
|
||||
sprintf(#buf,"Ðàçìåð øðèôòà/size font %d ïèêñåëåé.",i);
|
||||
font.text(0,ii,#buf,0,i);
|
||||
ii+=font.height;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+69
-36
@@ -12,18 +12,48 @@
|
||||
:struct FONT
|
||||
{
|
||||
byte width,height,offsetLine;
|
||||
dword file_size;
|
||||
word block;
|
||||
dword data;
|
||||
dword begin;
|
||||
dword size_file;
|
||||
byte load(...);
|
||||
byte symbol(word x,y;byte s;dword c);
|
||||
dword text(word x,y;dword text,c);
|
||||
dword textarea(word x,y;dword text,c);
|
||||
dword text(word x,y;dword text,c;byte size);
|
||||
dword textarea(word x,y;dword text,c;byte size);
|
||||
byte changeSIZE(byte size);
|
||||
};
|
||||
FONT font = 0;
|
||||
:dword FONT::text(word x,y;dword text1,c)
|
||||
:byte FONT::changeSIZE(byte size)
|
||||
{
|
||||
dword TMP_DATA;
|
||||
dword ofs;
|
||||
byte s;
|
||||
IF(size<9) size = 8;
|
||||
IF(size>45)size = 45;
|
||||
s = size-8;
|
||||
data = begin;
|
||||
TMP_DATA = data;
|
||||
TMP_DATA +=s*4;
|
||||
ofs = DSDWORD[TMP_DATA];
|
||||
IF(ofs==-1)return false;
|
||||
data += ofs;
|
||||
data += 156;
|
||||
TMP_DATA = data;
|
||||
file_size = DSDWORD[TMP_DATA];
|
||||
TMP_DATA += file_size;
|
||||
TMP_DATA--;
|
||||
height = DSBYTE[TMP_DATA];
|
||||
TMP_DATA--;
|
||||
width = DSBYTE[TMP_DATA];
|
||||
block = math.ceil(height*width/32);
|
||||
return true;
|
||||
}
|
||||
:dword FONT::text(word x,y;dword text1,c;byte size)
|
||||
{
|
||||
dword len=0;
|
||||
if(size)if(!changeSIZE(size))return 0;
|
||||
|
||||
WHILE(DSBYTE[text1])
|
||||
{
|
||||
len += symbol(x+len,y,DSBYTE[text1],c);
|
||||
@@ -31,9 +61,10 @@ FONT font = 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
:dword FONT::textarea(word x,y;dword text1,c)
|
||||
:dword FONT::textarea(word x,y;dword text1,c;byte size)
|
||||
{
|
||||
dword len=0;
|
||||
if(size)if(!changeSIZE(size))return 0;
|
||||
WHILE(DSBYTE[text1])
|
||||
{
|
||||
IF(DSBYTE[text1]=='\r'){ y+=height; len=0;}
|
||||
@@ -44,38 +75,39 @@ FONT font = 0;
|
||||
}
|
||||
:byte FONT::symbol(signed x,y;byte s;dword c)
|
||||
{
|
||||
dword xi,yi;
|
||||
dword tmp,_;
|
||||
dword iii;
|
||||
byte rw=0;
|
||||
IF(offsetLine)y+=offsetLine;
|
||||
IF(s==32)return width/4;
|
||||
yi = 0;
|
||||
iii = 0;
|
||||
tmp = 4*block*s;
|
||||
tmp +=data;
|
||||
while(yi<height)
|
||||
{
|
||||
xi = 0;
|
||||
WHILE(xi<width)
|
||||
{
|
||||
IF(!(iii%32))
|
||||
{
|
||||
tmp += 4;
|
||||
_ = DSDWORD[tmp];
|
||||
}
|
||||
ELSE _ >>= 1;
|
||||
IF(_&1)
|
||||
{
|
||||
IF(xi>rw)rw=xi;
|
||||
PutPixel(x+xi,y+yi,c);
|
||||
}
|
||||
xi++;
|
||||
iii++;
|
||||
}
|
||||
yi++;
|
||||
}
|
||||
return rw;
|
||||
dword xi,yi;
|
||||
dword tmp,_;
|
||||
dword iii;
|
||||
byte rw=0;
|
||||
IF(offsetLine)y+=offsetLine;
|
||||
IF(s==32)return width/4;
|
||||
IF(s==9)return width;
|
||||
yi = 0;
|
||||
iii = 0;
|
||||
tmp = 4*block*s;
|
||||
tmp +=data;
|
||||
while(yi<height)
|
||||
{
|
||||
xi = 0;
|
||||
WHILE(xi<width)
|
||||
{
|
||||
IF(!(iii%32))
|
||||
{
|
||||
tmp += 4;
|
||||
_ = DSDWORD[tmp];
|
||||
}
|
||||
ELSE _ >>= 1;
|
||||
IF(_&1)
|
||||
{
|
||||
IF(xi>rw)rw=xi;
|
||||
PutPixel(x+xi,y+yi,c);
|
||||
}
|
||||
xi++;
|
||||
iii++;
|
||||
}
|
||||
yi++;
|
||||
}
|
||||
return rw;
|
||||
}
|
||||
:byte FONT::load(dword path)
|
||||
{
|
||||
@@ -83,6 +115,7 @@ FONT font = 0;
|
||||
IF(data)free(data);
|
||||
tmp = io.read(path);
|
||||
data = tmp;
|
||||
begin = data;
|
||||
size_file = io.FILES_SIZE;
|
||||
tmp +=size_file;
|
||||
tmp--;
|
||||
|
||||
Reference in New Issue
Block a user