Something's broken in fpTTF : too many fonts causes Stream Read Error lazarus / 39-Graphics ---------------------------------------------------------------------- jipété · 2024-07-09 09:08 Hello, Consider the following snippet, copied from https://forum.lazarus.freepascal.org/index.php?topic=66967.0, pasted and adapted to my needs, and look at the comments. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  fppdf, fpttf; procedure TfrmMain.btnFontlistClick(Sender: TObject);var  // https://forum.lazarus.freepascal.org/index.php?topic=66967.0  g: TFPFontCacheList;  i: Integer;begin  //cbfontname.Items.Clear; // orig -- cbfontname is a TComboBox  lbFamily.Items.Clear; // lbFamily is a TListBox  //load fonts  g := TFPFontCacheList.Create;//g.SearchPath.Add('C:\Windows\Fonts'); orig//g.SearchPath.Add('d:\Font\');         orig //  g.SearchPath.Add('/usr/share/fonts/truetype/dejavu'); // g.Count = 22 --> light folder, no problem  g.SearchPath.Add('/usr/share/fonts'); // g.Count = 1116 --> heavy folder, Stream Read Error   g.BuildFontCache;  showmessage(inttostr(g.Count)); // 1116 or 22  for i := 0 to g.Count - 1 do//  if cbfontname.Items.IndexOf(g.Items[i].FamilyName) < 0 then//    cbfontname.Items.Add(g.Items[i].FamilyName);    if lbFamily.Items.IndexOf(g.Items[i].FamilyName) < 0 then      lbFamily.Items.Add(g.Items[i].FamilyName);// Stream Read Error and i = 501  showmessage(lbFamily.Items.Text); // OK if count < 501  g.Free;end; And I don't see where and how to increase the TFPFontCacheList capacity. Thanks for help... ---------------------------------------------------------------------- Zvoni · 2024-07-09 09:54 This looks like an issue in TTFFileInfo.ParseName, and not an issue that it's 1116 Fonts It chokes on trying to read the FontName from the FontFile. maybe corrupted FontFile? You have an i=501 Have you tried checking manually items 500 and 502? Or try: rename the file-extension of item 501 in your file-explorer, so the code skips that file ---------------------------------------------------------------------- paweld · 2024-07-09 09:54 This is not a problem with TFPFontCacheList - I checked and it works with more than 2000 font files without any problem. Probably one or more TTF files are corrupted (or no access to them ?) and the parser can't read them. Paste the modified code and see how your program behavesCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  fpttf; procedure TfrmMain.btnFontlistClick(Sender: TObject);var  // https://forum.lazarus.freepascal.org/index.php?topic=66967.0  g: TFPFontCacheList;  i: Integer;begin  //cbfontname.Items.Clear; // orig -- cbfontname is a TComboBox  lbFamily.Items.Clear; // lbFamily is a TListBox  //load fonts  g := TFPFontCacheList.Create;  //g.SearchPath.Add('C:\Windows\Fonts'); orig  //g.SearchPath.Add('d:\Font\');         orig   //  g.SearchPath.Add('/usr/share/fonts/truetype/dejavu'); // g.Count = 22 --> light folder, no problem  g.SearchPath.Add('/usr/share/fonts'); // g.Count = 1116 --> heavy folder, Stream Read Error   g.BuildFontCache;  ShowMessage(IntToStr(g.Count)); // 1116 or 22  for i := 0 to g.Count - 1 do  begin    try      //  if cbfontname.Items.IndexOf(g.Items[i].FamilyName) < 0 then      //    cbfontname.Items.Add(g.Items[i].FamilyName);      if lbFamily.Items.IndexOf(g.Items[i].FamilyName) < 0 then        lbFamily.Items.Add(g.Items[i].FamilyName);// Stream Read Error and i = 501    except      on E: Exception do        ShowMessage(Format('Error for font index [%d]:' + sLineBreak + '%s', [i, E.Message]);    end;  end;  ShowMessage(lbFamily.Items.Text); // OK if count < 501  g.Free;end; ---------------------------------------------------------------------- Thaddy · 2024-07-09 10:39 The part that is wrong by design is the exception part: you should know beforehand if a font exists or not. No excuse in using exceptions for that, that is simply bad coding. The other thing that is wrong is not choosing a font family, so there is at least a reasonable alternative. And yes, you can process well over 2000 fonts without complaints until you meet the counter example. Those two issues should really have been addressed a long time ago,  and it has been mentioned many times. That is just not about pdf: it is about handling fonts and font families in general. ---------------------------------------------------------------------- dbannon · 2024-07-09 10:50 Its worth noting that the FontCache is substantially improved in FPC- fixes. If you are using FPC322, might be worth trying Fixes. But do note that if you are using Linux, it opens libfontconfig.so at run time, not libfontconfig.so.1 so your end users need to have the development packages installed ! Davo ---------------------------------------------------------------------- jipété · 2024-07-09 12:02 Well, first, I've installed the Paweld's code, F9 and Error, see Error501.png. So I've loaded by path and name all my fonts, below are some lines from 498 to 504, and I've set up the CacheFonts for looking at /usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine/ only, using the Paweld's code, so 26 fonts have been loaded, no problem : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i .../usr/sha re/fonts/fonts_shared/from_Win2000/Polices/Machine/amrtypeb.ttf/usr/sh are/fonts/fonts_shared/from_Win2000/Polices/Machine/ANDALEMO.TTF  498/ usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine/CodeMorse.tt f 499/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine/DOUR45 W.TTF   500/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine/ DOUR46W.TTF   501/usr/share/fonts/fonts_shared/from_Win2000/Polices/Ma chine/DOUR65W.TTF   502/usr/share/fonts/fonts_shared/from_Win2000/Poli ces/Machine/DOUR66W.TTF   503/usr/share/fonts/fonts_shared/from_Win200 0/Polices/Machine/geo703bc.ttf  504/usr/share/fonts/fonts_shared/from_ Win2000/Polices/Machine/LETTERGO.TTF/usr/share/fonts/fonts_shared/from _Win2000/Polices/Machine/Linedraw.ttf...At the end of some lines are the values found in the memolog when I load all the 1116 fonts And attached is a try with the fonts between 499 and 504. HTH, ---------------------------------------------------------------------- Zvoni · 2024-07-09 12:48 Quote/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine/DOUR46 W.TTF   501Rename dour46w.ttf to dour46w.bak (or whatever. The Fileextension is important) for the code to SKIP that file. Is it still choking on the next ttf's (dour65w.ttf which would be the "new" Index 501)? ---------------------------------------------------------------------- jipété · 2024-07-09 13:09 Well, renamed --> no error and the file is not loaded as a file : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i .../usr/sha re/fonts/fonts_shared/from_Win2000/Polices/Machine/CodeMorse.ttf/usr/s hare/fonts/fonts_shared/from_Win2000/Polices/Machine/DOUR45W.TTF/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine /DOUR65W.TTF/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine /DOUR66W.TTF/usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine /geo703bc.ttf...Only 1115 files, now. Anyway, the font is still available for LOWriter or The Gimp, for example... I don't understand... ---------------------------------------------------------------------- Thaddy · 2024-07-09 13:36 If the font is a resource it does not need to be "installed" under either /user/share/fonts or /usr/local/share/fonts. same goes for Windows. Fonts are directory entries or resources. So fileexists will work. No exceptions plz. If you need one particular font, simply copy it to the (a) font directory or include the font as a resource. ---------------------------------------------------------------------- Zvoni · 2024-07-09 13:37 Quote from: Thaddy on July 09, 2024, 03:36:10 pmIf the font is a resource it does not need to be "installed" under either /user/share/fonts or /usr/local/share/fonts. same goes for Windows. Fonts are directory entries or resources. So fileexists will work. No exceptions plz. Thaddy, i doubt it has to do with FileExists. (Or was your answer in regards, why the Font is still available to Gimp?) It's probably a corrupted ttf-file, as TS confirmed in the post above ---------------------------------------------------------------------- Thaddy · 2024-07-09 13:39 That is a possibility, but usually not the most likely. New disk in that case  What I am complaining about is the way exceptions are used here. You understood that very well. You do not use exceptions for that (except if the font file is indeed mutilated and has become unreadable, that is a real exception.) Such an exception should show up trying to use the font, not enumerating available fonts. ---------------------------------------------------------------------- Zvoni · 2024-07-09 13:43 Quote from: Thaddy on July 09, 2024, 03:39:49 pmThat is a possibility, but usually not the most likely. New disk in that case  Errr.....you did see, that he did try in Post 7 what i told him (renaming the "offending" ttf-file at Index 501)? And that TS confirmed his code runs through all 1115 ttf-files with no error? Meaning: That particular file is different compared to the others (especially since it Chokes in ParseName, which implies FileExists actually returned true). Conclusion: File corrupted is the most (!!) likely reason ---------------------------------------------------------------------- Thaddy · 2024-07-09 13:46 Err... I agree with you? But that should still be on use, not on enumeration? And hard-coded paths? ---------------------------------------------------------------------- paweld · 2024-07-09 13:50 Quote from: ThaddyWhat I am complaining about is the way exceptions are used here. You understood that very well. You do not use exceptions for that (except if the font file is indeed mutilated and has become unreadable, that is a real exception.) Such an exception should show up trying to use the font, not enumerating available fonts. And it is for this purpose that I applied try ... except. There is no need to check for the existence of the file because the BuildFontCache routine does that (or more precisely, SearchForFonts). ---------------------------------------------------------------------- Thaddy · 2024-07-09 14:05 No, it simply looks at /etc/fonts/* and examines its files. On windows it is a bit easier. Resource fonts are a bit different. (but I use them a lot) These are never in the font enum. ---------------------------------------------------------------------- paweld · 2024-07-09 14:18 And did you even read the first post in the thread? TS uses fpttf - and that is quite different from System.Fonts. ---------------------------------------------------------------------- jipété · 2024-07-09 17:52 Here, Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i /etc/fonts/* =-rw-r--r-- 1 2808 15 mai    2020 fonts.confdrwxr-xr-x 2 4096 18 août   2022 conf.availdrwxr-xr-x 2 4096 17 mai   07:31 conf.d cat fonts.conf shows sentences that I have no time to spend for tests ls -al conf.avail shows 14 fonts' names ls -al conf.d shows 46 links to conf files, dunno what to do with that. Back to my problem : thanks to you but you forget that basic fact : if I use /usr/share/fonts (1116 files) there is a problem with the 501th font, DOUR46W.TTF if I use /usr/share/fonts/fonts_shared/from_Win2000/Polices/Machine (only 26 files) there is no problem ! So I take 20 files off, move them elsewhere and I restart the code : 1116 (files) becomes 1096, 602 (families) becomes 589 and there is no more problem, even with DOUR46W.TTF kept in this folder but at the 499th range. Something very strange is the fact that a little procedure activated from a button hangs now at the 481th font ! (501 - 20 = 481...) I have no time for that this week, see you on 15th of July. ---------------------------------------------------------------------- jipété · 2024-07-15 11:20 Hello, I'm back, with good news! I found the source of the problem, and it's inexplicable: it's a folder, just one, containing 9 .ttf files and 10 .otf files (but I have .otf elsewhere in the font tree, without problems...),  and I don't know how to explain it but there's only one file (the first .ttf file of the list from this folder) that is accepted by gTTFontCache.Items! The others crash the program. Well, I'll delete all that, I could live without them. For your information, here are the culprits, extracted from the 960-line list: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i .../usr/sha re/fonts/fonts_shared/from_Win2000/Polices/Bodoni/BODONI- 1.TTF/usr/share/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garam ond-EB-Pardo/EBGaramond-ExtraBold.ttfcrash here-- /usr/share/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond- EB-Pardo/EBGaramond-ExtraBoldItalic.otf/usr/share/fonts/fonts_shared/f rom_Win2000/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-SemiBold.ttf /usr/share/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond- EB-Pardo/EBGaramond-Regular.otf/usr/share/fonts/fonts_shared/from_Win2 000/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-Regular.ttf/usr/shar e/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-Bold.ttf/usr/share/fonts/fonts_shared/from_Win2000/Po lices/Garamond/Garamond-EB-Pardo/EBGaramond-Medium.otf/usr/share/fonts /fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-ExtraBold.otf/usr/share/fonts/fonts_shared/from_Win20 00/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-Medium.ttf/usr/share/ fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-MediumItalic.ttf/usr/share/fonts/fonts_shared/from_Wi n2000/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-Italic.ttf/usr/sha re/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-MediumItalic.otf/usr/share/fonts/fonts_shared/from_Wi n2000/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-ExtraBoldItalic.tt f/usr/share/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond- EB-Pardo/EBGaramond-SemiBold.otf/usr/share/fonts/fonts_shared/from_Win 2000/Polices/Garamond/Garamond-EB-Pardo/EBGaramond-BoldItalic.otf/usr/ share/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-Bold.otf/usr/share/fonts/fonts_shared/from_Win2000/Po lices/Garamond/Garamond-EB-Pardo/EBGaramond-SemiBoldItalic.ttf/usr/sha re/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-Italic.otf/usr/share/fonts/fonts_shared/from_Win2000/ Polices/Garamond/Garamond-EB-Pardo/EBGaramond-SemiBoldItalic.otf/usr/s hare/fonts/fonts_shared/from_Win2000/Polices/Garamond/Garamond-EB- Pardo/EBGaramond-BoldItalic.ttfrestart ok here-- /usr/share/fonts/font s_shared/from_Win2000/Polices/Garamond/EBGaramond/08/EBGaramond08- Regular.otf/usr/share/fonts/fonts_shared/from_Win2000/Polices/Garamond /EBGaramond/08/EBGaramondSC08-Regular.otf... EDIT 30/july/24 Solved but incomprehensible! Other problem, see my 30/july post /EDIT Thanks, everybody ---------------------------------------------------------------------- paweld · 2024-07-15 11:39 It is likely that the font files are corrupted, so the parser did not cope with it. If you are making a program just for yourself then you can leave it like that, however, if you are going to share it further, in my opinion you should use the try...except block when trying to load/read each font item. ---------------------------------------------------------------------- jipété · 2024-07-15 12:16 Quote from: paweld on July 15, 2024, 01:39:24 pmin my opinion you should use the try...except block when trying to load/read each font item. Something like that ? : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  function ComputeField(aName: string): string;  begin  Result := Copy(ExtractFileName(aName), 1, length(aName)-4);  end;begin  gTTFontCache.SearchPath.Add('/usr/share/fonts');  gTTFontCache.BuildFontCache;  for i:= 0 to gTTFontCache.Count-1 do  try    with gTTFontCache do begin      if Items[i].HumanFriendlyName = '' then field1 := ComputeField(Items[i].FileName) else field1 := Items[i].HumanFriendlyName;      if Items[i].PostScriptName    = '' then field2 := ComputeField(Items[i].FileName) else field2 := Items[i].PostScriptName;      if Items[i].FamilyName        = '' then field3 := ComputeField(Items[i].FileName) else field3 := Items[i].FamilyName;      aLine := field1 +' ...'+  field2 +' ...'+  field3 +' ...'+ Items[i].FileName +' ***'; // *** used for end-of- line}      memoFontList.Lines.Add(aLine);    end;  except    memoFontList.Lines.Add('ERROR in '+ TFPFontCacheItem(gTTFontCache.Items[i]).FileName)  end;end; Never seen the error above... ---------------------------------------------------------------------- jipété · 2024-07-15 13:19 Hello, Quote from: Thaddy on July 09, 2024, 12:39:59 pmThe part that is wrong by design is the exception part: you should know beforehand if a font exists or not.How do you do that ? Quote from: Thaddy on July 09, 2024, 12:39:59 pmThe other thing that is wrong is not choosing a font family, so there is at least a reasonable alternative. Those two issues should really have been addressed a long time ago,  and it has been mentioned many times.Will be happy to read that, thanks for the links. ---------------------------------------------------------------------- paweld · 2024-07-15 13:28 Quote from: jipétéSomething like that ? : yesQuote from: jipétéHow do you do that ?you don't need to check it - such control is already provided by the method gTTFontCache.BuildFontCache;. ---------------------------------------------------------------------- jipété · 2024-07-30 10:21 Fonts, FpTTF and gTTFontCache, the nightmare Hello, I've been struggling with fonts for over a month now, with incomplete results. I've searched the entire internet, read hundreds of posts, and done dozens of code tests. In the end, out of 935 .ttf and .odt files, I have 17 that refuse to behave normally. Cache analysis shows empty data for the three fields PostScriptName, FamilyName, and HumanFriendlyName, example with this little tool found this morning and adapted to my needs: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TfrmMain.btnBasicTestClick(Sender: TObject);var // https://forum.lazar us.freepascal.org/index.php/topic,42163.msg293769.html#msg293769  F : Text;  i : Integer;begin(*  if gTTFontCache.SearchPath.Count=0 then  begin    {$IFDEF UNIX}      gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/');    {$ENDIF}    end;    *)  //ShowMessage(inttostr(gTTFontCache.Count));  if (gTTFontCache.Count=0) then    gTTFontCache.ReadStandardFonts;  {$IFNDEF WINDOWS}  AssignFile(F,'/tmp/fonts.txt');  Rewrite(F);  For I:=0 to gTTFontCache.Count-1 do     Writeln(F,I,' ',gTTFontCache.Items[i].PostScriptName,' : ',gTTFontCache.Items[i].FamilyName,' : ',gTTFontCache.Items[i].HumanFriendlyName);  CloseFile(F);  {$ENDIF}end; extract from log file: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 194 Ondine Regular : Ondine : Ondine Regular195 GenoaItalic : GenoaItalic : GenoaItalic196  :  : 197  :  : 198  :  : 199  :  : 200 SpartaCapsSSK : SpartaCapsSSK : SpartaCapsSSK Regular201 BlackadderITC-Regular : Blackadder ITC : Blackadder ITC and yet, the concerned missing fonts here work correctly in the Windows environment. By diving into the files, I still noticed that the ALMANAC.TTF font was among the missing ones and since I didn't like its name, I tried to modify the related fields with the good old Softy tool, like this: img almanach_names and amazement after saving and regenerating the cache, the font is still not detected! By analyzing the file in depth, I was then able to see that there are two different areas where this data is saved, one accessible and modifiable (and ineffective) by the GUI, and the other of which we don't know what it is used for and how we could modify its data... img font_without-with-dots.png A final word: of these 17 fonts not recognized by FpTTF, at least 4 come from the official Windows world and worked well (from Win3.1 regarding Wingding). And the question is: what can we do to correct these defects? I would have liked to say more and diagnose more deeply but there is no way to step through FpTTF and fpparsettf, the compiler does not allow me to do that and I don't know why... Linux Debian 11.9 Regards, ---------------------------------------------------------------------- jipété · 2024-07-30 11:01 Using the FontInfo tool (https://forum.lazarus.freepascal.org/index.ph p/topic,37329.msg250615.html) and the ALMANACH.TTF font (notice the "H" letter I've added), I see the following : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for I := 0 to NameRecordCount - 1 do begin  Stream.Read(TrueTypeNameRecord, SizeOf(TrueTypeNameRecord));  if EncodeWord(TrueTypeNameRecord.NameID) = 1 then begin    Len := EncodeWord(TrueTypeNameRecord.Length);    {Platform and Encoding stuff!!!}    if (EncodeWord(TrueTypeNameRecord.PlatformID) = 1) or (       (EncodeWord(TrueTypeNameRecord.PlatformID) = 3) and       (EncodeWord(TrueTypeNameRecord.EncodingID) = 0) )    then begin      {ANSI}      SetLength(Temp1, Len);      ...And with step-by-step and the mouse on the "Len" word (line 4 here) I read "10", which is the length of "ALMANAC MT" without the "H", a string which exists in the second part of the previous image, not available to us, as I explained. Maybe the useful data are there ? How to get them ? ---------------------------------------------------------------------- wp · 2024-07-30 11:21 Quote from: jipété on July 30, 2024, 12:21:32 pmI would have liked to say more and diagnose more deeply but there is no way to step through FpTTF and fpparsettf, the compiler does not allow me to do that and I don't know why... You must rebuild FPC with debug information. ---------------------------------------------------------------------- jipété · 2024-07-30 16:21 Thanks for this info (this is the first time I've had to recompile FPC...) I'll see about it a bit later, for now I'm focusing on the contents of the ALMANAC(H).TTF file. I put parentheses around the H because the original file doesn't have this H, which doesn't change the fact that the new file, like others, is badly analyzed by gTTFontCache. I made an image of the binary content of the file, we can clearly see that the data is duplicated, once with the letters that follow each other normally, another time they are separated by the value 00. And we can see that the upper part of the image works with Almanac while the lower part uses Almanach, highlighted in red, and present thanks to Somfy. From there I don't know what to do. Post a bug report? In the meantime, I'm happy to post files that are not compatible with FpTTF, for testing, but I won't be able to correct the problem... And regarding those who wrote on the previous page it was a broken font problem, I'm able to work with the font, using LO-Writer... Quote from: dbannon on July 09, 2024, 12:50:09 pmIts worth noting that the FontCache is substantially improved in FPC- fixes. If you are using FPC322, might be worth trying Fixes.Dunno where to look for. Regards, ---------------------------------------------------------------------- jipété · 2024-08-06 07:14 Hello, Here is the end of my torments. I recap: I currently have 935 ttf and otf files, some dating back 30 years and having always worked well, in general and under Windows. It was when switching to Linux that a problem appeared, when trying to use the option to know the location of the files, useful for their management, which generated a SIGSEGV exception for 17 of them, I mean the Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetFontFile(fName:string): string; // https://forum.lazarus.freepascal.org/index.php?topic=48975.0 var  lFC: TFPFontCacheItem;begin  lFC := gTTFontCache.FindFont(fName);  try    Result := lFC.FileName;  except    //  end;end;function that relies on the fpTTF.pp unit and that I modified like this because I was tired of the complete shutdown of the program in the event of a problem with one or more fonts: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetFontFile(fName:string): string;// https://forum.lazarus.freepascal.org/index.php?topic=48975.0 var  lFC: TFPFontCacheItem;begin  lFC := gTTFontCache.FindFont(fName);  if lFC <> nil   then Result := lFC.FileName  else begin    Result := '';    ShowMessage('Problem with font '+fName);  end;end;And I quickly realized that when FindFont didn't return anything, it was because the string fields HumanFriendlyName, PostScriptName and FamilyName were empty! These 3 fields (as well as the FileName field, which is never empty since it defines the current file) are in the fpTTF.TFPFontCacheItem object, public section. So I had 935 True/OpenType files, 17 of which were not present in the Family list of a tool being created, and I should point out right away that these 17 files are perfectly usable in the Windows world, exactly like the other 918. In the Linux world, it's random... I then started to examine the inside of the 17 files with a Perl tool (ttftable from the Font-TTF-Scripts-1.06 library + installation of the libfont-ttf-perl package [read: http://scripts.sil.org/FontUtils, download: https://github.com/silnrsi/font-ttf-scripts.git]) which extracts the "name" tag in a binary file to examine with a hex editor in which I was able to see that the fields returned empty by the FreePascal tool were indeed present in the 17 files! Usage: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ttftable -export "name=try" /path/fontname.ttf will generate a file in the folder opened to launch the script, a script that I was not able to automate with TProcess, too bad, but since there were only 17 files, I wasted less time processing them one by one by hand. A confirmation by another tool from the FontForge suite (showttf.c, download: https://github.com/fontforge/fontforge/blob/master/contrib/f onttools/showttf.c then a small modification to have access to the values ​​of the fields [addition of an option "-n" like "name": add at the very top under "static int head_check = false;" the line Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i static int copyright_check = false;then add in "readit" under block "if ( head_check ) {" the block Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     if ( copyright_check ) {        if ( info.copyright_start!=0 )            readttfname(ttf,util,&info);return;    }and at the very bottom in the main, after "head_check = true;", add Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i else if ( strcmp(pt,"n")==0 || strcmp(pt,"checkcopyright")==0 ) // to add in main    copyright_check = true;Recompile and bingo! Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ ./showttf -n /filepath/afile.ttf blablabla...]) and for me the case is closed: all the fields necessary and useful for the proper functioning of the fonts are present in the files and used by the appropriate tools EXCEPT those that rely on FreePascal's fpTTF, which may have random behavior. What made me persist in all this was the fact of noticing that these famous fields absent in FreePascal were indeed present with an old Windows tool, I named Softy.exe, which allowed me to generate this magnificent image where we notice that there are only 16 thumbnails because, for a reason that I do not know, the Windows wingding.ttf font (about 30 years old!) violently crashes Softy and since we do not have its code, it will stay like that especially since under Linux with showttf and my addition I have my information: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ ./showttf -n /data/17ttf/wingding.ttf NAME table (at 532)        format=0      nrecords=39        taboff=474         platform=1 plat spec encoding=0 language=0 name=0 Copyright         strlen=112  stroff=0      Copyright � 1992-1995 Microsoft Corp. All Rights Reserved.                                           � 1990-1991 Type Solutions, Inc. All Rights Reserved.         platform=1 plat spec encoding=0 language=0 name=1 Family         strlen=9  stroff=116      Wingdings         platform=1 plat spec encoding=0 language=0 name=2 Subfamily         strlen=7  stroff=1566     Regular         platform=1 plat spec encoding=0 language=0 name=3 UniqueID         strlen=27  stroff=1556  Wingdings Regular: MS: 1995         platform=1 plat spec encoding=0 language=0 name=4 FullName         strlen=9  stroff=116      Wingdings         platform=1 plat spec encoding=0 language=0 name=5 Version         strlen=12  stroff=1583    Version 2.55         platform=1 plat spec encoding=0 language=0 name=6 Postscript         strlen=17  stroff=1595    Wingdings-Regular         platform=1 plat spec encoding=0 language=0 name=7 Trademark         strlen=57  stroff=1612    The Windows logo is a trademark of Microsoft Corporation.         platform=1 plat spec encoding=0 language=0 name=8 Manufacturer         strlen=20  stroff=1669    Microsoft Typography       platform=1 plat spec encoding=0 language=0 name=9 Designer       strlen=31  stroff=149     Kris Holmes and Charles Bigelow         platform=1 plat spec encoding=0 language=0 name=10 Descriptor         strlen=1444  stroff=112           The Wingdings fonts were designed blabla... The most observant will notice that in the image there is twice the same font: in the second line the first two thumbnails show the same data, however coming from two different files but it is not visible there and I do not know why I had fun making a modification of I do not know what... Do not take it into account, this large image is mainly there to show that these 16 files are accessible under Windows with a tool dating back to Windows 3.1 while the last of the FreePascal/Lazarus couple is not capable of it, alas. The only thing that remains pending and bothers me is that I have not found why these 17 files only and not the others generate an error. We can get around it but it is "not finished". That's all. Have a nice day,