Announcement

Collapse
No announcement yet.

Limited Chinese Character Set

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

  • Limited Chinese Character Set

    I found that limited number of Chinese character could be assigned to the single byte addresses used by standard ASCII characters. Obviously, this technique is useless for preparing Chinese texts. However, it works OK when you need a limited number of characters for GUI labels.

    Sample code titled Limited Chinese Character Set is posted in the Source Code forum.

  • #2
    That's very interesting - but what does it all mean?

    If you add these lines to the source code you don't need to have the font installed - just in the same folder as the exe.
    Code:
        [COLOR=gray]LOCAL  CpageCur     AS DWORD[/COLOR]
     
        STATIC sFontFile    As String
        STATIC hFont        As Dword
     
        sFontFile = "LimitedChineseCharacterSet.ttf" '<- from file
        lRslt = AddFontResource(BYVAL STRPTR(sFontFile))
        SendMessage(%HWND_BROADCAST, %WM_FONTCHANGE, 0, 0)
     
        [COLOR=gray]DESKTOP GET CLIENT TO ClientX, ClientY[/COLOR]
        ...
        [COLOR=gray]DIALOG SHOW MODAL hDlg, CALL ShowDlg TO lRslt[/COLOR]
     
        DeleteObject hFont
        RemoveFontResource( BYVAL VARPTR(sFontFile))
     
    [COLOR=gray]END FUNCTION[/COLOR]
    (I believe you could include the font as a resouce too. RDATA perhaps?).

    BTW. What did you use to create the .ttf file?
    Rgds, Dave

    Comment


    • #3
      For non-PB9 upgrades... (replace FONT NEW , CONTROL SET FONT)
      Code:
      #INCLUDE "PBFORMS.INC"
      ...
      sFontFile = "C:\PowerBasic\PBWin80\Samples\Test_Samples\LimitedChineseCharacterSet.ttf" '<-change to your path
      lRslt = AddFontResource(BYVAL STRPTR(sFontFile))
      hFont = PBFormsMakeFont("LimitedChineseCharacterSet",14,%FW_NORMAL,%FALSE,%FALSE,%FALSE,%DEFAULT_CHARSET)
      CONTROL SEND hDlg,%Char1,%WM_SETFONT,hFont,%TRUE
      ...
      IF ISTRUE(hFont) THEN DeleteObject hFont
      RemoveFontResource( BYVAL VARPTR(sFontFile))

      Comment


      • #4
        BTW. What did you use to create the .ttf file?
        Hi Dave;

        I used Font Creator 5.5.

        Comment


        • #5
          That's very interesting - but what does it all mean?
          I don't know, its all Chinese to me.

          BTW Thanks for the suggestion. I'll use it the final project.

          Comment

          Working...
          X