收费 qrcode 识别库 提供delphi demo ,c语言demo 需要的联系,一个52KB的库搞定二维码识别哦 QQ 1565498246
作品1: YesReport所见所得的WEB报表设计、打印插件,数据源不直接连接数据库,而是URL,支持PHP,JSP,ASP等所有支持JSON的后端,简单易学。

               免费下载YesReport插件测试版


作品2:立象条码打印机打印QRCODE条码。 免费下载演示版
作品3: 简单的开关按钮 源码下载
作品4:delphi陷阱大全3下载PDF
delphi陷阱大全4,修订错误下载更新pdf
作品5:ICS组件移植到lazarus 下载源码
作品6: lazarus入门教程300页下载PDF
作品7: Jar重复包下载工具下载来看看
作品8: 小小说编辑器用用看
作品9: 单据编号大漏洞在线阅读pdf
友情链接:
易博龙/英巴卡迪诺 Delphi盒子 cnpack delphi园地 不得闲 万一的博客 咏南的Delphi博客 D10.天地弦 delphi IOCP 楠楠 星五
下面是优秀开源组件
delphi iocp framework zeoslib zeoslib forum ICS JEDI Torry Delphiarea CSDN Delphi RealThinClient QDAC
下面各位基本是来自盛大的: savetime 橙子 张无忌 武稀松 阿杜

steven's blogs

lazarus,delphi,develop

lazarus,synedit输入小键盘特殊符号的补丁


