Menu

#4 Real Unicode bitmap/windows font

open-accepted
nobody
None
5
2011-05-12
2011-05-11
No

Hello,

I needed real Unicode text (w/o any limitation) in my application, so I took the challenge and implemented it.

With my changes, the bitmap font IS Unicode aware. I kept the existing published structure (ranges) for backward compatibility with form files, although I would have implemented it a little different. The property names like "StartASCII" are kept for the same reason.
The ranges have widechar start/stop, and a lot of logic is adjusted.
Basic types are now "char" and "string" (no Ansi anymore), so it should be still compatible with older Delphi versions.

The WindowsFont class has very simple "EnsureString" and "EnsureChars" methods to add everything necessary for the display.
EnsureChars takes a range, EnsureString takes a string (w/o any kind of sorting, just pass anything you need :)). They are both adding content, not removing anything. Use Ranges.Clear to start clean.

Look at the included WinFont demo to see how simple it works...
I hope it gets accepted...

Side effects: WideBitmapFont is not needed anymore (I did not change it); glwindows is also adjusted (removed "ansi").

Offtopic: I also adjusted the canvas bench, it was not fair to compare onscreen drawing with opengl doublebuffering.

Regards,
Gabriel

Discussion

  • YarUnderoaker

    YarUnderoaker - 2011-05-12

    Okay, I will check.

     
  • YarUnderoaker

    YarUnderoaker - 2011-05-12
    • status: open --> open-accepted
     
  • YarUnderoaker

    YarUnderoaker - 2011-05-12

    Gabriel
    Can you make topic in forum https://sourceforge.net/apps/phpbb/glscene/
    After applying your patch in UTF8Decode(,,,) only ????
    I write some arabic symbols there, but result on screen is steal same - ???? .
    Tested in Delphi 2009

     
  • Gabriel Corneanu

    Sorry, I do not understand if it worked or not.
    I used UTF8Decode exactly to avoid writing random Chinese characters.
    You should write directly any Unicode string, or UTF8Decode another string...
    I only have D2010, but I do not expect problems with 2009...
    If you take any Unicode chars, be sure to select a font which can display them...

     
  • Gabriel Corneanu

    v2

     
  • Gabriel Corneanu

    2nd version, Lazarus compatibility (including GUI components)