Fontpreview doesn't find any fonts in the system
Anon-Exploiter opened this issue ยท 8 comments
Hey,
I came to try the tool from Reddit (looked really nice and handy). Actually, the issue is that it can't find any fonts in my distribution (i.e. Pop! OS 18.04 LTS (uses Ubuntu as its base)).
Going through the code on line 105.
^^ I found out the command which finds the fonts and runs awk on the output. The issue lies in awk not being able to parse the output correctly.
After getting the fonts and running awk on it:
The actual script (fontpreview)'s output:
Appreciate you looking into it. Let me know if further details are required to resolve the issue.
@Anon-Exploiter Does this awk
command fix it?
awk -F: '/^\*Font: /{print substr($NF,2)}'
I removed the s
@sdushantha, no, it doesn't.
Here's the POC with the updated content.
Also, here's the output of convert -list font
with head of 100 lines for your testing with awk.
list-font.txt.
Let me know if anything else's required with the testing.
It's because the expression '/^\s *Font: /{print substr($NF,2)}'
doesn't work in mawk. Use this instead:
awk -F: '/^[ ]*Font: /{print substr($NF,2)}'
@SmartFinn That seems to work for me, does it work for you @Anon-Exploiter ?
Also, @SmartFinn could you please explain what the change does? Im not really good with awk
:P
@sdushantha it's just another way to write the regex without the escape sequences. The main thing to understand is that there is not one awk interpreter, there are many of them. The most popular are GNU awk and mawk. Therefore, the regular expression should be as generic as possible.
@SmartFinn Oh, thats new! I havent heard of mawk before, Ill make sure that I take a look at it.
@Anon-Exploiter I have updated fontviewer
with the new regex, can you check if it works for you?
It's working perfectly fine. Thanks for updating it. @SmartFinn & @sdushantha ๐
Closing the issue.