unit synedittextdoublewidthchars2; // fix up chinese symbel width //by steven {$mode objfpc}{$H+} interface uses Classes, SysUtils; type TInterval=record first:longword; last:longword; end; function mk_wcswidth(wcs:unicodestring ):integer; function mk_wcwidth(ucs:longword):integer; implementation const combining:array[0..122] of Tinterval= ((first: $0300;last:$0357 ), (first: $035D;last:$036F ), (first: $0483;last:$0486 ), (first: $0488;last:$0489 ), (first: $0591;last:$05A1 ), (first: $05A3;last:$05B9 ), (first: $05BB;last:$05BD ), (first: $05BF;last:$05BF ), (first: $05C1;last:$05C2 ), (first: $05C4;last:$05C4 ), (first: $0600;last:$0603 ), (first: $0610;last:$0615 ), (first: $064B;last:$0658 ), (first: $0670;last:$0670 ), (first: $06D6;last:$06E4 ), (first: $06E7;last:$06E8 ), (first: $06EA;last:$06ED ), (first: $070F;last:$070F ), (first: $0711;last:$0711 ), (first: $0730;last:$074A ), (first: $07A6;last:$07B0 ), (first: $0901;last:$0902 ), (first: $093C;last:$093C ), (first: $0941;last:$0948 ), (first: $094D;last:$094D ), (first: $0951;last:$0954 ), (first: $0962;last:$0963 ), (first: $0981;last:$0981 ), (first: $09BC;last:$09BC ), (first: $09C1;last:$09C4 ), (first: $09CD;last:$09CD ), (first: $09E2;last:$09E3 ), (first: $0A01;last:$0A02 ), (first: $0A3C;last:$0A3C ), (first: $0A41;last:$0A42 ), (first: $0A47;last:$0A48 ), (first: $0A4B;last:$0A4D ), (first: $0A70;last:$0A71 ), (first: $0A81;last:$0A82 ), (first: $0ABC;last:$0ABC ), (first: $0AC1;last:$0AC5 ), (first: $0AC7;last:$0AC8 ), (first: $0ACD;last:$0ACD ), (first: $0AE2;last:$0AE3 ), (first: $0B01;last:$0B01 ), (first: $0B3C;last:$0B3C ), (first: $0B3F;last:$0B3F ), (first: $0B41;last:$0B43 ), (first: $0B4D;last:$0B4D ), (first: $0B56;last:$0B56 ), (first: $0B82;last:$0B82 ), (first: $0BC0;last:$0BC0 ), (first: $0BCD;last:$0BCD ), (first: $0C3E;last:$0C40 ), (first: $0C46;last:$0C48 ), (first: $0C4A;last:$0C4D ), (first: $0C55;last:$0C56 ), (first: $0CBC;last:$0CBC ), (first: $0CBF;last:$0CBF ), (first: $0CC6;last:$0CC6 ), (first: $0CCC;last:$0CCD ), (first: $0D41;last:$0D43 ), (first: $0D4D;last:$0D4D ), (first: $0DCA;last:$0DCA ), (first: $0DD2;last:$0DD4 ), (first: $0DD6;last:$0DD6 ), (first: $0E31;last:$0E31 ), (first: $0E34;last:$0E3A ), (first: $0E47;last:$0E4E ), (first: $0EB1;last:$0EB1 ), (first: $0EB4;last:$0EB9 ), (first: $0EBB;last:$0EBC ), (first: $0EC8;last:$0ECD ), (first: $0F18;last:$0F19 ), (first: $0F35;last:$0F35 ), (first: $0F37;last:$0F37 ), (first: $0F39;last:$0F39 ), (first: $0F71;last:$0F7E ), (first: $0F80;last:$0F84 ), (first: $0F86;last:$0F87 ), (first: $0F90;last:$0F97 ), (first: $0F99;last:$0FBC ), (first: $0FC6;last:$0FC6 ), (first: $102D;last:$1030 ), (first: $1032;last:$1032 ), (first: $1036;last:$1037 ), (first: $1039;last:$1039 ), (first: $1058;last:$1059 ), (first: $1160;last:$11FF ), (first: $1712;last:$1714 ), (first: $1732;last:$1734 ), (first: $1752;last:$1753 ), (first: $1772;last:$1773 ), (first: $17B4;last:$17B5 ), (first: $17B7;last:$17BD ), (first: $17C6;last:$17C6 ), (first: $17C9;last:$17D3 ), (first: $17DD;last:$17DD ), (first: $180B;last:$180D ), (first: $18A9;last:$18A9 ), (first: $1920;last:$1922 ), (first: $1927;last:$1928 ), (first: $1932;last:$1932 ), (first: $1939;last:$193B ), (first: $200B;last:$200F ), (first: $202A;last:$202E ), (first: $2060;last:$2063 ), (first: $206A;last:$206F ), (first: $20D0;last:$20EA ), (first: $302A;last:$302F ), (first: $3099;last:$309A ), (first: $FB1E;last:$FB1E ), (first: $FE00;last:$FE0F ), (first: $FE20;last:$FE23 ), (first: $FEFF;last:$FEFF ), (first: $FFF9;last:$FFFB ), (first: $1D167;last:$1D169 ), (first: $1D173;last:$1D182 ), (first: $1D185;last:$1D18B ), (first: $1D1AA;last:$1D1AD ), (first: $E0001;last:$E0001 ), (first: $E0020;last:$E007F ), (first: $E0100;last:$E01EF )); function bisearch(ucs:word; table: array of TInterval ;max:integer):boolean; var min,mid:word; begin min := 0; if(ucs < table[0].first) and (ucs > table[max].last) then begin result :=false; exit; end; while max >= min do begin mid := (min + max ) div 2; if (ucs > table[mid].last ) then min := mid + 1 else if (ucs < table[mid].first) then max := mid -1 else begin result := true; exit; end; end; result := false; end; function mk_wcwidth(ucs:longword):integer; //var ucs:longword; begin //ucs := ord(aucs); if ucs=0 then begin result := 0; exit; end; if ucs in [32,$7f..$a0] then begin result := -1; exit; end; if (ucs = $2220)or (ucs = $2312)or (ucs = $2299)or (ucs = $224c)or (ucs = $223d)or (ucs = $221a)or (ucs = $e022)or (ucs = $203b)or (ucs = $2116)or (ucs = $ffE0)or (ucs = $2103)or (ucs = $2235)or (ucs = $2234)or (ucs = $22A5)or (ucs = $2225)or (ucs = $222E)or (ucs = $221D)or (ucs = $221E)or (ucs = $2227)or (ucs = $2228)or (ucs = $2211)or (ucs = $220F)or (ucs = $222A)or (ucs = $2229)or (ucs = $2208)or (ucs = $226E)or (ucs = $226F)or (ucs = $216A)or (ucs = $216B)or (ucs = $2160)or (ucs = $2161)or (ucs = $2162)or (ucs = $2163)or (ucs = $2164)or (ucs = $2165)or (ucs = $2166)or (ucs = $2167)or (ucs = $2168)or (ucs = $2169)or (ucs = $2236)or ////------ (ucs = $2016) then begin result := 2; exit; end; if bisearch(ucs,combining,length(combining) - 1) then begin result := 0; exit; end; result := 1 ; // Hangul Jamo init. consonants */ // CJK ... Yi */ // Hangul Syllables */ // CJK Compatibility Ideographs */ // CJK Compatibility Forms */ // Fullwidth Forms */ //BUG, duplicate if(ucs <> $303f) and( (ucs = $232a) or (ucs = $2e80) or //****************patched by steven //unicode , high byte , low byte //----------------------end patch (ucs > $1100) and (ucs <$115f) or (ucs > $2329) and (ucs <$a4cf)or (ucs > $ac00) and (ucs <$d7a3)or (ucs > $f900) and (ucs <$faff)or (ucs > $fe30) and (ucs <$fe6f)or (ucs > $ff00) and (ucs <$ff60)or (ucs >$ffe0) and (ucs <$ffe6) or (ucs > $20000) and (ucs <$2fffd)or (ucs > $30000) and (ucs <$3fffd))then inc(result); end; function mk_wcswidth(wcs:unicodestring ):integer; var w,l,width:integer; i:integer; begin i:=1; width := 0; l :=length(wcs); while (i<=l) do begin w := mk_wcwidth(ord(wcs[i])); if w < 0 then begin result := -1; exit; end; width := width + w; inc(i); end; result := width; end; end.

 

