Board.KolibriOS.org

Official KolibriOS board
It is currently Tue Apr 23, 2019 5:25 pm

All times are UTC+03:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Latin_o2i
PostPosted: Sun Jun 15, 2014 9:17 pm 
Offline
User avatar

Joined: Sun May 11, 2014 9:21 pm
Posts: 97
I present you a simple implementation of the Western Latin font by including a small (3K) file with a precompiled routine.
To print text in Western Latin, the included routine must be called instead of the syscall function 4, using the same parameters.
Please look at the "PrintLatin.asm" example application to see the simplicity of it.

Notes:

- when assembling the example, you must adjust the paths of the includes.
- the file-suffix (o2i) stands for "object to include"
- the routine uses 6K stack space
- the routine is written in Mas (Modern assembly, a language still to be published, black box for now)
- to properly print accents, latin font characters are printed one pixel lower then the system font

I could add the option to use the system font if the user-language is Russian or implement code pages according the country.
Next to implement is a function to get a keyboard key with dead key handling.
Maybe then comes underlined text, Input fields, textbox, ... etc.

I would like your opinion on this approach (while waiting for the implementation of unicode).


Attachments:
File comment: File to include to print Western Latin symbols
Latin_o2i [3.15 KiB]
Downloaded 62 times
File comment: Simple example
Latin.jpg
Latin.jpg [ 6.89 KiB | Viewed 1423 times ]
File comment: Simple application to demonstrate the use of Latin_o2i (source)
PrintLatin.asm [3.9 KiB]
Downloaded 67 times
File comment: Simple application to demonstrate the use of Latin_o2i
PrintLatin [3.44 KiB]
Downloaded 61 times

_________________
Greetings from Seppe


Last edited by seppe on Mon Jun 16, 2014 10:59 am, edited 1 time in total.
Top
   
 Post subject: Re: Latin_o2i
PostPosted: Sun Jun 15, 2014 9:43 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
Interesting approach. And your font + routine is quite small, kudos!
Tried to use the routine in IRCC (IRC client) and noted that your procedure destroys registers, unlike mcall 4
Placing a pusha/popa around 'call prl' fixed the problems offcourse.

I'm not really waiting for 'a new language' but you seem to know your stuff. I'm curious.

PS: The actual printing of western text in IRCC failed because the built in UTF8 routine recodes to CP866 instead of 1252 :(

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: Latin_o2i
PostPosted: Mon Jun 16, 2014 11:16 am 
Offline
User avatar

Joined: Sun May 11, 2014 9:21 pm
Posts: 97
hidnplayr wrote:
your procedure destroys registers, unlike mcall 4
Sorry ..I fixed it. I added a surrounding pusha/popa to the routine and updated the file.
hidnplayr wrote:
printing of western text in IRCC fails because the built in UTF8 routine recodes to CP866 instead of 1252 :(
I can improve Latin_o2i to accept and print utf8 for both CP866 (Russian) and CP1252 (Latin).
Utf8, deadkeys, KB layouts, ... What shall i do first? :?:

_________________
Greetings from Seppe


Top
   
 Post subject: Re: Latin_o2i
PostPosted: Wed Jun 18, 2014 2:32 am 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
It's alive!


Attachments:
kolibrios.png
kolibrios.png [ 3.33 KiB | Viewed 1347 times ]

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
Top
   
 Post subject: Re: Latin_o2i
PostPosted: Wed Jun 18, 2014 1:17 pm 
Offline
User avatar

Joined: Sun May 11, 2014 9:21 pm
Posts: 97
Bravo! Well done. :wink:
Now I will add a function to Latin_o2i to handle dead codes.
Soon to come . . .

_________________
Greetings from Seppe


Top
   
 Post subject: Re: Latin_o2i
PostPosted: Thu Jun 19, 2014 9:02 am 
Offline
User avatar

Joined: Sun May 11, 2014 9:21 pm
Posts: 97
I present a second version of the "latin_o2i" routine in which I added deadkey handling.
To get a key, call the "latin" routine with eax=2 instead of the syscall 2 function.
An additional parameter (ebx) must point to a 12 byte structure (three 32-bit variables).
On return, eax contains the same result as the syscall 2 function, and the variables contain:
var 1 returns the ascii code, or 0 for deadkey, 1 if the controlkey is down, 2 for hotkey
var 2 contains the control key flags (see syscall 66,3).
var 3 is used by the latin routine to store the ascii code of the pending dead-key.
Please look at the "PrintLatin.asm" example application to understand the simplicity of it all.
Attachment:
File comment: PrintLatin version 2
PrintLatin.jpg
PrintLatin.jpg [ 8.35 KiB | Viewed 1304 times ]

Notes:

- the routine works for all countries that use the Western Latin font for keyboard symbols. :D
- keyboard mode should be set to normal (the default)
- I did not (yet) test hotkeys

The latin routine applies simple "Typewriter" rules:
A dead-key that does not match a valid combination is lost.
To print a deadkey by itself, it must be pressed twice.

Use the AltNumkey method to enter any ascii code :D (see http://symbolcodes.tlt.psu.edu/accents/codealt.html for details)

I intent to make an application similar to Zkey for Latin keyboards.
I intent to make a map for Spanish keyboard, . . .
I will post a new topic on "printable keycodes".
On positive feedback, I'll publish a Fasm version of the latin_o2i routine.


Attachments:
File comment: Example application to demonstrate LatinĀ°o2i (Fasm source)
PrintLatin.asm [5.59 KiB]
Downloaded 62 times
File comment: example application to demonstrate Latin_o2i (executable)
PrintLatin [4.43 KiB]
Downloaded 62 times
File comment: File with object to include
Latin_o2i [3.99 KiB]
Downloaded 61 times

_________________
Greetings from Seppe
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC+03:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited