forked from KolibriOS/kolibrios
Update lib font
git-svn-id: svn://kolibrios.org@5736 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
27e3b1b723
commit
d2cc18ec69
@ -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.
BIN
programs/cmm/example fonts/font/Other/Georgia 45px original
Normal file
BIN
programs/cmm/example fonts/font/Other/Georgia 45px original
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Other/Tahoma 11px
Normal file
BIN
programs/cmm/example fonts/font/Other/Tahoma 11px
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Other/Tahoma 11px italic
Normal file
BIN
programs/cmm/example fonts/font/Other/Tahoma 11px italic
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Other/Tahoma 14px italic
Normal file
BIN
programs/cmm/example fonts/font/Other/Tahoma 14px italic
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Other/Tahoma 14px italic bold
Normal file
BIN
programs/cmm/example fonts/font/Other/Tahoma 14px italic bold
Normal file
Binary file not shown.
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/10
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/10
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/11
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/11
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/12
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/12
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/13
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/13
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/14
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/14
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/15
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/15
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/16
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/16
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/17
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/17
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/18
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/18
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/19
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/19
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/20
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/20
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/21
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/21
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/22
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/22
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma source/9
Normal file
BIN
programs/cmm/example fonts/font/Tahoma source/9
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Tahoma.kf
Normal file
BIN
programs/cmm/example fonts/font/Tahoma.kf
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/10
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/10
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/11
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/11
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/12
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/12
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/13
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/13
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/14
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/14
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/15
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/15
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/16
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/16
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/17
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/17
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/18
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/18
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/19
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/19
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/20
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/20
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/21
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/21
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/22
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/22
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/8
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/8
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana source/9
Normal file
BIN
programs/cmm/example fonts/font/Verdana source/9
Normal file
Binary file not shown.
BIN
programs/cmm/example fonts/font/Verdana.kf
Normal file
BIN
programs/cmm/example fonts/font/Verdana.kf
Normal file
Binary file not shown.
@ -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--;
|
||||
|
Loading…
Reference in New Issue
Block a user