News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Unicode and displaying non-Latin alphabets

Started by jj2007, December 05, 2015, 08:28:44 AM

Previous topic - Next topic

jj2007

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__