View Issue Details

IDProjectCategoryView StatusLast Update
0038123LazarusPackagespublic2020-11-27 15:03
Reportervirgo Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.0.10 
Summary0038123: fpReport TFPReportExportCanvas does not translate ps font names to font families for TFont
DescriptionWhen font design uses bold font, then Lazarus preview window is not showing it as bold. Reason is, that TFPReportExportCanvas.GetFont assignes original report font name (which is PS font name Arial-BoldMT to TFont.Name. I added fpTTF to implementation uses of fpreportlclexport unit and changed TFPReportExportCanvas.GetFont to:
Var
  ftFont : TFont;
  CI : TFPFontCacheItem;
begin
  Result:=Nil;
  Result:=TFont(FFonts.Items[AFontName]);
  If (Result=Nil) then
    begin
    ftFont:=TFont.create;
    CI:=gTTFontCache.Find(AFontName);
    if CI <> nil then
      ftFont.Name:=CI.FamilyName
    else
      ftFont.Name:=AFontName;
    ftFont.Bold := CI.IsBold;
    ftFont.Italic := CI.IsItalic;
    Result:=ftFont;
    FFonts.Add(AFontName,Result);
    end;
end;
Steps To ReproduceDesign report with Bold font, preview it with TFPreportPreviewExport using TFPReportPreviewForm as DefaultPreviewFormClass.
Additional InformationIt probably means, that all fonts are replaced with default font. Because even standard font is Arial-MT, not Arial, that is expected by TFont.
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetWin32/Win64
Attached Files

Activities

virgo

2020-11-24 09:53

reporter   ~0127152

correction: original version would result in Access Violation, when font is not found in gTTFontCache.
Var
  ftFont : TFont;
  CI : TFPFontCacheItem;
begin
  Result:=Nil;
  Result:=TFont(FFonts.Items[AFontName]);
  If (Result=Nil) then
    begin
    ftFont:=TFont.create;
    CI:=gTTFontCache.Find(AFontName);
    if CI <> nil then
      begin
      ftFont.Name:=CI.FamilyName;
      ftFont.Bold := CI.IsBold;
      ftFont.Italic := CI.IsItalic;
      end
    else
      ftFont.Name:=AFontName;
    Result:=ftFont;
    FFonts.Add(AFontName,Result);
    end;
end;

virgo

2020-11-27 15:03

reporter   ~0127210

Issue was also in report designer and this fixed it for that too.

Issue History

Date Modified Username Field Change
2020-11-24 09:47 virgo New Issue
2020-11-24 09:53 virgo Note Added: 0127152
2020-11-27 15:03 virgo Note Added: 0127210