From e3963ea7c110bede368e5d2a5c0c9244f94961f5 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Thu, 22 Sep 2011 18:34:55 +0000 Subject: [PATCH] fontconv: font converter for kolibri added, win/dos binaries deleted git-svn-id: svn://kolibrios.org@2232 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/other/font_conv/convert.c | 80 ++++++----- programs/other/font_conv/convert.com | Bin 265 -> 0 bytes programs/other/font_conv/convert.exe | Bin 9216 -> 0 bytes programs/other/font_conv/fontconv.asm | 189 ++++++++++++++++++++++++++ 4 files changed, 233 insertions(+), 36 deletions(-) delete mode 100644 programs/other/font_conv/convert.com delete mode 100644 programs/other/font_conv/convert.exe create mode 100644 programs/other/font_conv/fontconv.asm diff --git a/programs/other/font_conv/convert.c b/programs/other/font_conv/convert.c index 5a80ef7c9e..2b2425996c 100644 --- a/programs/other/font_conv/convert.c +++ b/programs/other/font_conv/convert.c @@ -1,49 +1,57 @@ +/* + Copyright 2011 dunkaist + Distributed under the terms of the GNU General Public License v3. + See http://www.gnu.org/licenses/gpl.txt for the full license text. +*/ + + #include +#define FONT_HEIGHT 9 +#define FONT_WIDTH_MONO 5 +#define FONT_WIDTH_VAR 7 /* max symbol width */ + + short int char_num, row, col; + char ch, data; + + +int do_symbol(short int font_width) +{ + for(row=FONT_HEIGHT; row; row--) + { + data = 0; + for(col=0; collyL`x?O8?srW*{CcQOR*;$+%l58|F=*kX59akn6o;kW&qOdA;u4*Y4bP$*&I zIN^5TVZ%>_(vKS%R~Z~=KE~Yq&!gyx;kV|)0geATxr=V@ddFyZa*GYfkQR`coFFqD z&MFp_gG}7@4Ps$YCQvFBYF$wb*fL=zpjCf1a5U8aQ7B>Ua{r^Fzsm5N!GVp8$W}L$ zeq05%Hmc}J^WhYrr94HacQG(QEG-fQn#%>Vk_BY$;pB|OBE6D|5(Y3M7eX7sMU3=- FLI4UvaMJ() diff --git a/programs/other/font_conv/convert.exe b/programs/other/font_conv/convert.exe deleted file mode 100644 index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G%1qa*X-L{iG|{WGKh_aai(ggXwfH?GP-ybQpV#8ufYSbN+BYPR2GH zem`e-*UW#xDiH8DG&MH5BW~}yxpT@&ynz67yCt#7ACX0g|D{lL`-8p^Mj zw78cUQWXJDBqBzj=M}G}$t0OIuJK4EGXCPZu7Oo7UbL)aNe!pXF5Gp)FQec65HHfIV8c^Fl(3=p5SClNT2@TEc=^9!RPS@6iHlAzyx81 zUy>D1;C@Av+Bie>3cipe%gbgrP5U1?rWH!;{YW2(2Qm7GU5vw=dC5d8{zd`ayZS0ciZc(oCL}ZsF z;TU9N%@{8Ud6j^;*c0>y#6^rPA{wbL${c5my=VST5WYPDoIaPkE6J-8JuO#|Sy^6H z$m2Eq!m4apF3PpRHQbBW)!HbADT}-O0p!4*w$ub7aJ#}2P(-%JVw|>!LPoZXy_u!( z^Ov#PaDq39ao9TPtv4fLy2;o}=4P?EG2F)3%jU3>q3tzC z{7pem0PEJ=;tNaupzOnftpCs8Ue~gvuBva$<@X>=6vNK{8k!?5jgp-804LYlm$Cx% eZYl*_YhS(!e6`)lrUC@~{I`U!t${Dw3it>4{fO=W diff --git a/programs/other/font_conv/fontconv.asm b/programs/other/font_conv/fontconv.asm new file mode 100644 index 0000000000..61993f7065 --- /dev/null +++ b/programs/other/font_conv/fontconv.asm @@ -0,0 +1,189 @@ +;;=================================================================== +;; Copyright 2011 dunkaist +;; Distributed under the terms of the GNU General Public License v3. +;; See http://www.gnu.org/licenses/gpl.txt for the full license text. +;;------------------------------------------------------------------- + +CHAR1TXT_FILE_SIZE equ 20478 +CHAR2TXT_FILE_SIZE equ 25598 + +CHAR1MT_FILE_SIZE equ 2304 +CHAR2MT_FILE_SIZE equ 2560 + +FONT_HEIGHT equ 9 +FONT_WIDTH_MONO equ 5 +FONT_WIDTH_VAR equ 7 + + +use32 + org 0x0 + db 'MENUET01' + dd 0x01, start, i_end, e_end, stacktop, 0x0, cur_dir + +include '../../proc32.inc' +include '../../macros.inc' + + +start: + mcall 68, 11 + + cld + mov ecx, 4096 + mov edi, cur_dir + xor al, al + repnz scasb + std + mov al, '/' + repnz scasb + add edi, 2 + cld + mov [cur_dir_slash], edi + mov esi, _char1.txt + mov ecx, 10/2 + rep movsw + +monospace: + mcall 70, func70 ; get file info + test eax, eax + jnz quit + + mov ecx, dword[file_info.Size] + cmp ecx, CHAR1TXT_FILE_SIZE + jl quit + mov [func70.bytes_to_read], ecx + mcall 68, 12, ; allocate memory for char.txt + test eax, eax + jz quit + mov [func70.destination], eax + + mov [func70.func_number], 0 ; read from file + mcall 70, func70 + test eax, eax + jnz freemem_quit + + + xor dl, dl + mov esi, [func70.destination] + mov edi, esi ; yes, that's a feature + mov bl, FONT_WIDTH_MONO + .char: + add esi, 8 + call do_symbol + dec dl + jnz .char + + mov [func70.func_number], 2 ; create/overwrite file + mov [func70.bytes_to_read], CHAR1MT_FILE_SIZE + mov edi, [cur_dir_slash] + mov esi, _char1.mt + mov ecx, 10/2 + rep movsw + mcall 70, func70 + test eax, eax + jnz freemem_quit + + +varspace: + push [func70.destination] + push file_info + pop [func70.destination] + mov [func70.func_number], 5 ; get file info + mov edi, [cur_dir_slash] + mov esi, _char2.txt + mov ecx, 10/2 + rep movsw + mcall 70, func70 + pop [func70.destination] + test eax, eax + jnz freemem_quit + + mov ecx, dword[file_info.Size] + cmp ecx, CHAR2TXT_FILE_SIZE + jl freemem_quit + mov [func70.bytes_to_read], ecx + mcall 68, 20, ; realloc memory + test eax, eax + jz freemem_quit + mov [func70.destination], eax + + mov [func70.func_number], 0 ; read from file + mcall 70, func70 + test eax, eax + jnz freemem_quit + + + xor dl, dl + mov esi, [func70.destination] + mov edi, esi ; yes, that's a feature + mov bl, FONT_WIDTH_VAR + .char: + add esi, 6 + lodsb + cmp al, ' ' ; space means default symbol width (8) + jnz @f + mov al, 8+47 + @@: sub al, 47 + stosb + add esi, 3 + call do_symbol + dec dl + jnz .char + + + mov [func70.func_number], 2 ; create/overwrite file + mov [func70.bytes_to_read], CHAR2MT_FILE_SIZE + mov edi, [cur_dir_slash] + mov esi, _char2.mt + mov ecx, 10/2 + rep movsw + mcall 70, func70 + test eax, eax + jnz freemem_quit + +freemem_quit: + mcall 68, 13, [func70.destination] +quit: + mcall -1 + + +proc do_symbol + mov ch, FONT_HEIGHT + .col: xor ah, ah + xor cl, cl + .row: lodsb + cmp al, ' ' + setnz al + shl al, cl + or ah, al + inc cl + cmp cl, bl + jnz .row + add esi, 3 + mov al, ah + stosb + dec ch + jnz .col + ret +endp + +_char1.txt db 'char.txt',0 +_char2.txt db 'char2.txt',0 +_char1.mt db 'char.mt',0 +_char2.mt db 'char2.mt',0 + +func70: + .func_number dd 5 ; function number + .position dd 0 ; position in file + .reserved dd 0 ; reserved + .bytes_to_read dd 0 ; bytes to read + .destination dd file_info + .flag db 0 ; see file name later + .file_name dd cur_dir ; pointer to the name of file (ASCIIZ) + +i_end: +file_info FILEINFO +cur_dir rb 4096 +cur_dir_slash rd 1 ; we save here position of the last '/' symbol +stack_here rb 0x200 +stacktop: +e_end: