View Issue Details

IDProjectCategoryView StatusLast Update
0033376LazarusPackagespublic2018-03-08 17:28
ReporterStephanoAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformOSubuntuOS Version16.04
Product Version1.9 (SVN)Product Build 
Target VersionFixed in Version1.9 (SVN) 
Summary0033376: FPReport designer: Font issues part 2
Description- Create new report
The font name in the name property is LiberationSans
- Click the the Font ellipsis (...)
Bug no 1: The fontname will be shown as Sans, and the size 10. It seems the fontname, size, and style in the font dialogue are not initialized, and always defaults to Sans/10/regular. This causes errors when children's font is changed.

- Change the font to TimesNewRoman/12/italic
- Set color to clred
- Place a report title band
Bug no 2: Its font properties (not font dialogue) will be shown as LiberationSans/10/black

More to come once these are resolved.
TagsNo tags attached.
Fixed in Revision57469
LazTarget-
Widgetset
Attached Files

Activities

Michael Van Canneyt

2018-03-08 11:48

administrator   ~0106989

I cannot reproduce this.

I assume you are on windows ?

The problem is then most likely that Windows does not know this font, and therefor substitutes a default font.

I work on Linux, where liberation sans is installed.

So, my first suggestion is that you install liberation sans.

(if correct, it just means that the idea of a default font name with fallback should be implemented...)

Stephano

2018-03-08 12:02

developer   ~0106990

I should have specified Ubuntu 16.04. My bad!
LiberationSans is present, and this has been the default font since I started working on fpreport.
1- If you press on (...) on a memo's font property to get the font dialogue, do you get Sans or LiberationSans?
2- If you change the font in the font dialogue, press ok, and reopen the dialogue again, is the font updated?

Stephano

2018-03-08 12:23

developer   ~0106992

Last edited: 2018-03-08 12:29

View 2 revisions

More on that: Choosing "Ubuntu", monospace fonts show in the font dialogue and sticks.
Makes me wonder why LiberationSans, "Ubuntu Mono", "Ubuntu Condensed" don't stick.

Stephano

2018-03-08 12:36

developer   ~0106993

I see a trend where fonts that fail have names consisting of more than one word, or belong to a family which has fonts names with more than one word.
I tested the font dialogue in Lazarus IDE (OI), and this problem is not there.

Stephano

2018-03-08 13:05

developer   ~0106994

I got to the cause!
The TFPReportFontName is set to 'LiberationSans' whereas the font dialogue returns the font name as 'Liberation Sans'. Note the space!
Then the following line assigns the font correctly: R.Name:=FontNameToPostScriptName(FontDialog.Font.Name);
So what is needed is a reverse assignment (PostScriptNameToFontName) when setting the font dialogue font name.

Stephano

2018-03-08 13:15

developer   ~0106995

Solved!
regfpdesigner.pp:
Function PostScriptNameToFontName(N : String) : String;

Var
  F : TFPFontCacheItem;

begin
  if (N='default') then
    N:=ReportDefaultFont;
  F:=gTTFontCache.Find(N);
  if Assigned(F) then
    N:=F.FamilyName;
  Result:=N;
end;

and in procedure TReportFontPropertyEditor.Edit:
    FontDialog.Font.Name := PostScriptNameToFontName(R.Name);

Michael Van Canneyt

2018-03-08 17:12

administrator   ~0107010

Fixed, thanks for the solution !!

Issue History

Date Modified Username Field Change
2018-03-08 11:13 Stephano New Issue
2018-03-08 11:13 Stephano Status new => assigned
2018-03-08 11:13 Stephano Assigned To => Michael Van Canneyt
2018-03-08 11:48 Michael Van Canneyt Note Added: 0106989
2018-03-08 11:49 Michael Van Canneyt Summary FPReport designer: Font issues 0000002 => FPReport designer: Font issues part 2
2018-03-08 11:49 Michael Van Canneyt Description Updated View Revisions
2018-03-08 12:02 Stephano Note Added: 0106990
2018-03-08 12:04 Stephano OS => ubuntu
2018-03-08 12:04 Stephano OS Version => 16.04
2018-03-08 12:23 Stephano Note Added: 0106992
2018-03-08 12:29 Stephano Note Edited: 0106992 View Revisions
2018-03-08 12:36 Stephano Note Added: 0106993
2018-03-08 12:36 Stephano Status assigned => feedback
2018-03-08 13:05 Stephano Note Added: 0106994
2018-03-08 13:05 Stephano Status feedback => assigned
2018-03-08 13:15 Stephano Note Added: 0106995
2018-03-08 17:12 Michael Van Canneyt Fixed in Revision => 57469
2018-03-08 17:12 Michael Van Canneyt Note Added: 0107010
2018-03-08 17:12 Michael Van Canneyt Status assigned => resolved
2018-03-08 17:12 Michael Van Canneyt Fixed in Version => 1.9 (SVN)
2018-03-08 17:12 Michael Van Canneyt Resolution open => fixed
2018-03-08 17:28 Stephano Status resolved => closed