Rave PDF show 中文問題, 何時解決 ? |
|
ed2222
一般會員 發表:11 回覆:10 積分:4 註冊:2002-07-31 發送簡訊給我 |
|
crispin2k
初階會員 發表:7 回覆:42 積分:33 註冊:2002-07-24 發送簡訊給我 |
您只要有RaveReport的原始碼,經過修正之後即可支援中文PDF檔案格式,不過就RaveReport 4.0.8的原始碼來看,要修正此問題可能要花很多時間,因為此軟體的原始碼寫的不是很高明(個人認為),若您有用過Pragnaan公司的PsFRExportFilters元件的話,您就可以發現,只要小小的修改即可符合中文PDF的格式,但RaveReport就不是這麼一回事。 不過最近我的同學給了我一個訊息,據說Borland已要求RaveReport的開發公司要求支援中文PDF檔案格式的問題。 敬請期待! --
Delphi知識分享網 http://www.jane.com.tw
FastReport, PsFREoportFilters, PsQRFilters代理銷售網站
FastReport: 易學易用且功能強大的報表元件。
PsFRExportFilters: 可將FastReport匯出多種檔案格式,支援中文PDF檔案格式。
PsQRFilters: 超強的QuickReport報表匯出元件,支援PDF, XLS, RTF,..檔案格式。 發表人 - crispin2k 於 2003/02/28 23:40:41 發表人 - crispin2k 於 2003/02/28 23:41:08
|
rose751231
一般會員 發表:3 回覆:17 積分:4 註冊:2002-12-21 發送簡訊給我 |
|
rose751231
一般會員 發表:3 回覆:17 積分:4 註冊:2002-12-21 發送簡訊給我 |
|
gishin
一般會員 發表:0 回覆:2 積分:0 註冊:2003-09-11 發送簡訊給我 |
|
crispin2k
初階會員 發表:7 回覆:42 積分:33 註冊:2002-07-24 發送簡訊給我 |
引言: 我們公司之前有向Nevrona(就是設計Rave Report的公司)購買BEX(Borland Edition eXtended)﹐功能上比Delphi7所附的要好一些﹐不過轉PDF時中文還是有問題﹐我和他們技術部門通了幾次E-Mail﹐他們說之前曾解決過日文的相同問題﹐應該有把握可以搞定中文。不過已經過了一個多月﹐仍毫無消息。 之前有朋友提到可以直接修改>>< face="Verdana, Arial, Helvetica"> 最近看過Rave Report BEX 5.12版,發現支援中文的Code已經加進去了,不過關鍵的地方他還是弄錯了,我想是國外對DBCS字元有些誤解的關係,不過「雖不中亦不遠矣!」,稍微修改一下就可以達成,只不過我是FastReport的愛用者,當初想幫對方中文化,因對方不領情而作罷。 |
gishin
一般會員 發表:0 回覆:2 積分:0 註冊:2003-09-11 發送簡訊給我 |
|
SCYANGYU1427
一般會員 發表:1 回覆:14 積分:3 註冊:2002-09-09 發送簡訊給我 |
RAVE生成PDF文件中文乱码问题的解决 这个问题困扰了我将近两个星期了,今天在 季昌丰 先生的帮助下,取得的重大突破! 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 Republic 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 (Taiwan)} 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.Handle),
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_chinese
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 Chinese (Taiwan)
begin
CompositeFontEncoding := 'CNS-EUC-H';
end
else
begin //SCYANGYU
CompositeFontEncoding := 'GBpc-EUC-H'; //cc_simplified_chinese
end; { else }
end; { else }
Descriptor.PDFFontName := PDFFontName;
Descriptor.Setvalues(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 Chinese (Taiwan)
begin
Descendant.Supplement := 1;
end
else
begin //SCYANGYU
Descendant.Supplement := 0; // cc_simplified_chinese
end; { else }
Descendant.MaxCharWidth := OutlineTextMetric.otmTextMetrics.tmMaxCharWidth;
Descendant.AveCharWidth := OutlineTextMetric.otmTextMetrics.tmAveCharWidth;
Descendant.Charset := RvRenderPDF.FontBitmap.Canvas.Font.Charset; 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;
|
nlok
一般會員 發表:0 回覆:1 積分:0 註冊:2005-01-10 發送簡訊給我 |
|
helloman77777
一般會員 發表:0 回覆:1 積分:0 註冊:2005-04-28 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |