fc-query
I'm using Slacko 5.3.3 and it comes with fontconfig but fc-query is not included within the fontconfig builtin, so Slacko 5.3.3 users at least will require it but I've compiled fc-query on my computer and then processed it with "strip --strip-unneeded" which I've attached below -- place it in ~/my-applications/bin or /usr/bin, you decide. If you want to compile it then run "fc-list -V" to get the version of fontconfig on your computer so that you can download the correct source package, use the recommended configure options settings from the INSTALL file but change --prefix=/usr to --prefix=/tmp/fontconfig, make and then make install. You'll find fc-query in /tmp/fontconfig/usr/bin.

Download the source package, extract it and change into the directory.

Type "make DESTDIR=pfontview-0.x.x install"

Type "dir2pet pfontview-0.x.x" and keep pressing Enter until the "GUI window" appears and then press the "Generate..." button.

Click on pfontview-0.x.x.pet to install.

How to use it
pfontview expects a ttf file but you're unlikely to be using this on the command-line so make this the default application for ttf files. In ROX-Filer you'd achieve this by right-clicking a ttf file and selecting "Set Run Action..." and entering pfontview "$@".

Internationalisation
funci18nApply contains the few strings that will require translating for other languages and if you attempt it then dump your text here and I'll add it to the project.

fc-query extracts font information not only in English but in whatever languages (I guess) that the font supports, so "Bold" can be "Negreta", "fed", "Fett", "Gras" etc. which I'm assuming that I'm supposed to be using as a developer when I request bold on a non-English computer. So, if the font information outputs "Bold" in your native language then I'll use it, else I request the English equivalent which will be available. I guess we'll find out now if my assumption is correct

I've always wanted a decent solution for previewing fonts using the system font rendering settings, but I had trouble coming up with a proper solution, and it wasn't a really high priority

I'm wondering - do you create the symlink in ~/.fonts specifically so that other programs can access an "uninstalled" font when it is open, like on Windows?
Have you looked at whether it is possible to avoid temporary config or font files like this, by somehow specifying an additional font directory (the location of the ttf file) on the fly?_________________DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!

Oh, there is a bug
With a lot of fonts it states the correct style and family, but it doesn't actually display the correct font, instead it displays the system default font (in my case "sans") instead. Also for these fonts if I click the font button the system default font is selected...

Looking at the "FontQuery" files generated, I notice that the "Full name" of the fonts that don't work all seem to include a colon, whereas the "Full name" of the fonts that do work don't include a colon.
e.g. this font does not display:

The process is very simple: place a symlink to a ttf file into ~/.fonts and then use fc-query to query that file and create a font name from family + style. This font name is used in three different ways:

1. in a gtkrc file to style the preview edit widget.
2. in Pango markup within the main text widget (GtkLabel).
3. in the fontbutton widget if you have it shown.

All this can be seen within the files in the temporary folder /tmp/pfontview.XXXXXXXX so you can see exactly what is being requested.

I too have experienced fonts that gtk refuses to initialise to, and that's three different ways it refuses as listed above. As you've noted yourself, when the font doesn't show, the fontbutton will have "sans regular 10" selected because it's the default font, but it is possible to manually select the font that gtk refuses to initialise to.

I don't know why gtk refuses to initialise to certain fonts even though you can manually select them via the fontbutton. I've even placed the font into ~./fonts, fixed the font name in pfontview e.g. ~/.fonts/bernhc.ttf, rebooted and it still won't show.

The fact is it does work but gtk refuses to initialise to certain fonts, so the method is good but something isn't right. But where do I start to troubleshoot that? I'd like to try it on another Linux distribution but I don't currently have another installed, so maybe a reader can assist with that.

If you place that into ~/.fonts, reboot or restart X, open the folder and click on the file you'll actually be viewing an installed font if installing means placing into ~/.fonts -- it still won't show.

I don't have another application to view fonts and I can always check using the fontbutton so at the moment it's 100% better than having no font viewer.

I've have a feeling that I've walked out onto a minefield and you're all there in the middle waving at me

vovchik: I tried Pfont2 and it works. I set ttf "@" as the default action in ROX and it opens the preview window when I click on a ttf file.

disciple: Great, then we can rule out the problem being anything puppy related."fullname" from fc-query I have found to be unreliable because it can be junk. family + style constitute a valid font description.

I wrote a simple gtk app to do the same thing as pfontview but the fonts that don't show still don't show. I did some research on the net and it is my opinion that Pango -- the gtk font renderer -- doesn't like certain fonts and we won't understand why until somebody writes a gtk app that deals with Pango in code because at the moment there's no feedback as to why the fonts aren't acceptable.

I have 23 fonts out of 213 (11%) that gtk/Pango refuse to initialise widgets to. Five of these are definitely suspect since the text in the style field is the author's mutterings. Of the remainder there are oddities for example "Demi Bold" which I don't see Pango accepting as a valid weight, and things like "Ext Condensed" when it should be "Extra-Condensed". I'm going to guess that we'll find Pango won't render certain fonts because they have some irregularities, some non-standard attributes.

Therefore pfontview is as good as it gets using gtk/Pango and gtkdialog. I'll have a play with Pango in C.

I didn't find anything within the Pango API to assist with getting feedback on fonts that gtk/Pango doesn't like and all I found on the gnome mailing list was "I don't know", so I've tried something else.

Do I need to create yet another font viewer thread? Probably not, so I'll upload it here. I've called it imaginatively sfontview because it uses SDL + SDL_ttf and that's it, so you'll have SDL anyway and you may have SDL_ttf too since many games use it.

I am glad you are looking at this, too. I really did not understand why pango refused fc-list descriptions - even properly filtered ones - for a number of fonts. It could be a weirdness in the ttf standard - which M$ promoted - and some things are dicey there. Some ttf fonts contain escape sequences in their names, I discovered, and those need processing. Your prog workes nicely. Thanks

pfontview updated to 0.1.2:
* Added a Tools menu with access to Pfont2 and Sfontview if installed.
* Added a requirements check for fc-query and gtkdialog >= 0.8.2.

sfontview updated to 0.1.1:
* Added an optional window manager icon to be placed into /usr/share/pixmaps or /usr/local/share/pixmaps.
* Included the SDL_main stuff.

I have additionally installed Precise 5.4 and pfontview behaves exactly the same as it does on Slacko 5.3.3 i.e. gtk/Pango refuses to initialise widgets to certain fonts. I've been downloading a few more fonts and I've found a few more within installed games and the Java runtime and I can report that 29 out of 260 (11%) particular fonts that I have won't show using pfontview. The good news is that if you suspect you're looking at the default DejaVuSans and you have sfontview or pfont2 installed then you can access them directly through pfontview's menu.

It's swings and roundabouts really isn't it I like the text entry box using gtk/Pango and the fact that wingding type fonts show, but then I like the success rate of SDL_ttf.

Has anybody written anything using the Freetype 2 API? Then you could dispense with SDL_ttf and you'd have a viewer that could be bundled with Puppy.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum