Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Limited Chinese Character Set

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limited Chinese Character Set

    This probably proves that some people will cheat at anything.
    I needed to use a small number of Chinese characters for a company project. Unfortunately, PB does not yet fully support Unicode and the code samples I found here didn't solve the problem.

    It occurred to me that a limited set of Chinese Ideographs could be created that would fit in the standard ASCII values of &h21 to &hFF.

    In order to try out this code you will have to download, unzip and install the attached file.

    Please post any comments in the thread I've started on the PowerBASIC for Windows forum.

    Code:
    #COMPILE EXE
    #DIM ALL
    
    #INCLUDE "WIN32API.INC"
    
    %DlgX = 800
    %DlgY = 470
    
    %Char1 = 1001
    
    FUNCTION PBMAIN () AS LONG
        STATIC hParent      AS DWORD
        STATIC hDlg         AS DWORD
        STATIC ClientX      AS DWORD
        STATIC ClientY      AS DWORD
        STATIC DlgSizeX     AS DWORD
        STATIC DlgSizeY     AS DWORD
        STATIC Txt          AS STRING
    
        LOCAL  lRslt        AS DWORD
        LOCAL  fhndl        AS DWORD
        LOCAL  i            AS DWORD
        LOCAL  CPageNew     AS DWORD
        LOCAL  CPageOld     AS DWORD
        LOCAL  CpageCur     AS DWORD
    
    
        DESKTOP GET CLIENT TO ClientX, ClientY
        DIALOG NEW PIXELS, 0, "Font Test", 0, 0, %DlgX, %DlgY, %WS_SYSMENU, TO hDlg
        DIALOG GET SIZE  hDlg TO DlgSizeX, DlgSizeY
        DIALOG SET LOC   hDlg, (ClientX - DlgSizeX) / 2, (ClientY - DlgSizeY) / 2
    
        CONTROL ADD LABEL, hDlg, %Char1, " ", 100, 60, 600, 352 ', %SS_CENTER OR %SS_CENTERIMAGE 'OR %SS_NOTIFY
        CONTROL SET COLOR hDlg, %Char1, %BLUE, %WHITE
    
        FONT NEW "LimitedChineseCharacterSet", 14, 1, 1, 0, 0 TO fhndl
        CONTROL SET FONT hDlg, %Char1, fhndl
        
        FOR i = &h21 TO &hFF
            Txt = Txt + CHR$(i) + " "
        NEXT i
    
        CONTROL SET TEXT hDlg, %Char1, Txt
    
        FONT END fhndl
    
        DIALOG SHOW MODAL hDlg, CALL ShowDlg TO lRslt
        
    
    END FUNCTION
    
    '******************************************************************************
    '   ** CallBacks **
    '******************************************************************************
    CALLBACK FUNCTION ShowDlg()
    
    END FUNCTION
    Attached Files
Working...
X