From 6ea4f3a37b0ec223029c315be7ca1b0a12963790 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Thu, 20 Aug 2015 16:37:49 +0000 Subject: [PATCH] Fixed bugs font.h offset y git-svn-id: svn://kolibrios.org@5754 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/lib/font.h | 94 +++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index 2cb2682f74..cd801825a5 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -14,6 +14,7 @@ word width,height; signed offset_x,offset_y; byte text; + byte TMP_WEIGHT; }; :struct FONT { @@ -30,7 +31,7 @@ byte load(...); byte symbol(word x;byte s;dword c); byte symbol_size(byte s); - dword text(word x,y;dword text1,c); + dword text(word x,y;dword text1); dword getsize(dword text1); dword textarea(word x,y;dword text,c); byte changeSIZE(); @@ -60,24 +61,23 @@ FONT font = 0; dword ofs; byte s; IF(size.text<9) size.text = 8; - IF(size.text>45)size.text = 45; - s = size.text-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; + s = size.text-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; } :proc_info Form_SELF_FONTS; @@ -106,16 +106,17 @@ FONT font = 0; dword iii; byte rw=0; byte X; + size.TMP_WEIGHT = math.ceil(size.text/17); IF(s==32) { size.width += width/4; - IF(weight) size.width++; + IF(weight) size.width+=size.TMP_WEIGHT; return; } IF(s==9) { size.width += width; - IF(weight) size.width++; + IF(weight) size.width+=size.TMP_WEIGHT; return; } yi = 0; @@ -148,7 +149,7 @@ FONT font = 0; yi++; } size.width += rw; - IF(weight) size.width++; + IF(weight) size.width+=size.TMP_WEIGHT; IF(s=='_') size.width--; IF(size.offset_x<0)size.offset_x = X; } @@ -158,11 +159,11 @@ FONT font = 0; dword c; word _tmp_h; c = color; - IF(size.text)IF(!changeSIZE())return 0; + IF(!text1)return false; + IF(size.text)IF(!changeSIZE())return false; GetProcessInfo(#Form_SELF_FONTS, SelfInfo); - IF(y>Form_SELF_FONTS.cheight) return 0; - IF(x>Form_SELF_FONTS.cwidth) return 0; - tmp_y = y; + IF(y>Form_SELF_FONTS.cheight) return false; + IF(x>Form_SELF_FONTS.cwidth) return false; AX = c; r = AL; g = AH; @@ -170,21 +171,25 @@ FONT font = 0; AX = c; b = AL; getsize(text1); + y -= size.offset_y; + tmp_y = y; + + EDX = size.width*size.height*3; IF(!buffer_size) { - buffer_size = size.width*size.height*3; + buffer_size = EDX; buffer = malloc(buffer_size); } - ELSE IF(buffer_size>= 1; @@ -233,14 +241,19 @@ FONT font = 0; tmp += 4; _ = DSDWORD[tmp]; } - IF(_&1) + if(_&1) { IF(xi>rw)rw=xi; ___x = x+xi; IF(___x