对于少数名族的语言(维吾尔族语言)改怎么显示?
对于少数名族的语言(维吾尔族语言)改怎么显示?在WORD能显示 在软件不能显示
[解决办法]
没资料,费了牛劲了,强烈要求楼主给帖子加分!前提当然是代码是对的。
网上全是升级或TNT的,我还不太信D7真不中用吗?
特别声明:本人不懂少数民族语言,所用文字及显示结果纯为试验!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, StrUtils, Buttons;
type
TForm1 = class(TForm)
Button1: TButton;
BitBtn1: TBitBtn;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s,s1: string;
i: integer;
b: array of byte;
Len: integer;
begin
//要显示文字的unicode编码串,从网页上复制的,意思不明,仅做为试验
//获取办法为:从别处复制一个非汉文的字符串至word文档,word另存为htm
//notepad打开htm文件,从相应的<span>处取出编码串
s := 'تىل';
//确定字符个数
s1 := s;
i := 0;
while s1<>'' do
begin
Inc(i);
if Pos(';',s1)>0 then
begin
Delete(s1,1,Pos(';',s1));
continue;
end;
s1 := '';
end;
Len := i*2+1;
SetLength(b,Len);
//写入内存
i := 0;
while s<>'' do
begin
if Pos(';',s)>0 then
begin
s1 := LeftBStr(s,Pos(';',s)-1);
Delete(s,1,Pos(';',s));
Delete(s1,1,2);
end
else
begin
s1 := s;
s:='';
Delete(s1,1,2);
end;
b[i] := StrToInt(s1) mod 256;
b[i+1] := StrToInt(s1) div 256;
i := i+2;
end;
b[i] := 0;
SetLength(s,Len);
//为了这个codepage,查了好多才查到,大家有没有更全的地址啊
//阿拉伯文字的codepage为1256,www.rockbox.org/wiki/UnicodeGuide中
//有一句 Arabic CP1256(Windows-1256)
//估计其他语系的,这个代码也可以用上,有需求的童鞋可以试下,
//其他语系需要查下相应的codepage及后面的charset
Len:=WideCharToMultiByte(1256,0,PWideChar(b),-1,PChar(s),Len,nil,nil);
SetLength(s,Len-1);
//字体是系统带的,有些字体可以设字符集,可设字符集中有"阿拉伯文"的才可以用
//IDE环境下控件的Font属性设置时可以查看到某字体是否可以使用
Label1.Font.Name := 'Tahoma';
Label1.Font.Charset := ARABIC_CHARSET;
Label1.Font.Size := 64;
Label1.Caption := s;
//BitBtn可以用
BitBtn1.Font.Assign(Label1.Font);
BitBtn1.Font.Size := 12;
BitBtn1.Caption := s;
//button设置失败,有人知道为啥?
Button1.Font.Assign(BitBtn1.Font);
Button1.Caption := s;
//其他组件没试,估计有的可以用,有的不能用吧
end;
end.