为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

RAVE导出中文乱码解决方法修改代码

2019-01-13 13页 doc 31KB 29阅读

用户头像

is_589748

暂无简介

举报
RAVE导出中文乱码解决方法修改代码{********************************************************** ***************} { Rave Reports version 5.1 } { Copyright (c), 1995-2002, Nevrona Designs, all rights reserved } {********************************************************** ***************} unit RpRende...
RAVE导出中文乱码解决方法修改代码
{********************************************************** ***************} { Rave Reports version 5.1 } { Copyright (c), 1995-2002, Nevrona Designs, all rights reserved } {********************************************************** ***************} unit RpRenderPDF; function TRvRenderPDF.IsCJKFont: boolean; begin case ConvertCharset((Converter.Font.Charset)) of Windows.SHIFTJIS_CHARSET, // Japan Windows.HANGEUL_CHARSET, // Korea Windows.GB2312_CHARSET, // Simplified Chinese (People's Rep ublic of China) Windows.CHINESEBIG5_CHARSET, // Traditional Chinese (Taiwan) Windows.JOHAB_CHARSET: begin Result := true; end else begin Result := false; end end; { case } end; procedure TRPPDFFontDescendant.InitData; //!!!CJK procedure PrintWidths; var i1: integer; begin RvRenderPDF.PrintLn('/W ['); if Descriptor.Panose.bProportion = PAN_PROP_MONOSPACED then begin if CharSet = SHIFTJIS_CHARSET {Japanese} then begin RvRenderPDF.PrintLnF('%d [', [231]); end else if CharSet = HANGEUL_CHARSET {Korea} then begin RvRenderPDF.PrintLnF('%d [', [8094]); end else if CharSet = CHINESEBIG5_CHARSET {Traditional Chinese (Taiw an)} then begin RvRenderPDF.PrintLnF('%d [', [13648]); end else begin //SCYANGYU RvRenderPDF.PrintLnF('%d [', [814]); //Simplified Chinese (People' s Republic of China) end; end else begin RvRenderPDF.PrintLnF('%d [', [1]); end; { else } i1 := 32; while i1 <= 126 do begin RvRenderPDF.Print(IntToStr(FontWidths[i1]) + ' '); if i1 mod 10 = 9 then begin RvRenderPDF.PrintLn; end; Inc(i1); end; // while RvRenderPDF.PrintLn(']'); RvRenderPDF.PrintLn(']'); end; begin { InitData } RvRenderPDF.ActiveStream := DataStream; RvRenderPDF.PrintLnF('%d 0 obj',[GetID]); RvRenderPDF.PrintLn('<<'); RvRenderPDF.PrintLn('/Type /Font'); RvRenderPDF.PrintLn('/Subtype /CIDFontType2'); RvRenderPDF.PrintLnF('/BaseFont /%s',[PDFFontName]); RvRenderPDF.PrintLnF('/FontDescriptor %d 0 R',[Descriptor.GetID]); RvRenderPDF.PrintLnF('/WinCharSet /%d',[CharSet]);//!!!CJK RvRenderPDF.PrintLnF('/CIDSystemInfo << /Registry (%s)/Ordering (% s)/Supplement %d >>', [Registry, Ordering, Supplement]); RvRenderPDF.PrintLnF('/DW %d',[MaxCharWidth]); PrintWidths; RvRenderPDF.PrintLn('>>'); RvRenderPDF.PrintLn('endobj'); RvRenderPDF.PrintLn; RvRenderPDF.ActiveStream.Position := 0; end; { InitData } procedure TRPPDFFontComposite.SetFontData; type TABCArray = array[0..255] of TABC; var OutlineTextMetric: POutlineTextMetric; Panose: TPanose; nSize: longint; lpABC: TABCArray; procedure SetWidths; var i1: integer; begin i1 := 0; while i1 < LastChar - FirstChar + 1 do begin FontWidths[i1 + FirstChar] := lpABC[i1].abcA + word(lpABC[i1].abcB) + lpABC[i1].abcC; Inc(i1); end; // while end; begin if RvRenderPDF.IsCJKFont then begin with RvRenderPDF.FontBitmap.Canvas do begin Font.Name := FontName; Font.Style := FontStyles; Font.Charset := FontCharset; end; { with } nSize := GetOutlineTextMetrics((RvRenderPDF.FontBitmap.Canvas.Han dle), sizeof(OutlineTextMetric), nil); GetMem(OutlineTextMetric, nSize); try if GetOutlineTextMetrics((RvRenderPDF.FontBitmap.Canvas.Handle), nSize, OutlineTextMetric) > 0 then begin Panose := OutlineTextMetric.otmPanoseNumber; if Panose.bProportion = PAN_PROP_MONOSPACED then begin if FontCharSet = SHIFTJIS_CHARSET then // Japan begin CompositeFontEncoding := '90ms-RKSJ-H'; end else if FontCharSet = HANGEUL_CHARSET then // Korea begin CompositeFontEncoding := 'KSCms-UHC-HW-H'; end else if FontCharSet = CHINESEBIG5_CHARSET then // Traditional Chinese (Taiwan) begin CompositeFontEncoding := 'ETenms-B5-H'; end else Begin //SCYANGYU CompositeFontEncoding := 'GBK-EUC-H'; //cc_simplified_chin ese End;{ else } end else begin if FontCharSet = SHIFTJIS_CHARSET then // Japan begin CompositeFontEncoding := '90msp-RKSJ-H'; end else if FontCharSet = HANGEUL_CHARSET then // Korea begin CompositeFontEncoding := 'KSCms-UHC-H'; end else if FontCharSet =CHINESEBIG5_CHARSET then // Traditional C hinese (Taiwan) begin CompositeFontEncoding := 'CNS-EUC-H'; end else begin //SCYANGYU CompositeFontEncoding := 'GBpc-EUC-H'; //cc_simplified_chi nese end; { else } end; { else } Descriptor.PDFFontName := PDFFontName; Descriptor.Set value s(OutlineTextMetric, FontWidths[32]); Descendant.PDFFontName := PDFFontName; Descendant.Descriptor := Descriptor; Descendant.Registry := 'Adobe'; if FontCharSet = SHIFTJIS_CHARSET then // Japan begin Descendant.Ordering := 'Japan1'; end else if FontCharSet = HANGEUL_CHARSET then // Korea begin Descendant.Ordering := 'Korea1'; end else if FontCharSet = CHINESEBIG5_CHARSET then // Traditional Chinese (Taiwan) begin Descendant.Ordering := 'CNS1'; end else begin //SCYANGYU Descendant.Ordering := 'GB1'; // cc_simplified_chinese end; { else } if FontCharSet = SHIFTJIS_CHARSET then // Japan begin Descendant.Supplement := 2; end else if FontCharSet = HANGEUL_CHARSET then // Korea begin Descendant.Supplement := 1; end else if FontCharSet = CHINESEBIG5_CHARSET then // Traditional C hinese (Taiwan) begin Descendant.Supplement := 1; end else begin //SCYANGYU Descendant.Supplement := 0; // cc_simplified_chinese end; { else } Descendant.MaxCharWidth := OutlineTextMetric.otmTextMetrics.tm MaxCharWidth; Descendant.AveCharWidth := OutlineTextMetric.otmTextMetrics.tmA veCharWidth; Descendant.Charset := RvRenderPDF.FontBitmap.Canvas.Font.Chars et; FirstChar := cardinal(OutlineTextMetric.otmTextMetrics.tmFirstChar); LastChar := cardinal(OutlineTextMetric.otmTextMetrics.tmLastChar); if GetCharABCWidths((RvRenderPDF.FontBitmap.Canvas.Handle), FirstChar, LastChar, lpABC) then begin SetWidths; Descendant.FirstChar := FirstChar; Descendant.LastChar := LastChar; Descendant.FontWidths := FontWidths; end; { if } end; { if } finally FreeMem(OutlineTextMetric, nSize); end; { tryf } end; end;
/
本文档为【RAVE导出中文乱码解决方法修改代码】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索