[Gambas-user] special chars bug solved!

Benoit Minisini gambas at ...1...
Wed May 31 02:08:57 CEST 2006


On Wednesday 31 May 2006 01:06, Stefano Palmeri wrote:
> Hi, Benoit.
>
> Last week I posted some messages about
> a 'special chars bug' in the Editor control.
>
> Finally, I've got the solution.
>
> I noticed that if in the Editor control properties I select a font
> different than my KDE (.qtrc?) default font or I set Editor1.Font.*
> in the code, then I can type and see those special chars (àòùìèé).
>
> Moreover, I saw that Gambas2 doesn't store
> the Editor font value in the relative *.form file,
> if the selected font is equal to the Application.Font.Name.
>
> So, I modified Gambas2 FProperty.class this way:
>
> PRIVATE FUNCTION GetFont(sFont AS String) AS String
>
>   DIM bDefault AS Boolean
>
>   bDefault = Font[sFont].Name = Application.Font.Name
>   IF bDefault THEN
>      [...]
>      WEND
>      IF NOT sFont THEN sFont = "+0"     <----- patch
>   ENDIF
>
> to make Gambas2 always store the font size value of controls.
>
> This workaround is partial because the user has to set at least
> once the font value in the properties.
>
> After recompiling, the bug has gone and I can see all chars in the Editor
> control, even the special ones.
>
> To draw conclusions: if the Editor control Font value is not specified
> in the relative *.form file or in the project code, I get the bug.
>
> Probably the bug is only for my system (nobody else reported it).
>
> If it doesn't hurt Gambas2, could you modify next Gambas2
> so that, when the user adds an Editor control to a Form, the
> default value Font = Font["+0"] is automatically stored?

No, it is a bad hack.

But I think I found the problem: the Editor by default sets its font to 
"monospace", and I don't know what happens if you do not have "monospace" on 
your system. 

There is no "default fixed font" on X Window, but I noticed that on systems 
using freetype, the following font aliases are defined: "monospace", "sans" 
and "serif".

I did that, because the Editor works only with a fixed font.

>
> Anyway, now I know how to work around the bug :-)
>
> Thanks for reading.
>
> Regards,
>
> Stefano Palmeri
>
> P.S. Using some kind of fonts, the cursor of the Editor control
> progressively  moves away from typed chars.
> I experienced that with "Bitstream Vera Sans", "Cursor",
> "Luxi Sans".
>

Of course, as Editor only tolerates a fixed font!

Regards,

-- 
Benoit Minisini




More information about the User mailing list