Author Topic: Unicode and displaying non-Latin alphabets  (Read 1407 times)

jj2007

  • Member
  • *****
  • Posts: 10543
  • Assembler is fun ;-)
    • MasmBasic
Unicode and displaying non-Latin alphabets
« on: December 05, 2015, 08:28:44 AM »
A little demo showing what can be done with Unicode:

GuiParas equ "Displaying exotic languages", x500, w360, h360, b0D0D0D0h      ; OPT_Icon Globe
include \masm32\MasmBasic\Res\MbGui.asm
  MakeFont hFont1, Height:22, Weight:FW_MEDIUM, "Times New Roman"            ; a nice font for Arabic
  MakeFont hFont2, Height:20, "Arial"
  MakeBrush hBrush, RgbCol(180, 180, 180), HS_DIAGCROSS      ; HS_x para is optional, see CreateHatchBrush docs
  Data "Chinese:", "这是中国文字", "它被写入左到右", "Arabic:", "هنا مثال يمكنك من الكتابة من اليمين", "الى اليسار باللغة العربية"
  Data "Russian:", "Это демонстрация российского текста,", "это пишется слева направо"
  Read d$()            ; fill a string array with data
Event Paint
  For_ ct=0 To d$(?)-1
      .if ct>2 && ct<6 || ct>8 && ct<=10
            GuiTextBox 7.0, ct*36+9, 90.0, 20, d$(ct), dt DT_RIGHT, pen CgaCol(cWhite):3, bcol RgbCol(80, 255, 80), font hFont1, brush hBrush
      .else
            GuiTextBox 7, ct*36+9, 90.0, 20, d$(ct), dt DT_LEFT, pen 0:2, font hFont2, bcol 080ffffh
      .endif
  Next
GuiEnd

Mikl__

  • Member
  • *****
  • Posts: 1008
Re: Unicode and displaying non-Latin alphabets
« Reply #1 on: December 08, 2015, 12:40:38 PM »
Hi, Jochen!
Bravo!