On 5 Oct 2007, at 15:49, belahcene wrote: > I want to know if it is possible to create menu in other languge, > precisely in arabic. > I mean, for example in caneva instead of file, edit, ..., I want > the equivalent in arabic , if it how to do it
The short answer is yes, you can do this. But that is an oversimplification... The full answer to this depends partly on what version of fltk you are using, and then on a number of other factors. Here's an attempt to explain. fltk-1.1 by default assumes that all text strings are simple ASCII style byte arrays - by selecting the appropriate code-page on your computer you *might* be able to get it to display the correct set of glyphs to render your text, but even then fltk-1.1 *assumes* all text is rendered in left-to-right ordering, and left justified in menus etc., which would be wrong for rendering arabic strings. Also - the behaviour of your program then becomes dependent on the user having the correct code-page set - if they choose another code- page, the wrong characters will be displayed and it will be a mess... There are a number of patches circulating for fltk-1.1 that make it interpret strings as utf8 instead - this opens up the possibility of using Unicode fonts to render the menus etc., and is independent of the code-page that the PC has set, so making the rendering of the characters more reliable (assuming the machine in question has Unicode capable fonts installed, that have the necessary glyphs for the characters you need, of course.) These patched fltk-1.1 variants mostly also provide some (possibly limited) support for right-to-left text rendering, that might make it possible to have menus etc. correctly aligned. fltk-2 was intended from the outset to be utf8 aware, so it brings many of the advantages of the patched fltk-1.1 versions, and would be worth investigating too. However, simply being able to display the character glyphs is only a part of the problem... Rendering arabic typography requires that you use different renderings of the character glyphs depending on whether the character is at the start, middle or end of a word, and whether it forms ligatures with the characters around it. This is a very hard problem to get right. In full text rendering systems, this is usually addressed by a Complex Text Layout engine (CTL) to handle the dynamic re-rendering of typography as the text changes. The Unicode spec has extensive material on this, which might be worth reading. None of the fltk variants provide a CTL for you, so you need to provide your own. If all your strings are fixed, then you can usually just "hand-code" the correct glyph sequences into your menus and all will be fine. However, if you need to dynamically alter the text then things can get a little tricky... So - (the "simple" case) if you just want to create a GUI with fixed menus and buttons labelled with unchangeable arabic text, then either fltk-2 or the patched fltk-1.1 variants can work for you. You simply label the widgets with the relevant utf8 encoded strings, and ensure that your app, at startup, loads an appropriate font to render these labels (any of the free fonts form the ArabEyes collection would probably do for a starter.) Or - (the difficult case) if you want to render strings that change dynamically (e.g. an arabic word processor for example) then you'd have to do a lot of work to create a CTL to manage the typography (or link in a CTL from elsewhere, there are several options on the web.) But that is not easy, and I do not know of any fltk user who has done this, so I don't think there are any examples you can follow. Sorry not to be able to offer you any concrete examples, but hope this has been helpful anyway. -- Ian _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

