Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Sep 2014, 14:23
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Pfontview - A simple lightweight TrueType font viewer
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [21 Posts]   Goto page: 1, 2 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 15 Oct 2012, 22:34    Post subject:  Pfontview - A simple lightweight TrueType font viewer
Subject description: Requires Gtkdialog >= 0.8.2, fc-query, ash, bash or dash
 

Pfontview enables the previewing of TrueType fonts.

Requirements
Gtkdialog >= 0.8.2 - http://code.google.com/p/gtkdialog/
fc-query - part of fontconfig - http://fontconfig.org/

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.

pfontview [Updated 2012-11-08 to version 0.1.3]
Source code package: http://code.google.com/p/gtkdialog/downloads/list

Pet package:
  • 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 Razz

Regards,
Thunor
pfontview-0.1.2.png
 Description   pfontview-0.1.2
 Filesize   16.39 KB
 Viewed   1860 Time(s)

pfontview-0.1.2.png

fc_query-0.8.2-i686.tar.gz
Description  Built on Slacko 5.3.3, stripped with --strip-unneeded
gz

 Download 
Filename  fc_query-0.8.2-i686.tar.gz 
Filesize  2.77 KB 
Downloaded  802 Time(s) 

Last edited by thunor on Thu 08 Nov 2012, 21:38; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Fri 19 Oct 2012, 08:03    Post subject:  

Thanks, this works rather well.

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 Smile

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!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Sat 20 Oct 2012, 11:26    Post subject:  

Oh, there is a bug Sad
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:
Code:
    fullname: "Dancin LET Plain:1.0"(s)

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 21 Oct 2012, 14:16    Post subject:  

Thanks for your feedback disciple.

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.

For me using Slacko 5.3.3, gtk won't initialise to this font: http://www.eborg2.com/Fonts/FontsB/BERNHC.TTF

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.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 21 Oct 2012, 14:59    Post subject:  

Dear thunor,

You are on the right track. I once did this thing: http://www.murga-linux.com/puppy/viewtopic.php?t=69107, and discovered that there are "funky" fonts, either because of their internal names or wierd glyph layouts. Please have a look, so we can understand this problem.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Sun 21 Oct 2012, 16:44    Post subject:  

Quote:
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.

I am running Arch Wink

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 23 Oct 2012, 12:24    Post subject:  

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

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.
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sat 27 Oct 2012, 13:48    Post subject:  

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.

sfontview shows everything I've tried except wingding type fonts which I've found vovchik's Pfont2 ttf2png based viewer doesn't render either. Maybe I'll modify pfontview's menu to include links to Pfont2 and sfontview if they're installed to give a complete solution.

There's no point in me making a package since it's one tiny binary which you can compile yourself. There are instructions within the source file but I'll print them here anyway:
Code:
Compile with:
gcc -Wall sfontview.c -o sfontview `sdl-config --cflags --libs` -lSDL_ttf

Strip with:
strip --strip-unneeded sfontview

Place the sfontview binary into ~/my-applications/bin or /usr/local/bin.
Place sfontview.bmp into /usr/share/pixmaps or /usr/local/share/pixmaps.

Don't forget that ESC will also close the window so you can quickly click through lots of fonts with one hand hovering over the ESC key.
sfontview-0.1.1.png
 Description   sfontview-0.1.1
 Filesize   15.19 KB
 Viewed   1869 Time(s)

sfontview-0.1.1.png

sfontview-0.1.1.tar.gz
Description  [Updated 2012-10-31 to version 0.1.1] Source code, i686 binary and window manager icon included
gz

 Download 
Filename  sfontview-0.1.1.tar.gz 
Filesize  9.56 KB 
Downloaded  725 Time(s) 

Last edited by thunor on Wed 31 Oct 2012, 13:53; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 27 Oct 2012, 15:07    Post subject:  

Dear thunor,

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 Smile

With kind regards,
vovchik
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Sat 27 Oct 2012, 19:55    Post subject:  

In case anyone is interested, Pfontview also opens .fon files as well as (some Wink ).ttf files.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Mon 29 Oct 2012, 05:36    Post subject:  

Hi, I tried Pfontview 0.1.1, didn't work for me:

http://bkhome.org/blog/?viewDetailed=03079

I am running Precise Puppy 5.4..

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 29 Oct 2012, 21:21    Post subject:  

Thanks for the feedback guys. I won't waste any more time with gtk/Pango then Smile I'm quite happily using sfontview now anyway.

Interesting results though from our Arch, Slacko and Precise distros.
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7802
Location: qld

PostPosted: Mon 29 Oct 2012, 21:31    Post subject:  

Sfontview works fine here in Slacko beta. I have over 215 fonts in my .wine install (MSoffice is installed) and only wingdings don't show. (full SDL is included, Slackware bundles all)
fonts.png
 Description   
 Filesize   52.37 KB
 Viewed   1980 Time(s)

fonts.png


_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Oct 2012, 08:34    Post subject:  

BarryK wrote:
Hi, I tried Pfontview 0.1.1, didn't work for me:

http://bkhome.org/blog/?viewDetailed=03079

I am running Precise Puppy 5.4..

BarryK: Sorry, I didn't initially visit the link and I assumed you meant that the fonts weren't rendering, so I'm downloading Precise to see what that error is.

Mick: Thanks for the feedback.
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Wed 31 Oct 2012, 14:10    Post subject:  

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 Smile 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.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [21 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1008s ][ Queries: 13 (0.0082s) ][ GZIP on ]