Hi!
I found the problem in file lr_e_fclpdf.pas, in the following function TExportFonts.AddItem(AFontName: string; AFontStyle: TFontStyles ): TExportFontItem
in the line
Result.FPdfFont:=FOwner.FPDFDocument.AddFont(S2, S3);
where S3 is font name.
AddFont function is defined in fpPDF unit. This function first checks, if the font with S3 (font name) value already
exists in the font list. If we already add normal font with the same as the bold one, AddFont function will not
add the bold one.
I change the function TExportFonts.AddItem to
function TExportFonts.AddItem(AFontName: string; AFontStyle: TFontStyles
): TExportFontItem;
var
S1, S2, S3: String;
ext: string; // added by me
begin
Result:=FindItem(AFontName, AFontStyle);
if Assigned(Result) then exit;
if Assigned(gTTFontCache.Find(AFontName, Graphics.fsBold in AFontStyle, Graphics.fsItalic in AFontStyle)) then
begin
Result:=TExportFontItem.Create(Self, AFontName, AFontStyle);
S1:=ExtractFileDir(Result.FTTFFontInfo.FileName);
S2:=ExtractFileName(Result.FTTFFontInfo.FileName);
S3:=AFontName;
// added - start
ext:='';
if (Graphics.fsBold in AFontStyle) then
ext:=ext+'b';
if (Graphics.fsItalic in AFontStyle) then
ext:=ext+'i';
S3:=S3+ext;
// added - end
FOwner.FPDFDocument.FontDirectory:=S1;
Result.FPdfFont:=FOwner.FPDFDocument.AddFont(S2, S3);
end
else
Result:=FDefaultFontNormal;
end;
And now, it works.
by
Robert