{------------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -------------------------------------------------------------------------------} (* visit the following URL for more information http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt http://unicode.org/reports/tr11/ *) unit SynEditTextDoubleWidthChars; {$I synedit.inc} interface uses Classes, SysUtils, LazSynEditText ,synedittextdoublewidthchars2; type { SynEditTextDoubleWidthChars } SynEditStringDoubleWidthChars = class(TSynEditStringsLinked) protected procedure DoGetPhysicalCharWidths(Line: PChar; LineLen, Index: Integer; PWidths: PPhysicalCharWidth); override; end; implementation { SynEditTextDoubleWidthChars } procedure SynEditStringDoubleWidthChars.DoGetPhysicalCharWidths(Line: PChar; LineLen, Index: Integer; PWidths: PPhysicalCharWidth); var i: Integer; str:ansistring; begin inherited DoGetPhysicalCharWidths(Line, LineLen, Index, PWidths); if not IsUtf8 then exit; dec(Line); dec(PWidths); for i := 0 to LineLen - 1 do begin inc(Line); inc(PWidths); if Line^ < #$e1 then continue; if PWidths^ = 0 then continue; //读3个字节,转换成unicode //获得绘制宽度 str := ''; str := str + line^ + line[1] + line[2]; //DebugLn(str); // ..writeln(utf8decode(str)); pWidths^ := mk_wcwidth(longword(ord(utf8decode(str)[1]))) ; {* case Line^ of #$e1: case Line[1] of #$84: if (Line[2] >= #$80) then PWidths^ := 2; #$85: if (Line[2] <= #$9f) then PWidths^ := 2; end; #$e2: case Line[1] of #$8c: if (Line[2] = #$a9) or (Line[2] = #$aa) then PWidths^ := 2; #$ba: if (Line[2] >= #$80) then PWidths^ := 2; #$bb..#$ff: PWidths^ := 2; end; #$e3: case Line[1] of #$81: if (Line[2] >= #$81) then PWidths^ := 2; #$82..#$8e: PWidths^ := 2; #$8f: if (Line[2] <= #$bf) then PWidths^ := 2; #$90: if (Line[2] >= #$80) then PWidths^ := 2; #$91..#$FF: PWidths^ := 2; end; #$e4: case Line[1] of #$00..#$b5: PWidths^ := 2; #$b6: if (Line[2] <= #$b5) then PWidths^ := 2; #$b8: if (Line[2] >= #$80) then PWidths^ := 2; #$b9..#$ff: PWidths^ := 2; end; #$e5..#$e8: PWidths^ := 2; #$e9: if (Line[1] <= #$bf) or (Line[2] <= #$83) then PWidths^ := 2; #$ea: case Line[1] of #$80, #$b0: if (Line[2] >= #$80) then PWidths^ := 2; #$81..#$92, #$b1..#$ff: PWidths^ := 2; #$93: if (Line[2] <= #$86) then PWidths^ := 2; end; #$eb..#$ec: PWidths^ := 2; #$ed: if (Line[1] <= #$9e) or (Line[2] <= #$a3) then PWidths^ := 2; #$ef: case Line[1] of #$a4: if (Line[2] >= #$80) then PWidths^ := 2; #$a5..#$aa: PWidths^ := 2; #$ab: if (Line[2] <= #$99) then PWidths^ := 2; #$b8: if (Line[2] in [#$90..#$99,#$b0..#$ff]) then PWidths^ := 2; #$b9: if (Line[2] <= #$ab) then PWidths^ := 2; #$bc: if (Line[2] >= #$81) then PWidths^ := 2; #$bd: if (Line[2] <= #$a0) then PWidths^ := 2; #$bf: if (Line[2] >= #$a0) and (Line[2] <= #$a6) then PWidths^ := 2; end; #$f0: case Line[1] of #$a0, #$b0: case Line[2] of #$80: if (Line[3] >= #$80) then PWidths^ := 2; #$81..#$ff: PWidths^ := 2; end; #$a1..#$ae, #$b1..#$be: PWidths^ := 2; #$af, #$bf: case Line[2] of #$00..#$be: PWidths^ := 2; #$bf: if (Line[3] <= #$bd) then PWidths^ := 2; end; end end; *} end end; (* Ranges that are FullWidth char 1100 e1 84 80 .. 115F e1 85 9f 2329 e2 8c a9 .. 232A e2 8c aa 2E80 e2 ba 80 .. 303E e3 80 be 3041 e3 81 81 .. 33FF e3 8f bf 3400 e3 90 80 .. 4DB5 e4 b6 b5 4E00 e4 b8 80 .. 9FC3 e9 bf 83 A000 ea 80 80 .. A4C6 ea 93 86 AC00 ea b0 80 .. D7A3 ed 9e a3 F900 ef a4 80 .. FAD9 ef ab 99 FE10 ef b8 90 .. FE19 ef b8 99 FE30 ef b8 b0 .. FE6B ef b9 ab FF01 ef bc 81 .. FF60 ef bd a0 FFE0 ef bf a0 .. FFE6 ef bf a6 20000 f0 a0 80 80 .. 2FFFD f0 af bf bd 30000 f0 b0 80 80 .. 3FFFD f0 bf bf bd *) end.

 

 

{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.

Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.

-------------------------------------------------------------------------------}

(*
 visit the following URL for more information
 http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
 http://unicode.org/reports/tr11/
*)

unit SynEditTextDoubleWidthChars;

{$I synedit.inc}
interface

uses
  Classes, SysUtils, LazSynEditText ,synedittextdoublewidthchars2;

type

  { SynEditTextDoubleWidthChars }

  SynEditStringDoubleWidthChars = class(TSynEditStringsLinked)
  protected
    procedure DoGetPhysicalCharWidths(Line: PChar; LineLen, Index: Integer; PWidths: PPhysicalCharWidth); override;
  end;


implementation

{ SynEditTextDoubleWidthChars }

procedure SynEditStringDoubleWidthChars.DoGetPhysicalCharWidths(Line: PChar;
  LineLen, Index: Integer; PWidths: PPhysicalCharWidth);
var
  i: Integer;  str:ansistring;
begin
  inherited DoGetPhysicalCharWidths(Line, LineLen, Index, PWidths);
  if not IsUtf8 then
    exit;

  dec(Line);
  dec(PWidths);
  for i := 0 to LineLen - 1 do begin
    inc(Line);
    inc(PWidths);
    if Line^ < #$e1 then continue;
    if PWidths^ = 0 then continue;
   
    //读3个字节,转换成unicode
    //获得绘制宽度
    str := '';
    str := str + line^  + line[1] + line[2];
    //DebugLn(str);
   // ..writeln(utf8decode(str));
    pWidths^ := mk_wcwidth(longword(ord(utf8decode(str)[1]))) ;
    {*
    case Line^ of
      #$e1:
        case Line[1] of
          #$84:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$85:
            if (Line[2] <= #$9f) then PWidths^ := 2;
        end;
      #$e2:
        case Line[1] of
          #$8c:
            if (Line[2] = #$a9) or (Line[2] = #$aa) then PWidths^ := 2;
          #$ba:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$bb..#$ff:
            PWidths^ := 2;
        end;
      #$e3:
        case Line[1] of
          #$81:
            if (Line[2] >= #$81) then PWidths^ := 2;
          #$82..#$8e:
            PWidths^ := 2;
          #$8f:
            if (Line[2] <= #$bf) then PWidths^ := 2;
          #$90:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$91..#$FF:
            PWidths^ := 2;
        end;
      #$e4:
        case Line[1] of
          #$00..#$b5:
            PWidths^ := 2;
          #$b6:
            if (Line[2] <= #$b5) then PWidths^ := 2;
          #$b8:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$b9..#$ff:
            PWidths^ := 2;
        end;
      #$e5..#$e8:
        PWidths^ := 2;
      #$e9:
        if (Line[1] <= #$bf) or (Line[2] <= #$83) then PWidths^ := 2;
      #$ea:
        case Line[1] of
          #$80, #$b0:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$81..#$92, #$b1..#$ff:
            PWidths^ := 2;
          #$93:
            if (Line[2] <= #$86) then PWidths^ := 2;
        end;
      #$eb..#$ec:
        PWidths^ := 2;
      #$ed:
        if (Line[1] <= #$9e) or (Line[2] <= #$a3) then PWidths^ := 2;

      #$ef:
        case Line[1] of
          #$a4:
            if (Line[2] >= #$80) then PWidths^ := 2;
          #$a5..#$aa:
            PWidths^ := 2;
          #$ab:
            if (Line[2] <= #$99) then PWidths^ := 2;
          #$b8:
            if (Line[2] in [#$90..#$99,#$b0..#$ff]) then PWidths^ := 2;
          #$b9:
            if (Line[2] <= #$ab) then PWidths^ := 2;
          #$bc:
            if (Line[2] >= #$81) then PWidths^ := 2;
          #$bd:
            if (Line[2] <= #$a0) then PWidths^ := 2;
          #$bf:
            if (Line[2] >= #$a0) and (Line[2] <= #$a6) then PWidths^ := 2;
        end;
      #$f0:
        case Line[1] of
          #$a0, #$b0:
            case Line[2] of
              #$80:
                if (Line[3] >= #$80) then PWidths^ := 2;
              #$81..#$ff:
                PWidths^ := 2;
            end;
          #$a1..#$ae, #$b1..#$be:
            PWidths^ := 2;
          #$af, #$bf:
            case Line[2] of
              #$00..#$be:
                PWidths^ := 2;
              #$bf:
                if (Line[3] <= #$bd) then PWidths^ := 2;
            end;
        end
    end;
    *}

   
  end
end;

(* Ranges that are FullWidth char

 1100  e1 84 80  ..  115F  e1 85 9f
 2329  e2 8c a9  ..  232A  e2 8c aa
 2E80  e2 ba 80  ..  303E  e3 80 be
 3041  e3 81 81  ..  33FF  e3 8f bf
 3400  e3 90 80  ..  4DB5  e4 b6 b5
 4E00  e4 b8 80  ..  9FC3  e9 bf 83
 A000  ea 80 80  ..  A4C6  ea 93 86
 AC00  ea b0 80  ..  D7A3  ed 9e a3
 F900  ef a4 80  ..  FAD9  ef ab 99
 FE10  ef b8 90  ..  FE19  ef b8 99
 FE30  ef b8 b0  ..  FE6B  ef b9 ab
 FF01  ef bc 81  ..  FF60  ef bd a0
 FFE0  ef bf a0  ..  FFE6  ef bf a6
20000  f0 a0 80 80  .. 2FFFD f0 af bf bd
30000  f0 b0 80 80  .. 3FFFD f0 bf bf bd

*)
end.

 

 

lazarus,synedit输入小键盘特殊符号的补丁,这两个单元是解决synedit输入符号的时候发生重叠的问题的。

posted on 2013-07-02 10:50  stevenlaz  阅读(636)  评论(0编辑  收藏  举报

导航

Counter
Clarion Discount Hotel