在Linux中获取文件元数据 [英] Get file metadata in Linux

查看:194
本文介绍了在Linux中获取文件元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上有一个脚本解析字体,所以我可以在我的应用程序中使用它们。



很遗憾,很多时候字体文件的名字本身是错误的(例如,该文件可能被命名为_FONT1.ttf)。在Windows上,当我打开文件的属性,我看到在字体的详细信息选项卡(即其元数据)内正确的名称是存储在一个名为标题字段。

如何从我的文件中提取这段元数据?

您可以使用 fc-query 作为 fontconfig 来获取信息。 .ttf文件中的 fc-query 将为您提供大量信息。您需要的信息可以通过获取ttf文件的全名获得。您可以尝试 fc-query< .ttf file> --format =%{fullname} man fc-query 会给你更多的细节。帮助!


I have a script on my server that parses fonts so I can use them in my application.

Sadly, a lot of times the name of the font file itself is wrong (e.g., the file may be named _FONT1.ttf). On windows however, when i open up the file's properties, I see that inside the fonts Details tab (i.e., its metadata) the correct name is stored in a field called 'Title'.

How would I extract this piece of metadata from my file?

解决方案

You can use fc-query utility provided as part of fontconfig to get the information. fc-query on the .ttf file will provide you with lot of information. The information which you need can be obtained by getting the fullname of the ttf file. You can try fc-query <.ttf file> --format=%{fullname} man fc-query will give you more details regarding the same.
Hope this helps!

这篇关于在Linux中获取文件元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