Hello,
i think there is a problem with definiton of HumanFriendlyName and PostScriptName.
it looks like the Arial font is the default (parent font) under windows. But the name Arial is not correct, it should be translated to the correct PostScriptFontName = ArialMT. Because a search in Font(Fontname) is as search with the postscriptname and not with the human readable Font name.
Actual i have fixed this for me with
fnt := gTTFontCache.FindFont(AFontName); // we are doing a
PostScript Name lookup (it contains Bold, Italic info) in function TFPReportExportPDF.FindFontIndex(const ADoc: TPDFDocument; const AFontName: string): integer;
but i think, this is not the soloution. It should be done in the prepaering of the report.
Andreas
------ Human readable ... PostScriptname...Filename ----------- Arial...ArialMT...C:\WINDOWS\Fonts\arial.ttf
Arial Bold...Arial-BoldMT...C:\WINDOWS\Fonts\arialbd.ttf Arial Bold Italic...Arial-BoldItalicMT...C:\WINDOWS\Fonts\arialbi.ttf Arial Italic...Arial-ItalicMT...C:\WINDOWS\Fonts\ariali.ttf Arial Narrow...ArialNarrow...C:\WINDOWS\Fonts\ARIALN.TTF Arial Narrow Bold...ArialNarrow-Bold...C:\WINDOWS\Fonts\ARIALNB.TTF Arial Narrow Bold
Italic...ArialNarrow-BoldItalic...C:\WINDOWS\Fonts\ARIALNBI.TTF Arial Narrow Italic...ArialNarrow-Italic...C:\WINDOWS\Fonts\ARIALNI.TTF Arial Unicode MS...ArialUnicodeMS...C:\WINDOWS\Fonts\ARIALUNI.TTF Arial Black...Arial-Black...C:\WINDOWS\Fonts\ariblk.ttf AR JULIAN...ARJULIAN...C:\WINDOWS\Fonts\ARJULIAN.ttf
Liberation Sans
Bold...LiberationSans-Bold...C:\WINDOWS\Fonts\LiberationSans-Bold.ttf Liberation Sans Bold
Italic...LiberationSans-BoldItalic...C:\WINDOWS\Fonts\LiberationSans-BoldItalic.ttf Liberation Sans
Italic...LiberationSans-Italic...C:\WINDOWS\Fonts\LiberationSans-Italic.ttf Liberation
Sans...LiberationSans...C:\WINDOWS\Fonts\LiberationSans-Regular.ttf Liberation Sans Narrow
Bold...LiberationSansNarrow-Bold...C:\WINDOWS\Fonts\LiberationSansNarrow-Bold.ttf Liberation Sans Narrow Bold
Italic...LiberationSansNarrow-BoldItalic...C:\WINDOWS\Fonts\LiberationSansNarrow-BoldItalic.ttf Liberation Sans Narrow
Italic...LiberationSansNarrow-Italic...C:\WINDOWS\Fonts\LiberationSansNarrow-Italic.ttf Liberation Sans
Narrow...LiberationSansNarrow...C:\WINDOWS\Fonts\LiberationSansNarrow-Regular.ttf L
Michael Van Canneyt wrote 158 lines
Hello,
Can we please tackle one problem at a time ?
The first problem is: Why is the "liberation sans" not found ?
Once we've established that, we can check why the fallback is not found,
and
perhaps the error message.
Michael.
On Fri, 27 Dec 2019, Andreas Frieß wrote:
> Hello Michael,
>
> if the font is not found, why is there not the correct indication of the
> missing font ? The errormessage is in this case completly wrong.
>
> If a fallback should be possible, it should work and not mask the
> problem and create a false errormessage.
>
> Maybe the font liberation Sans is not on a Windows10/64 machine, if this
> is true i should see the message -> fpreport: Could not find the font
> <Liberation Sans> in the font cache.
> Or
> -> EReportFontNotFound: >> Font not found: "Liberation Sans".
>
> Andreas
>
> Am 27.12.2019 um 16:00 schrieb Michael Van Canneyt:
>>
>> As I said:
>>
>> The demos do not use Arial on purpose. Probably it is used as a
>> fallback somewhere.
>>
>> So the question is: why is the demo falling back to Arial ?
>>
>> It means the actually used font (Liberation Sans, line 74 of rptjson)
>> is not found.
>>
>> Michael.
>>
>> On Fri, 27 Dec 2019, Andreas Frieß wrote:
>>
>>> The reason (with ReadStandardfonts inserted):
>>>
>>> ---------------------------
>>> D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d
>>> jsondata -f pdf
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> 1 : Name -> Albania
>>> 1 : Population -> 2894000
>>> 2 : Name -> Algeria
>>> 2 : Population -> 38934000
>>> 3 : Name -> Angola
>>> 3 : Population -> 24228000
>>> .... some lines skipped .....
>>> 155 : Name -> Zambia
>>> 155 : Population -> 15721000
>>> 156 : Name -> Zimbabwe
>>> 156 : Population -> 15246000
>>> Exception at 00000001000631E0: Exception:
>>> fpreport: Could not find the font <Arial> in the font cache.
>>> Heap dump by heaptrc unit of
>>> "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe"
>>> 74069 memory blocks allocated : 101484860/101702272
>>> 74069 memory blocks freed : 101484860/101702272
>>> 0 unfreed memory blocks : 0
>>> True heap size : 2785280 (320 used in System startup)
>>> True free heap : 2784960
>>>
>>> D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>
>>> ---------------------------------
>>> Original (without ReadStandardfonts) = Original
>>>
>>> ----------------------------------
>>> D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d
>>> jsondata -f pdf
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> 0 : Name -> Afghanistan
>>> 0 : Population -> 31628000
>>> Exception at 000000010004C36F: EReportFontNotFound:
>>> Font not found: "Arial".
>>> Heap dump by heaptrc unit of
>>> "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe"
>>> 4894 memory blocks allocated : 1547732/1561920
>>> 4894 memory blocks freed : 1547732/1561920
>>> 0 unfreed memory blocks : 0
>>> True heap size : 262144 (320 used in System startup)
>>> True free heap : 261824
>>> ------------------------------------
>>> Michael Van Canneyt wrote:
>>>
>>> >
>>> >
>>> > On Fri, 27 Dec 2019, Andreas Frieß wrote:
>>> >
>>> > > I have now built the fcl-fpreport demos on win64 on a Windows10/64
>>> > > machine. But the demo is not running (comandline with -d
>>> jsondata -f
>>> > > pdf), because the font Arial is not found. It looks like the demos
>>> > > didnt use the gTTFontCache.ReadStandardFonts and so the standard
>>> > > font is not found.
>>> >
>>> > Why do you think Arial is needed ?
>>> >
>>> > All demos explicitly use a font, but never Arial. That is why
>>> > gTTFontCache.ReadStandardFonts should not be necessary.
>>> >
>>> > Most demos use the LiberationSans font. Some use DejaVuSans or the
>>> > Ubuntu font. You must of course have these fonts installed in your
>>> > system. The LiberationSans font is included in the fonts subdirectory
>>> > of the demo dir.
>>> >
>>> > So the question is, why does not the demo program find these fonts ?
>>> >
>>> > Michael.
>>> > _______________________________________________
>>> > fpc-pascal maillist -
>>>
>>>
>>> >
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>>
>>>
>>> _______________________________________________
>>> fpc-pascal maillist -
>>>
>>>
>>>
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>>
>>
>> _______________________________________________
>> fpc-pascal maillist -
>>
>>
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>
>
> _______________________________________________
> fpc-pascal maillist -
>
>
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
_______________________________________________
fpc-pascal maillist -
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal