B4J Question How to read metadata from a TTF file

zed

Active Member
Licensed User
In a clv, I list all the TTFs with the fx.GetAllFontFamilies command
This command returns the FontFamily but not the FileName.ttf.
I know the filename is in the metadata.
I would like to be able to read this metadata to retrieve the file name so that I can make a copy of this TTF file in another folder.

Here you can read the metadata

Thanks a lot
 

Magma

Expert
Licensed User
Longtime User
In a clv, I list all the TTFs with the fx.GetAllFontFamilies command
This command returns the FontFamily but not the FileName.ttf.
I know the filename is in the metadata.
I would like to be able to read this metadata to retrieve the file name so that I can make a copy of this TTF file in another folder.

Here you can read the metadata

Thanks a lot

Hi there... hmmm

What if you "check" manual the ttf files of a folder (list files perhaps of: C:\Windows\Fonts) one by one (looping with your app) and using fx.loadfont ... so in that case you will know the filename...
 
Upvote 0

teddybear

Well-Known Member
Licensed User
This command returns the FontFamily but not the FileName.ttf.
I know the filename is in the metadata.
There is no filename in the metadata, you can't read filename by the FontFamily. but you can read the FontFamily by the ttf file.
 
Upvote 0

zed

Active Member
Licensed User
Hi there... hmmm

What if you "check" manual the ttf files of a folder (list files perhaps of: C:\Windows\Fonts) one by one (looping with your app) and using fx.loadfont ... so in that case you will know the filename...
The idea is good. I thought about it. But how does it work with Linux.
The fx.GetAllFontFamilies command is part of the Java API.
I imagine this command will also work on Linux. I really wish I could read the Metedatas. If I don't have this solution, I will implement this workaround. But, how do I do it for Linux. Could this pose a problem?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Generally the font files are put to directory /usr/share/fonts
 
Last edited:
Upvote 0

zed

Active Member
Licensed User
Ultimately, this is not a good idea

Caused by: java.io.FileNotFoundException: C:\Windows\Fonts (Access denied)

Hum! Hum! 🥵
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
c:\windows folder and the subfolders need admin rights to manage them... also the root "c:\"

So someway need to run b4j.exe with admin rights... right click properties - run as admin...

In Windows 10 working... not have now windows 11 to check that...
 
Upvote 0

zed

Active Member
Licensed User
I am in admin on W11. B4J is launched in admin.
With File.ReadList(path,"") I have all access denied
I think I have a problem.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
With File.ReadList(path,"") I have all access denied
file.readlist is not a way to filter files.
file.readlist expect a Path AND a FILENAME. Both together should point to a file.

What is the content of path in your tryings?

Sounds like you are doing something weird
 
Upvote 0

zed

Active Member
Licensed User
like this, it's much better.
File.ListFiles("C:\Windows\Fonts")


Thank you for your answers
 
Upvote 0
Top