font.h: make spaghetti code a little bit less ugly
kolibri font viewer: revert to older version, because code readability matters git-svn-id: svn://kolibrios.org@5981 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
791c882e25
commit
9497d50e2f
@ -8,12 +8,14 @@
|
||||
#endif
|
||||
|
||||
//libraries
|
||||
#define MEMSIZE 0x100000
|
||||
#define MEMSIZE 1060000
|
||||
#include "..\lib\gui.h"
|
||||
#include "..\lib\draw_buf.h"
|
||||
#include "..\lib\list_box.h"
|
||||
#include "..\lib\cursor.h"
|
||||
#include "..\lib\collection.h"
|
||||
#include "..\lib\font.h"
|
||||
|
||||
//*.obj libraries
|
||||
#include "..\lib\obj\box_lib.h"
|
||||
#include "..\lib\obj\libio_lib.h"
|
||||
@ -46,7 +48,6 @@ char homepage[] = FROM "html\\homepage.htm";
|
||||
#define URL_SERVICE_HOME "WebView://home"
|
||||
#define URL_SERVICE_SOURCE "WebView://source:"
|
||||
|
||||
|
||||
proc_info Form;
|
||||
|
||||
//char search_path[]="http://nigma.ru/index.php?s=";
|
||||
@ -115,6 +116,15 @@ void main()
|
||||
WB1.DrawBuf.zoom = 1;
|
||||
WB1.list.SetFont(8, 14, 10111000b);
|
||||
WB1.list.no_selection = true;
|
||||
//font init
|
||||
font.no_bg_copy = true;
|
||||
font.bg_color = 0xFFFFFF;
|
||||
font.load(DEFAULT_FONT);
|
||||
if (!font.data) {
|
||||
notify("'Error: Font is not loaded.' -E");
|
||||
ExitProcess();
|
||||
}
|
||||
//
|
||||
SetEventMask(0xa7);
|
||||
BEGIN_LOOP_APPLICATION:
|
||||
WaitEventTimeout(2);
|
||||
@ -250,6 +260,8 @@ void SetElementSizes()
|
||||
if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30);
|
||||
}
|
||||
|
||||
int list__w;
|
||||
|
||||
void Draw_Window()
|
||||
{
|
||||
DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
|
||||
@ -268,6 +280,21 @@ void Draw_Window()
|
||||
if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBox(); }
|
||||
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
|
||||
DrawProgress();
|
||||
|
||||
list__w = 200;
|
||||
font.buffer_size = 0;
|
||||
font.size.height = 200;
|
||||
font.color = 0;
|
||||
font.size.text = 11;
|
||||
font.prepare_buf(10,10,list__w,font.size.height, "Hello World!");
|
||||
font.color = 0xFF00FF;
|
||||
font.size.text = 12;
|
||||
font.prepare_buf(10,23,list__w,font.size.height, "How are you?");
|
||||
font.color = 0x2E74BB;
|
||||
font.size.text = 15;
|
||||
font.prepare_buf(11,40,list__w,font.size.height, "Fine");
|
||||
SmoothFont(font.buffer, font.size.width, font.size.height);
|
||||
_PutImage(0,0,list__w,font.size.height,font.buffer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -718,7 +718,7 @@ void Line_ReDraw(dword bgcol, filenum){
|
||||
else
|
||||
{
|
||||
font.bg_color = bgcol;
|
||||
font.use_smooth = smooth_font;
|
||||
font.smooth = smooth_font;
|
||||
font.prepare(files.x + 23, files.item_h - font.height / 2 + y, file_name_off);
|
||||
font.show();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
?define SHOW_REAL_NAMES "<EFBFBD>®ª §ë¢ âì ¨¬¥ ä ©«®¢ ¥ ¬¥ïï ॣ¨áâà"
|
||||
?define FONT_SIZE_LABEL "<EFBFBD> §¬¥à èà¨äâ "
|
||||
?define USE_TWO_PANELS "„¢¥ ¯ ¥«¨"
|
||||
?define USE_SMOOTH_FONT "ˆá¯®«ì§®¢ âì ᣫ ¦¥ë© èà¨äâ"
|
||||
?define smooth_FONT "ˆá¯®«ì§®¢ âì ᣫ ¦¥ë© èà¨äâ"
|
||||
?define LIST_LINE_HEIGHT "‚ëá®â áâப¨ ¢ ᯨ᪥"
|
||||
?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襨¨ ª®¯¨à®¢ ¨ï"
|
||||
?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©®£® ª«¨ª (¢ á®âëå)"
|
||||
@ -18,7 +18,7 @@
|
||||
?define SHOW_REAL_NAMES "Show real file names without changing case"
|
||||
?define FONT_SIZE_LABEL "Font size"
|
||||
?define USE_TWO_PANELS "Two panels"
|
||||
?define USE_SMOOTH_FONT "Use smooth font"
|
||||
?define smooth_FONT "Use smooth font"
|
||||
?define LIST_LINE_HEIGHT "List line height"
|
||||
?define NOTIFY_COPY_END "Notify when copying finished"
|
||||
?define T_DOUBLE_CLICK "Double click time (in hundredths)"
|
||||
@ -92,7 +92,7 @@ void DrawSettingsCheckBoxes()
|
||||
CheckBox2(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case);
|
||||
CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
|
||||
CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels);
|
||||
//CheckBox2(10, 99, 29, USE_SMOOTH_FONT, smooth_font);
|
||||
//CheckBox2(10, 99, 29, smooth_FONT, smooth_font);
|
||||
MoreLessBox(10, 99, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
|
||||
MoreLessBox(10, 125, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT);
|
||||
if (font.data) MoreLessBox(10, 152, 18, 30, 31, #system.color, font.size.text, FONT_SIZE_LABEL);
|
||||
|
@ -8,36 +8,15 @@
|
||||
void main()
|
||||
{
|
||||
proc_info Form;
|
||||
FONT font_title = 0;
|
||||
FONT font_option = 0;
|
||||
word i, y, btn;
|
||||
char line[256], title[4196];
|
||||
font.no_bg_copy = true;
|
||||
font.color = 0;
|
||||
font.bg_color = 0xFFFFFF;
|
||||
font.left = 5;
|
||||
font.top = SKIN.height+PANELH;
|
||||
if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf");
|
||||
if (!param) strcpy(#param, DEFAULT_FONT);
|
||||
font.load(#param);
|
||||
|
||||
font_title.no_bg_copy = true;
|
||||
font_title.load("/sys/fonts/Tahoma.kf");
|
||||
font_title.size.text = 12;
|
||||
font_title.color = 0x444444;
|
||||
font_title.weight = 1;
|
||||
font_title.use_smooth = 1;
|
||||
font_title.bg_color = 0xE1E1E1;
|
||||
|
||||
font_option.no_bg_copy = true;
|
||||
font_option.load("/sys/fonts/Tahoma.kf");
|
||||
font_option.size.text = 13;
|
||||
font_option.color = 0x222222;
|
||||
font_option.use_smooth = 1;
|
||||
font_option.bg_color = 0xDADADA;
|
||||
|
||||
strcpy(#title, "Font preview: ");
|
||||
strcat(#title, #param);
|
||||
font_title.prepare(5, 4, #title);
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
@ -45,49 +24,33 @@ void main()
|
||||
case evButton:
|
||||
btn = GetButtonID();
|
||||
if (btn==1) ExitProcess();
|
||||
if (btn==2) font.weight ^=1;
|
||||
if (btn==2) font.bold ^=1;
|
||||
if (btn==3) font.italic ^=1;
|
||||
if (btn==4) font.smooth ^=1;
|
||||
goto _DRAW_WINDOW_CONTENT;
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(215,100,500,320,0x04,0xFFFFFF,"");
|
||||
font_title.show();
|
||||
DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
_DRAW_WINDOW_CONTENT:
|
||||
DrawBar(5, SKIN.height, Form.cwidth, PANELH, 0xDADADA);
|
||||
|
||||
font_option.italic = font_option.smooth = 0;
|
||||
font_option.weight = 1;
|
||||
font_option.prepare(30, SKIN.height+7, "Bold");
|
||||
CheckBox2(10, SKIN.height+8, 2, "", font.weight);
|
||||
font_option.show();
|
||||
|
||||
font_option.weight = font_option.smooth = 0;
|
||||
font_option.italic = 1;
|
||||
font_option.prepare(90, SKIN.height+7, "Italic");
|
||||
CheckBox2(70, SKIN.height+8, 3, "", font.italic);
|
||||
font_option.show();
|
||||
|
||||
font_option.weight = font_option.italic = 0;
|
||||
font_option.smooth = 1;
|
||||
font_option.prepare(160, SKIN.height+7, "Smooth");
|
||||
CheckBox2(140, SKIN.height+8, 4, "Smooth", font.smooth);
|
||||
font_option.show();
|
||||
|
||||
IF(font.buffer)font.buffer_size = 0;
|
||||
|
||||
DrawBar(0, 0, Form.cwidth, PANELH, 0xCCCccc);
|
||||
CheckBox2(10, 8, 2, "Bold", font.bold);
|
||||
CheckBox2(70, 8, 3, "Italic", font.italic);
|
||||
CheckBox2(140, 8, 4, "Smooth", font.smooth);
|
||||
font.buffer_size = free(font.buffer);
|
||||
if (!font.data)
|
||||
{
|
||||
DrawBar(5, SKIN.height+PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
|
||||
WriteText(15, 50, 0x82, 0xFF00FF, "Font is not loaded.");
|
||||
DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
|
||||
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
|
||||
}
|
||||
else for (i=10, y=5; i<22; i++, y+=font.height;) //not flexible, need to calculate font count and max line length
|
||||
{
|
||||
font.size.text = i;
|
||||
sprintf(#line,"<EFBFBD> §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
|
||||
font.prepare_buf(15,SKIN.height+y,Form.cwidth,Form.cheight-PANELH, #line);
|
||||
font.prepare_buf(10,y,Form.cwidth,Form.cheight-PANELH, #line);
|
||||
}
|
||||
if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height);
|
||||
font.left = 0;
|
||||
font.top = PANELH;
|
||||
font.show();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "../lib/obj/fs.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_FONT "/sys/fonts/Tahoma.kf"
|
||||
|
||||
:struct __OFFSET_FONT
|
||||
{
|
||||
signed x,y;
|
||||
@ -24,11 +26,10 @@
|
||||
:struct FONT
|
||||
{
|
||||
__SIZE size;
|
||||
byte r,g,b,weight,italic, smooth;
|
||||
byte width,height;
|
||||
byte use_smooth;
|
||||
int left,top;
|
||||
byte encoding;
|
||||
int left,top,width,height;
|
||||
byte bold,italic,smooth;
|
||||
byte no_bg_copy;
|
||||
dword bg_color;
|
||||
dword color;
|
||||
dword file_size;
|
||||
dword buffer;
|
||||
@ -46,26 +47,13 @@
|
||||
dword getsize(dword text1);
|
||||
byte changeSIZE();
|
||||
void PixelRGB(dword x,y);
|
||||
//dword GetPixel(word x,y);
|
||||
byte no_bg_copy;
|
||||
dword bg_color;
|
||||
};
|
||||
FONT font = 0;
|
||||
/*
|
||||
:dword FONT::GetPixel(word x,y)
|
||||
{
|
||||
dword tmp = y*size.width*3;
|
||||
tmp += x*3 + buffer;
|
||||
r = DSBYTE[tmp]; tmp++;
|
||||
g = DSBYTE[tmp]; tmp++;
|
||||
b = DSBYTE[tmp];
|
||||
}*/
|
||||
|
||||
:void FONT::PixelRGB(dword x,y)
|
||||
{
|
||||
dword offs = y*size.width+x*3 + buffer;
|
||||
DSBYTE[offs] = r; offs++;
|
||||
DSBYTE[offs] = g; offs++;
|
||||
DSBYTE[offs] = b;
|
||||
DSDWORD[offs] = DSDWORD[offs] & 0xFF000000 | color;
|
||||
}
|
||||
:byte FONT::changeSIZE()
|
||||
{
|
||||
@ -119,43 +107,38 @@ FONT font = 0;
|
||||
}
|
||||
:byte FONT::symbol_size(byte s)
|
||||
{
|
||||
dword xi,yi;
|
||||
dword tmp,_;
|
||||
dword iii;
|
||||
byte rw=0;
|
||||
dword xi,yi;
|
||||
dword tmp,_;
|
||||
dword iii;
|
||||
byte rw=0;
|
||||
byte X;
|
||||
size.TMP_WEIGHT = math.ceil(size.text/17);
|
||||
IF(s==32)
|
||||
IF(s==32)
|
||||
{
|
||||
size.width += width/4;
|
||||
IF(weight) size.width+=size.TMP_WEIGHT;
|
||||
IF(bold) size.width+=size.TMP_WEIGHT;
|
||||
return;
|
||||
}
|
||||
IF(s==9)
|
||||
{
|
||||
size.width += width;
|
||||
IF(weight) size.width+=size.TMP_WEIGHT;
|
||||
IF(bold) size.width+=size.TMP_WEIGHT;
|
||||
return;
|
||||
}
|
||||
IF(!encoding){
|
||||
IF(s>=128)&&(s<=175)s+=64;
|
||||
ELSE IF(s>=224)&&(s<=239)s+=16;
|
||||
ELSE IF(s==241)s=184; //yo
|
||||
ELSE IF(s==240)s=168; //YO
|
||||
}
|
||||
iii = 0;
|
||||
tmp = 4*block*s + data;
|
||||
for(yi=0; yi<height; yi++)
|
||||
{
|
||||
for(xi=0; xi<width; xi++)
|
||||
{
|
||||
IF(iii%32) _ >>= 1;
|
||||
s = AnsiToCp866(s);
|
||||
iii = 0;
|
||||
tmp = 4*block*s + data;
|
||||
for(yi=0; yi<height; yi++)
|
||||
{
|
||||
for(xi=0; xi<width; xi++)
|
||||
{
|
||||
IF(iii%32) _ >>= 1;
|
||||
ELSE
|
||||
{
|
||||
tmp += 4;
|
||||
_ = DSDWORD[tmp];
|
||||
}
|
||||
IF(_&1)
|
||||
tmp += 4;
|
||||
_ = DSDWORD[tmp];
|
||||
}
|
||||
IF(_&1)
|
||||
{
|
||||
IF(xi>rw)rw=xi;
|
||||
IF(size.height<yi)size.height = yi;
|
||||
@ -164,24 +147,107 @@ FONT font = 0;
|
||||
IF(!X) X = xi;
|
||||
ELSE IF(X>xi)X = xi;
|
||||
}
|
||||
iii++;
|
||||
}
|
||||
}
|
||||
iii++;
|
||||
}
|
||||
}
|
||||
size.width += rw;
|
||||
IF(weight) size.width+=size.TMP_WEIGHT;
|
||||
IF(bold) size.width+=size.TMP_WEIGHT;
|
||||
IF(s=='_') size.width--;
|
||||
IF(size.offset.x<0)size.offset.x = X;
|
||||
}
|
||||
:byte FONT::symbol(signed x,y;byte s)
|
||||
{
|
||||
dword xi,yi;
|
||||
dword iii;
|
||||
float ital = -size.w_italic;
|
||||
dword ___x;
|
||||
byte rw=0;
|
||||
IF(s==32)return width/4;
|
||||
IF(s==9)return width;
|
||||
s = AnsiToCp866(s);
|
||||
iii = 0;
|
||||
EBX = block*s << 2 + data;
|
||||
for(yi=0; yi<height; yi++)
|
||||
{
|
||||
EDI = size.offset.y + yi + y;
|
||||
for(xi=0; xi<width; xi++)
|
||||
{
|
||||
IF(iii%32) $shr ecx,1
|
||||
ELSE
|
||||
{
|
||||
EBX += 4;
|
||||
ECX = DSDWORD[EBX];
|
||||
}
|
||||
IF(ECX&true)
|
||||
{
|
||||
IF(xi>rw)rw=xi;
|
||||
___x = x+xi;
|
||||
IF(italic)___x+=math.ceil(ital);
|
||||
PixelRGB(___x,EDI);
|
||||
IF(bold) PixelRGB(___x+1,EDI);
|
||||
}
|
||||
iii++;
|
||||
}
|
||||
if (italic) ital-=size.offset_i;
|
||||
}
|
||||
return rw;
|
||||
}
|
||||
|
||||
:void FONT::show(){
|
||||
_PutImage(left,top,size.width,size.height,buffer);
|
||||
}
|
||||
|
||||
byte AnsiToCp866(byte s) {
|
||||
IF(s>=128)&&(s<=175)s+=64;
|
||||
ELSE IF(s>=224)&&(s<=239)s+=16;
|
||||
ELSE IF(s==241)s=184; //yo
|
||||
ELSE IF(s==240)s=168; //YO
|
||||
return s;
|
||||
}
|
||||
|
||||
inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
||||
:void SmoothFont(dword image, w, h)
|
||||
{
|
||||
dword i,line_w,to;
|
||||
line_w = w * 3;
|
||||
to = w*h*3 + image - line_w - 3;
|
||||
for(i = image; i < to; i+=3) {
|
||||
IF(i-image%line_w +3 == line_w) continue;
|
||||
IF(b24(i)==0x000000) && (b24(i+3)!=0x000000) && (b24(i+line_w)!=0x000000) && (b24(i+3+line_w)==0x000000)
|
||||
{
|
||||
ShadowImage(i+3, 1, 1, 2);
|
||||
ShadowImage(i+line_w, 1, 1, 2);
|
||||
}
|
||||
ELSE IF(b24(i)!=0x000000) && (b24(i+3)==0x000000) && (b24(i+line_w)==0x000000) && (b24(i+3+line_w)!=0x000000)
|
||||
{
|
||||
ShadowImage(i, 1, 1, 2);
|
||||
ShadowImage(i+3+line_w, 1, 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
:byte FONT::load(dword path)
|
||||
{
|
||||
lib_init_fs();
|
||||
buffer_size = 0;
|
||||
smooth = true;
|
||||
IF(data)free(data);
|
||||
IF(!fs.read(path)) { debug("Error while loading font: "); debugln(path); return false; }
|
||||
begin = data = EAX;
|
||||
EBX = begin + ECX;
|
||||
height = DSBYTE[EBX-1];
|
||||
width = DSBYTE[EBX-2];
|
||||
block = math.ceil(height*width/32);
|
||||
return true;
|
||||
}
|
||||
|
||||
:dword FONT::prepare(int x,y;dword text1)
|
||||
{
|
||||
signed len=0;
|
||||
proc_info Form_SELF_FONTS;
|
||||
dword c;
|
||||
c = color;
|
||||
left = x;
|
||||
IF(!text1)return false;
|
||||
IF(size.text)IF(!changeSIZE())return false;
|
||||
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
||||
left = x;
|
||||
getsize(text1);
|
||||
y -= size.offset.y;
|
||||
top = y;
|
||||
@ -199,13 +265,8 @@ FONT font = 0;
|
||||
IF (no_bg_copy)
|
||||
{
|
||||
EBX = bg_color;
|
||||
EDI = buffer;
|
||||
EAX = buffer_size+EDI;
|
||||
WHILE (EDI<EAX)
|
||||
{
|
||||
ESDWORD[EDI] = EBX;
|
||||
$add edi,3
|
||||
}
|
||||
EAX = buffer_size+buffer;
|
||||
for (EDI=buffer; EDI<EAX; EDI+=3) ESDWORD[EDI] = EBX;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
@ -217,143 +278,38 @@ FONT font = 0;
|
||||
{
|
||||
IF(DSBYTE[text1]=='_') len--;
|
||||
len+=symbol(len,0,DSBYTE[text1]);
|
||||
IF(weight)len+=math.ceil(size.text/17);
|
||||
IF(bold)len+=math.ceil(size.text/17);
|
||||
text1++;
|
||||
}
|
||||
IF (use_smooth) SmoothFont(buffer, size.width, size.height);
|
||||
IF (smooth) SmoothFont(buffer, size.width, size.height);
|
||||
return len;
|
||||
}
|
||||
:void FONT::show()
|
||||
{
|
||||
_PutImage(left,top,size.width,size.height,buffer);
|
||||
}
|
||||
inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
||||
:void SmoothFont(dword image, w, h)
|
||||
{
|
||||
byte rr,gg,bb;
|
||||
dword i,line_w,to, pixel;
|
||||
line_w = w * 3;
|
||||
to = w*h*3 + image - line_w - 3;
|
||||
for(i = image; i < to; i+=3) {
|
||||
IF(i-image%line_w +3 == line_w) continue;
|
||||
IF(b24(i)==0x000000) && (b24(i+3)!=0x000000) && (b24(i+line_w)!=0x000000) && (b24(i+3+line_w)==0x000000)
|
||||
{
|
||||
ShadowImage(i+3, 1, 1, 2);
|
||||
ShadowImage(i+line_w, 1, 1, 2);
|
||||
}
|
||||
ELSE IF(b24(i)!=0x000000) && (b24(i+3)==0x000000) && (b24(i+line_w)==0x000000) && (b24(i+3+line_w)!=0x000000)
|
||||
{
|
||||
ShadowImage(i, 1, 1, 2);
|
||||
ShadowImage(i+3+line_w, 1, 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
:byte FONT::symbol(signed x,y;byte s)
|
||||
{
|
||||
dword xi,yi;
|
||||
dword iii;
|
||||
float ital = -size.w_italic;
|
||||
dword ___x;
|
||||
//byte _TMP_WEIGHT;
|
||||
byte rw=0;
|
||||
//_TMP_WEIGHT=2;
|
||||
IF(s==32)return width/4;
|
||||
IF(s==9)return width;
|
||||
IF(!encoding)
|
||||
{
|
||||
IF(s>=128)&&(s<=175)s+=64;
|
||||
ELSE IF(s>=224)&&(s<=239)s+=16;
|
||||
ELSE IF(s==241)s=184; //yo
|
||||
ELSE IF(s==240)s=168; //YO
|
||||
}
|
||||
iii = 0;
|
||||
EBX = block*s;
|
||||
$shl ebx,2
|
||||
$add ebx,data
|
||||
yi = 0;
|
||||
while(yi<height)
|
||||
{
|
||||
EDI = size.offset.y;
|
||||
$add edi,yi
|
||||
$add edi,y
|
||||
for(xi=0; xi<width; xi++)
|
||||
{
|
||||
IF(iii%32) $shr ecx,1
|
||||
ELSE
|
||||
{
|
||||
$add ebx,4
|
||||
ECX = DSDWORD[EBX];
|
||||
}
|
||||
IF(ECX&true)
|
||||
{
|
||||
IF(xi>rw)rw=xi;
|
||||
___x = x+xi;
|
||||
IF(italic)___x+=math.ceil(ital);
|
||||
PixelRGB(___x,EDI);
|
||||
//_TMP_WEIGHT = 2;
|
||||
//WHILE(_TMP_WEIGHT)
|
||||
//{
|
||||
// _TMP_WEIGHT--;
|
||||
IF(weight) PixelRGB(___x+1,EDI);
|
||||
//}
|
||||
}
|
||||
iii++;
|
||||
}
|
||||
IF(italic) ital-=size.offset_i;
|
||||
$inc yi
|
||||
}
|
||||
return rw;
|
||||
}
|
||||
:byte FONT::load(dword path)
|
||||
{
|
||||
lib_init_fs();
|
||||
buffer_size = 0;
|
||||
use_smooth = true;
|
||||
IF(data)free(data);
|
||||
IF(!fs.read(path)) { debug("Error while loading font: "); debugln(path); return false; }
|
||||
begin = data = EAX;
|
||||
EBX = begin + ECX;
|
||||
$dec ebx
|
||||
height = DSBYTE[EBX];
|
||||
$dec ebx
|
||||
width = DSBYTE[EBX];
|
||||
block = math.ceil(height*width/32);
|
||||
return true;
|
||||
}
|
||||
|
||||
:void FONT::prepare_buf(int x,y,w,h; dword text1)
|
||||
{
|
||||
dword c, new_buffer_size;
|
||||
c = color;
|
||||
//left = x;
|
||||
IF(!text1)return;
|
||||
IF(size.text)IF(!changeSIZE())return;
|
||||
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
||||
getsize(text1);
|
||||
y -= size.offset.y;
|
||||
//top = y;
|
||||
|
||||
size.width = w;
|
||||
size.height = h;
|
||||
|
||||
new_buffer_size = w*h*3;
|
||||
IF(buffer_size!=new_buffer_size)
|
||||
IF(buffer_size != w*h*3)
|
||||
{
|
||||
buffer_size = new_buffer_size;
|
||||
free(buffer);
|
||||
buffer = malloc(buffer_size);
|
||||
EBX = bg_color;
|
||||
EDI = buffer;
|
||||
EAX = buffer_size+buffer;
|
||||
WHILE (EDI<EAX)
|
||||
{
|
||||
ESDWORD[EDI] = EBX;
|
||||
$add edi,3
|
||||
}
|
||||
for (EDI=buffer; EDI<EAX; EDI+=3) ESDWORD[EDI] = EBX;
|
||||
}
|
||||
WHILE(DSBYTE[text1])
|
||||
{
|
||||
x+=symbol(x,y,DSBYTE[text1]);
|
||||
IF(weight)x+=math.ceil(size.text/17);
|
||||
IF(bold)x+=math.ceil(size.text/17);
|
||||
text1++;
|
||||
}
|
||||
return;
|
||||
|
@ -151,7 +151,7 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name)
|
||||
//WriteTextCenter(col*cell_w+6,row*cell_h+46 + list_pos,cell_w,0x000000,key_name);
|
||||
font.size = 12;
|
||||
font.color = 0xDCDCDC;
|
||||
font.weight = false;
|
||||
font.bold = false;
|
||||
font.bg_color = LIST_BACKGROUND_COLOR;
|
||||
font.textcenter(col*cell_w+7,row*cell_h+47 + list_pos,cell_w,0,key_name);
|
||||
font.show();
|
||||
@ -188,7 +188,7 @@ byte process_sections(dword sec_name, f_name)
|
||||
DrawBar(0, row * cell_h + list_pos, Form.cwidth , 29, LIST_BACKGROUND_COLOR);
|
||||
//WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name);
|
||||
font.size=14;
|
||||
font.weight=true;
|
||||
font.bold=true;
|
||||
font.bg_color = LIST_BACKGROUND_COLOR;
|
||||
text_len = font.prepare(10, row * cell_h + 10 + list_pos,sec_name);
|
||||
font.show();
|
||||
@ -206,7 +206,7 @@ void draw_top_bar()
|
||||
DrawBar(0,0,Form.cwidth, top_position-1, system.color.work);
|
||||
DrawBar(0,top_position-1, Form.cwidth, 1, system.color.work_graph);
|
||||
font.size = 17;
|
||||
font.weight = false;
|
||||
font.bold = false;
|
||||
font.bg_color = system.color.work;
|
||||
font.prepare(Form.cwidth-font.getsize(#window_title)/2,0,#window_title);
|
||||
font.show();
|
||||
|
Loading…
Reference in New Issue
Block a user