home *** CD-ROM | disk | FTP | other *** search
/ DOKAN 17 / DOKAN17.iso / Progs / Pjv03dde.zip / PJV03DDE / SRCCODE / MAIN / NIHONGO.PAS
Pascal/Delphi Source File  |  1999-08-29  |  21KB  |  641 lines

  1. //
  2. //  NIHONGO ENGINE v0.3d for Delphi 2.0+ [29/08/99]
  3. //  (c)1999 Pulsar Studio, all rights reserved.
  4. //  Freeware. Developed by Lord Trancos.
  5. //
  6. //  This is a recopilation and adaptation of some routines
  7. //  that I created in 97 for Turbo Pascal.
  8. //
  9. //  Please, distribute the source code without any modification.
  10. //
  11. //  Greetings to Dark Shadow, R⌠nin, Multidimensional Careto,
  12. //  Takuya, Kanjiman, FidoNet r34.Japones, FIC BBS,
  13. //  DOKAN and ONELIST.COM MLJ (Mail List Japones)
  14. //
  15.  
  16. {$A-}
  17.  
  18. unit NIHONGO;
  19.  
  20. // --------------------------------------------------------------------
  21.  
  22. INTERFACE
  23.  
  24. uses Windows, SysUtils;
  25.  
  26. const  jJAPFNT    = 'JVIEWER.JAP'; // Japanese Characters File Name
  27.        jASCFNT    = 'JVIEWER.ASC'; // Ascii Characters File Name
  28.  
  29. // Main Functions
  30. function  jInitialize: boolean;
  31. procedure jClose;
  32. function  jWriteSJS(_x, _y: integer; _dstW, _dstH: word;
  33.                     _text: string; _vert, _xor: boolean;
  34.                     _hdc: HDC): boolean;
  35. function  jWriteEUC(_x, _y: integer; _dstW, _dstH: word;
  36.                     _text: string; _vert, _xor: boolean;
  37.                     _hdc: HDC): boolean;
  38. function  jEUC2SJS(_str: string): string; // jInitialize not requiered.
  39. function  jBreakSJS(_text: string; _length: word): string; // jInitialize not requiered.
  40.  
  41. // Aditional Functions - jInitialize requiered
  42. function aDrawChar(_x, _y: integer; _dstW, _dstH: word;
  43.                    _chr: word; _xor: boolean; _hdc: HDC): boolean;
  44. function jDrawChar(_x, _y: integer; _dstW, _dstH: word;
  45.                    _chr: word; _xor: boolean; _hdc: HDC): boolean;
  46. function jChooseChar(_w: word): word;
  47.  
  48. // More Aditional Functions - jInitialize not requiered
  49. function jOpenBinFile(_fn: string; var _f: file): boolean;
  50. function jLoadFile(_src: string; _dest: pointer): boolean;
  51.  
  52. // --------------------------------------------------------------------
  53.  
  54. IMPLEMENTATION
  55.  
  56. type   jCHAR  = array[0..31] of byte; // Japanese Character Data
  57.                                       // 16x16 pixels (1 bpp)
  58.        aCHAR  = array[0..15] of byte; // Ascii Character Data
  59.                                       // 8x16 pixels (1 bpp)
  60.  
  61. const  NUMCHARS = 6877; // Total Japanese Characters
  62.        NUMASC   = 256;  // Total Ascii Characters
  63.  
  64.        // Don't modify
  65.        POS00 = 6524;
  66.        POS01 =    2;
  67.        POS02 = 6187;
  68.        POS03 = 4683;
  69.        POS04 = 3179;
  70.        POS05 = 1675;
  71.        POS06 =  171;
  72.  
  73.        BRK00 = #32;
  74.        BRK01 = #47;
  75.  
  76. var    jCHARS   : array[1..NUMCHARS] of jCHAR; // jFont in Memory
  77.        aCHARS   : array[1..NUMASC] of aCHAR;   // aFont in Memory
  78.        jPIC     : HBITMAP;                     // Bitmap used to Draw
  79.        jASC     : HBITMAP;                     // Bitmap used to Draw
  80.        JPICDC   : HDC;                         // DC used to Draw
  81.        jASCDC   : HDC;                         // DC used to Draw
  82.        jKANJIS  : array[1..32] of byte;        // Don't modify
  83.  
  84. // --------------------------------------------------------------------
  85.  
  86. function jOpenBinFile(_fn: string; var _f: file): boolean;
  87.  
  88. begin
  89.   Assign(_f, _fn);
  90.   {$I-}
  91.   FileMode := 0;
  92.   Reset(_f, 1);
  93.   {$I+}
  94.   if (IOResult <> 0) and (_fn <> '') then
  95.     jOpenBinFile := false else jOpenBinFile := true;
  96. end;
  97.  
  98. // --------------------------------------------------------------------
  99.  
  100. function jLoadFile(_src: string; _dest: pointer): boolean;
  101.  
  102. var _f : file;
  103.     _s : longint;
  104.     _r : boolean;
  105.  
  106. begin
  107.   _r := false;
  108.   if jOpenBinFile(_src, _f) = true then
  109.     begin
  110.       _s := FileSize(_f);
  111.       {$I-}
  112.       BlockRead(_f, _dest^, _s);
  113.       {$I+}
  114.       if (IOResult = 0) then _r := true;
  115.       CloseFile(_f);
  116.     end;
  117.   jLoadFile := _r;
  118. end;
  119.  
  120. // --------------------------------------------------------------------
  121.  
  122. function jHispaFilter(_chr: word): word;
  123.  
  124. // support for windows spanish chars
  125.  
  126. var _r: word;
  127.  
  128. begin
  129.   _r := pred(_chr);
  130.   case _r of
  131.     $D1: _r := $A5; // ╤
  132.     $F1: _r := $A4; // ±
  133.     $E1: _r := $A0; // ß
  134.     $E9: _r := $82; // Θ
  135.     $ED: _r := $A1; // φ
  136.     $F3: _r := $A2; // ≤
  137.     $FA: _r := $A3; // ·
  138.     $C1: _r := $A0; // ┴
  139.     $C9: _r := $82; // ═
  140.     $CD: _r := $A1; // ┌
  141.     $D3: _r := $A2; // ╔
  142.     $DA: _r := $A3; // ╙
  143.   end;
  144.   inc(_r);
  145.   jHispaFilter := _r;
  146. end;
  147.  
  148. // --------------------------------------------------------------------
  149.                    {
  150. procedure jDoubleSpaceFilter(var _str: string);
  151.  
  152. // change 'ü@' with '  '
  153.  
  154. var _cnt : byte;
  155.  
  156. begin
  157.   if length(_str) < 2 then exit;
  158.  
  159.   for _cnt := 1 to length(_str)-1 do
  160.     if (byte(_str[_cnt]) = 129) and (byte(_str[_cnt+1]) = 64)
  161.       then begin _str[_cnt] := ' '; _str[_cnt+1] := ' '; end;
  162. end;
  163.                    }
  164. // --------------------------------------------------------------------
  165.  
  166. function aDrawChar(_x, _y: integer; _dstW, _dstH: word;
  167.                    _chr: word; _xor: boolean; _hdc: HDC): boolean;
  168. {
  169.    _x, _y        - destination into the window
  170.    _dstW, _dstH  - destination size (must be 8x16 or more.
  171.                                      recomended sizes: 8x16, 16x32, ..)
  172.    _chr          - ascii character #
  173.    _xor          - invert character
  174.    _hdc          - destination HDC
  175. }
  176.  
  177. var{_src  : HDC;}
  178.     _jChr : jCHAR;
  179.     _cnt  : byte;
  180.  
  181. begin
  182.   aDrawChar := false;
  183.  
  184.   // Check selected character and size
  185.   if (_chr = 0) or (_chr > NUMASC) then exit;
  186.   if (_dstW < 8) or (_dstH < 16) then exit; // Lower size is stupid!
  187.  
  188.   // Select DC
  189. {  _src := CreateCompatibleDC(_hdc);
  190.   if _src = NULL then exit; }
  191. {  if SelectObject(jASCDC, jASC) = NULL then exit; }
  192.  
  193.   // Draw into the Bitmap
  194.   if _xor = false then
  195.     for _cnt := 0 to 15 do _jChr[_cnt shl 1] := aCHARS[_chr][_cnt]
  196.       else for _cnt := 0 to 15 do _jChr[_cnt shl 1] := not aCHARS[_chr][_cnt];
  197.   if SetBitmapBits(jASC, sizeof(jCHAR), @_jChr) = 0 then exit;
  198.  
  199.   // Draw Bitmap
  200.   if (_dstW = 8) and (_dstH = 16) then
  201.     begin
  202.       if BitBlt(_hdc, _x, _y, 8, 16, jASCDC, 0, 0,
  203.                 SRCCOPY) = false then exit;
  204.     end else
  205.       if StretchBlt(_hdc, _x, _y, _dstW, _dstH, jASCDC, 0, 0,
  206.                     8, 16, SRCCOPY) = false then exit;
  207. {
  208.   // Release and Delete DCs
  209.   if DeleteDC(_src) = false then exit;
  210. }
  211.   // all ok!
  212.   aDrawChar := true;
  213. end;
  214.  
  215. // --------------------------------------------------------------------
  216.  
  217. function jDrawChar(_x, _y: integer; _dstW, _dstH: word;
  218.                    _chr: word; _xor: boolean; _hdc: HDC): boolean;
  219. {
  220.    _x, _y        - destination into the window
  221.    _dstW, _dstH  - destination size (must be 16 or more.
  222.                                      recomended sizes: 16, 32, 64...)
  223.    _chr          - japanese character #
  224.    _xor          - invert character
  225.    _hdc          - destination HDC
  226. }
  227.  
  228. var{_src  : HDC;}
  229.     _jChr : jCHAR;
  230.     _cnt  : byte;
  231.  
  232. begin
  233.   jDrawChar := false;
  234.  
  235.   // Check selected character and size
  236.   if (_chr = 0) or (_chr > NUMCHARS) then exit;
  237.   if (_dstW < 16) or (_dstH < 16) then exit; // Lower size is stupid!
  238.  
  239.   // Select DC
  240. { _src := CreateCompatibleDC(_hdc);
  241.   if _src = NULL then exit; }
  242. {  if SelectObject(jPICDC, jPIC) = NULL then exit; }
  243.  
  244.   // Draw into the Bitmap
  245.   if _xor = false then
  246.     begin
  247.       for _cnt := 0 to 15 do
  248.         begin
  249.           _jChr[(_cnt shl 1)] := jCHARS[_chr][_cnt];
  250.           _jChr[(_cnt shl 1) + 1] := jCHARS[_chr][_cnt + 16];
  251.         end;
  252.     end else
  253.       begin
  254.         for _cnt := 0 to 15 do
  255.           begin
  256.             _jChr[(_cnt shl 1)] := not jCHARS[_chr][_cnt];
  257.             _jChr[(_cnt shl 1) + 1] := not jCHARS[_chr][_cnt + 16];
  258.           end;
  259.       end;
  260.   if SetBitmapBits(jPIC, sizeof(jCHAR), @_jChr) = 0 then exit;
  261.  
  262.   // Draw Bitmap
  263.   if (_dstW = 16) and (_dstH = 16) then
  264.     begin
  265.       if BitBlt(_hdc, _x, _y, 16, 16, jPICDC, 0, 0,
  266.                 SRCCOPY) = false then exit;
  267.     end else
  268.       if StretchBlt(_hdc, _x, _y, _dstW, _dstH, jPICDC, 0, 0,
  269.                     16, 16, SRCCOPY) = false then exit;
  270. {
  271.   // Release and Delete DCs
  272.   if DeleteDC(_src) = false then exit;
  273. }
  274.   // all ok!
  275.   jDrawChar := true;
  276. end;
  277.  
  278. // --------------------------------------------------------------------
  279.  
  280. function jEUC2SJS(_str: string): string;
  281.  
  282. var _cnt: byte;
  283.     _res: String;
  284.  
  285. Begin
  286.   _res := _str;
  287.   if length(_str)>0 then
  288.   begin
  289.     _cnt := 0;
  290.     repeat
  291.       inc(_cnt);
  292.       if (byte(_res[_cnt])>126) and (length(_str)>1) then
  293.       case byte(_res[_cnt]) of
  294.         164: if (byte(_res[_cnt+1])>160) and (byte(_res[_cnt+1])<244) then
  295.                begin                              { Hiragana }
  296.                  byte(_res[_cnt]) := 130;
  297.                  inc(_cnt);
  298.                  dec(byte(_res[_cnt]), 2);
  299.                end;
  300.         165: if (byte(_res[_cnt+1])>160) and (byte(_res[_cnt+1])<247) then
  301.                begin                              { Katagana }
  302.                  byte(_res[_cnt]) := 131;
  303.                  inc(_cnt);
  304.                  if byte(_res[_cnt])<224 then dec(byte(_res[_cnt]), 97)
  305.                    else dec(byte(_res[_cnt]), 96);
  306.                end;
  307.         163: begin                                { Lat }
  308.                byte(_res[_cnt]) := 130;
  309.                inc(_cnt);
  310.                if byte(_res[_cnt])<224 then dec(byte(_res[_cnt]), 97)
  311.                  else dec(byte(_res[_cnt]), 96);
  312.              end;
  313.         166: begin                                { Grc }
  314.                byte(_res[_cnt]) := 131;
  315.                inc(_cnt);
  316.                dec(byte(_res[_cnt]), 2);
  317.              end;
  318.         167: begin                                { Rus }
  319.                byte(_res[_cnt]) := 132;
  320.                inc(_cnt);
  321.                if byte(_res[_cnt])<224 then dec(byte(_res[_cnt]), 97)
  322.                  else dec(byte(_res[_cnt]), 96);
  323.              end;
  324.         168: begin                                { Lin }
  325.                byte(_res[_cnt]) := 132;
  326.                inc(_cnt);
  327.                dec(byte(_res[_cnt]), 2);
  328.              end;
  329.         161: begin                                { Misc 1 }
  330.                byte(_res[_cnt]) := 129;
  331.                inc(_cnt);
  332.                if byte(_res[_cnt])<224 then dec(byte(_res[_cnt]), 97)
  333.                  else dec(byte(_res[_cnt]), 96);
  334.              end;
  335.         162: begin                                { Misc 2 }
  336.                byte(_res[_cnt]) := 129;
  337.                inc(_cnt);
  338.                dec(byte(_res[_cnt]), 2);
  339.              end;
  340.         else if ((byte(_res[_cnt])>175) and (byte(_res[_cnt])<223)) or
  341.                 ((byte(_res[_cnt])>222) and (byte(_res[_cnt])<245)) then
  342.                begin
  343.                  if byte(_res[_cnt]) and $01 = $00 then
  344.                    begin
  345.                      if ((byte(_res[_cnt])>175) and (byte(_res[_cnt])<223)) then
  346.                        byte(_res[_cnt]):=(136+((byte(_res[_cnt])-176) div 2)) else
  347.                          byte(_res[_cnt]):=(224+((byte(_res[_cnt])-224) div 2));
  348.                      inc(_cnt);
  349.                      dec(byte(_res[_cnt]), 2);
  350.                    end else
  351.                      begin
  352.                        if ((byte(_res[_cnt])>175) and (byte(_res[_cnt])<223)) then
  353.                          byte(_res[_cnt]):=(137+((byte(_res[_cnt])-177) div 2)) else
  354.                            byte(_res[_cnt]):=(224+((byte(_res[_cnt])-223) div 2));
  355.                        inc(_cnt);
  356.                        if byte(_res[_cnt])<224 then dec(byte(_res[_cnt]), 97)
  357.                          else dec(byte(_res[_cnt]), 96);
  358.                      end;
  359.                end;
  360.       end;
  361.     until _cnt >= length(_res);
  362.   end;
  363.   jEUC2SJS := _res;
  364. end;
  365.  
  366. // --------------------------------------------------------------------
  367.  
  368. function jChooseChar(_w: word): word;
  369.  
  370. // _w - SJS value
  371.  
  372. var _from  : word;
  373.     _plus  : word;
  374.     _b     : byte;
  375.     _c     : array[1..2] of byte;
  376.     _d, _z : longint;
  377.  
  378. begin
  379.   _from := 0;
  380.   _plus := 0;
  381.   _c[1] := _w shr 8;
  382.   _c[2] := _w and $FF;
  383.   Case _c[1] of
  384.       129: if _c[2] = 64 then
  385.                begin
  386.                  _from := 1;
  387.                  _plus := 0;
  388.                end else
  389.                begin
  390.                  _from := POS00 + 208;
  391.                  if (_c[2]>64)  and (_c[2]<173) and (_c[2]<>127) then
  392.                    if (_c[2]<127)
  393.                      then _plus := _c[2] - 65
  394.                         else _plus := _c[2] - 66;
  395.                  if (_c[2]>183) and (_c[2]<192) then _plus := _c[2] - 77;
  396.                  if (_c[2]>199) and (_c[2]<207) then _plus := _c[2] - 85;
  397.                  if (_c[2]>217) and (_c[2]<233) then _plus := _c[2] - 96;
  398.                  if (_c[2]>239) and (_c[2]<248) then _plus := _c[2] - 103;
  399.                  if (_c[2]=252) then _plus := _c[2] - 107;
  400.                end;
  401.       130: if (_c[2]>158) and (_c[2]<242) then
  402.              begin
  403.                _from := POS01;
  404.                _plus := _c[2] - 159;
  405.              end else
  406.                begin
  407.                  _from := POS00;
  408.                  if (_c[2]>78)  and (_c[2]<89)  then _plus := _c[2] - 79;
  409.                  if (_c[2]>95)  and (_c[2]<122) then _plus := _c[2] - 86;
  410.                  if (_c[2]>128) and (_c[2]<155) then _plus := _c[2] - 93;
  411.                end;
  412.       131: if (_c[2]>63) and (_c[2]<151) and (_c[2]<>127) then
  413.              begin
  414.                _from := POS01 + 83;
  415.                if _c[2] < 127
  416.                  then _plus := _c[2] - 64
  417.                    else _plus := _c[2] - 65;
  418.              end else
  419.                begin
  420.                  _from := POS00 + 62;
  421.                  if (_c[2]>158) and (_c[2]<183) then _plus := _c[2] - 159;
  422.                  if (_c[2]>190) and (_c[2]<215) then _plus := _c[2] - 167;
  423.                end;
  424.       132: begin
  425.              _from := POS00 + 110;
  426.              if (_c[2]>63)  and (_c[2]<97)  then _plus := _c[2] - 64;
  427.              if (_c[2]>111) and (_c[2]<146) and (_c[2]<>127) then
  428.                if _c[2] < 127
  429.                  then _plus := _c[2] - 79
  430.                    else _plus := _c[2] - 80;
  431.              if (_c[2]>158) and (_c[2]<191) then _plus := _c[2] - 93
  432.            end;
  433.       136: if (_c[2]>158) and (_c[2]<253) then
  434.              begin
  435.                _from := POS02;
  436.                _plus := _c[2] - 159;
  437.              end;
  438.       152: begin
  439.              _from := POS02 + 94;
  440.              if (_c[2]>63)  and (_c[2]<115) then _plus := _c[2] - 64;
  441.              if (_c[2]>158) and (_c[2]<253) then _plus := _c[2] - 108;
  442.            end;
  443.       234: if (_c[2]>63) and (_c[2]<163) and (_c[2]<>127) then
  444.              begin
  445.                _from:= POS02 + 239;
  446.                if (_c[2]<127)
  447.                  then _plus := _c[2] - 64
  448.                    else _plus := _c[2] -65;
  449.              end;
  450.       else if ((_c[1]>136) and (_c[1]<152)) or
  451.               ((_c[1]>152) and (_c[1]<160)) or
  452.               ((_c[1]>223) and (_c[1]<234)) then
  453.                 begin
  454.                   if (_c[2]>63) and (_c[2]<>127) and (_c[2]<253) then
  455.                     begin
  456.                       for _b := 1 to 32 do
  457.                         if _c[1] = jKANJIS[_b] then
  458.                           begin
  459.                             case (_b - 1) shr 3 of
  460.                               0: _from := POS06;
  461.                               1: _from := POS05;
  462.                               2: _from := POS04;
  463.                               3: _from := POS03;
  464.                             end;
  465.                             _d := ((_b - (((_b - 1) shr 3) shl 3)) - 1);
  466.                             inc(_from, longint(_d * 188));
  467.                           end;
  468.                        if _c[2] < 127
  469.                          then _plus := _c[2] - 64
  470.                            else _plus := _c[2] - 65;
  471.                     end;
  472.                 end;
  473.   end;
  474.   jChooseChar := _from + _plus;
  475. end;
  476.  
  477. // --------------------------------------------------------------------
  478.  
  479. function jWriteSJS(_x, _y: integer; _dstW, _dstH: word;
  480.                    _text: string; _vert, _xor: boolean;
  481.                    _hdc: HDC): boolean;
  482.  
  483. var _cnt : byte;
  484.     _id  : word;
  485.     _r   : boolean;
  486.     _chr : word;
  487.  
  488. begin
  489. {  jDoubleSpaceFilter(_text); }
  490.  
  491.   _r := true;
  492.   _cnt := 1;
  493.  
  494.   if length(_text) > 0 then
  495.     repeat
  496.       if (_cnt <= length(_text)) then
  497.         begin
  498.           if _cnt = length(_text) then _id := 0
  499.             else _id := jChooseChar((byte(_text[_cnt]) shl 8)
  500.                                    + byte(_text[_cnt + 1]));
  501.           if _id <> 0 then
  502.             begin
  503.               jDrawChar(_x, _y, _dstW, _dstH, _id, _xor, _hdc);
  504.               inc(_cnt, 1);
  505.               if _vert = false
  506.                 then inc(_x, _dstW shr 1);
  507. {                  else inc(_y, _dstH); }
  508.             end else begin
  509.                        _chr := byte(_text[_cnt]) + 1;
  510.                        _chr := jHispaFilter(_chr);
  511.                        aDrawChar(_x, _y, _dstW shr 1, _dstH,
  512.                                  _chr, _xor, _hdc);
  513.                      end;
  514.         end;
  515.       inc(_cnt);
  516.       if _vert = false
  517.         then inc(_x, _dstW shr 1)
  518.           else inc(_y, _dstH);
  519.     until _cnt > length(_text);
  520.  
  521.   jWriteSJS := _r;
  522. end;
  523.  
  524. // --------------------------------------------------------------------
  525.  
  526. function  jWriteEUC(_x, _y: integer; _dstW, _dstH: word;
  527.                     _text: string; _vert, _xor: boolean;
  528.                     _hdc: HDC): boolean;
  529.  
  530. // Don't use a constant as _text with Delphi,
  531. // use only strings!
  532.  
  533. begin
  534.   jWriteEUC := jWriteSJS(_x, _y, _dstW, _dstH, jEUC2SJS(_text),
  535.                          _vert, _xor, _hdc);
  536. end;
  537.  
  538. // --------------------------------------------------------------------
  539.  
  540. function  jBreakSJS(_text: string; _length: word): string;
  541.  
  542. // Break a SJS chain
  543.  
  544. var _cnt   : word;
  545.     _id    : word;
  546.     _z, _x : boolean;
  547.     _spc   : word;
  548.  
  549. begin
  550.   _z := false;
  551.   _x := false;
  552.   _spc := 0;
  553.  
  554. {  jDoubleSpaceFilter(_text);}
  555.   _cnt := 1;
  556.  
  557.   if length(_text) > 0 then
  558.     repeat
  559.       if (_cnt <= length(_text)) then
  560.         begin
  561.           if _cnt = length(_text) then _id := 0
  562.             else _id := jChooseChar((byte(_text[_cnt]) shl 8)
  563.                                    + byte(_text[_cnt + 1]));
  564.           if _id <> 0
  565.             then inc(_cnt, 1)
  566.               else begin
  567.                      if (_text[_cnt] = BRK00)
  568.                        or (_text[_cnt] = BRK01) then _spc := _cnt;
  569.                    end;
  570.           if (_cnt - 1 = _length - 1) and (_id <> 0) then _x := true;
  571.           if (_cnt - 1 = _length) and (_id <> 0) then _z := true;
  572.         end;
  573.       inc(_cnt);
  574.     until _cnt > length(_text);
  575.  
  576.   if _x = false then
  577.     if _z = true then dec(_length)
  578.       else if (_spc > 0) and (_spc < _length) then _length := _spc;
  579.   SetLength(_text, _length);
  580.   jBreakSJS := _text;
  581. end;
  582.  
  583. // --------------------------------------------------------------------
  584.  
  585. function jInitialize: boolean;
  586.  
  587. var _r : boolean;
  588.     _c : byte;
  589.  
  590. begin
  591.   _r := true;
  592.  
  593.   // Init jKANJIS
  594.   for _c := 137 to 151 do jKANJIS[_c - 136] := _c;
  595.   for _c := 153 to 159 do jKANJIS[_c - 137] := _c;
  596.   for _c := 224 to 233 do jKANJIS[_c - 201] := _c;
  597.  
  598.   // Load FNTs
  599.   if jLoadFile(ExtractFileDir(paramstr(0)) +'\'+ jJAPFNT,
  600.                @jCHARS) = false then _r := false;
  601.   if jLoadFile(ExtractFileDir(paramstr(0)) +'\'+ jASCFNT,
  602.                @aCHARS) = false then _r := false;
  603.  
  604.   // Create BMPs
  605.   jASC := CreateBitmap(16, 16, 1, 1, NIL); // Yes, it's Ok (isn't 8)
  606.   if jASC = NULL then _r := false;
  607.   jPIC := CreateBitmap(16, 16, 1, 1, NIL);
  608.   if jPIC = NULL then _r := false;
  609.  
  610.   // Create DCs
  611.   jASCDC := CreateCompatibleDC(GetDC(GetDesktopWindow));
  612.   if jASCDC = NULL then _r := false;
  613.   jPICDC := CreateCompatibleDC(GetDC(GetDesktopWindow));
  614.   if jPICDC = NULL then _r := false;
  615.  
  616.   // Select Objects
  617.   if SelectObject(jASCDC, jASC) = NULL then _r := false;
  618.   if SelectObject(jPICDC, jPIC) = NULL then _r := false;
  619.  
  620.   // All ok
  621.   jInitialize := _r;
  622. end;
  623.  
  624. // --------------------------------------------------------------------
  625.  
  626. procedure jClose;
  627.  
  628. begin
  629.   // Delete DCs
  630.   DeleteDC(jASCDC);
  631.   DeleteDC(jPICDC);
  632.  
  633.   // Delete BMPs
  634.   DeleteObject(jASC);
  635.   DeleteObject(jPIC);
  636. end;
  637.  
  638. // --------------------------------------------------------------------
  639.  
  640. END.
  641.