Pfont2

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Pfont2

#1 Post by vovchik »

Dear Puppians,

I got inspired by zigbert's tiny pfont utility, which does what is ought to, except that it has no preview feature. I banged out Pfont2 as a kluge solution to the ttf preview problem. Although the next version will have a proper previewer based on freetype2 and gtk/CairoPango, this version is an interim solution. It does give you a preview of the first ttf page (chars 0 to 255), but none of the extra unicode tables :(. It installs ttf2png and pngcrop (little binary utilities), pfont2 and ttf into /usr/local/bin. If you have IM convert installed, it will use that for trimming the png, otherwise it will make use of pngcrop. You can set ttf (in/usr/local/bin) as the default handler for ttf files in rox so that you get a preview each time you click on a ttf file. The next version will be better...

With kind regards,
vovchik

PS. I compiled in Puppy 3.01 to ensure that the binaries run in old Puppies. They work fine in my Lucid, so new puppies should not encounter problems.

PPS. I just made a small correction to the ttf script (it didn't like parsing the filename if browsing a hidden directory). Now fixed.
Attachments
pfont2-0.21.pet
(32.27 KiB) Downloaded 1945 times
pfont211b.jpg
(23.49 KiB) Downloaded 1892 times
pfont211a.jpg
(30.73 KiB) Downloaded 3218 times

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Hello !

First : nice little app . I have missed such . :idea:

Second : The /tmp/font.png does not get on my screen , even with
http://packages.debian.org/squeeze/grap ... ick-compat
installed to get a 'convert' command (luci218/511) .
I only get the part of the description , if I don' t browse to /tmp .

Third : <action type="fileselect /usr/share/fonts">FONT</action>
I am no gtkdialog3 expert , but this still opens fileselect in /root .
Do you know how to adjust it ?
I guess I'd find it somewhere in zigbert's lession , but it is very large .

With kind regards ,
karl

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

pfont2 bugs

#3 Post by vovchik »

Dear Karl,

I don't know why the png file is not showing, as I can see it. Please have a look at the code in the "tiff" script (/usr/local/bin). If IM's convert is not found, I use another little program to clip the otherwise large png file. As for fileselect not wishing to show anything but "root", I have run into this problem before. I think there should be a "cd" to the appropriate dir (could also be /root/.fonts). Alternatively, the button could run "rox /root/.fonts", for example, and then drag-and-drop could be used. Do you want to try to make some mods? Ideally, we should write a little font previewer using calls to libtruetype and gtk/pango/cairo functions, eliminating the need to create png files altogether. KDE has a little program called kfontview that works as an excellent previewer for all ttf fonts, not only installed ones. That is what I would like for GTK. I have already started writing such a thing but keep getting runtime segfaults after my calls to libtruetype. I am trying to figure this out...

WIth kind regareds,
vovchik

User avatar
maik.murks
Posts: 327
Joined: Mon 28 Mar 2011, 06:19
Location: at home, at work or on holidays

#4 Post by maik.murks »

Hi vovchik.

So, here have you been hidden, in the desktop section. Well, I‘ve been waiting for you since awhile in the request section here.

However, I‘m glad to find you again today :)
And congratulations for your Pfont2 :)

I‘ve already downloaded your Pfont2 today and gave it a try. Pfont2 installs well and generates a menu entry in the desktop section as forecasted. A click on the menu item starts Pfont2. Unfortunately this is all what Pfont2 is doing for me on my 2.14X. It seems to be that Pfont2 doesn‘t like me. When I click on the 'View installed‘ button nothing happens. And when I drag and drop a TTF file from an USB stick into the empty field of Pfont2 and click on the 'Preview‘ button thereafter, nothing happens again. But the 'Exit‘ button works well :wink:

Then I tried ttf2png via console with a testfont.ttf. The result was a 256x256 pixel PNG file named font.png with the characters shown of the testfont.ttf. So, it seems to be that ttf2png works very well.

Do you have any idea, what I can do that Pfont2 likes me a little bit and works as it should work?

Moreover, it will be a good idea, I think, to mark that thread in the request section as 'filled‘ or 'solved‘ or whatever makes sense. And I‘ll add a link with some explainig words from the gfontview thread there to your Pfont2 thread here. I hope that is OK for you. Furthermore I like to add an additional link with a short description of Pfont2 into the Fonts-4-Puppy thread to that posting. I hope that is OK for you, too.

Last but not least, thank you very much for your work, for making Pfont2, a great little tool :)
And finally, I really like to have Pfont2 working on my 2.14X :)

Cheers :wink:

Maik.Murks

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

preview problems

#5 Post by vovchik »

Dear Maik.Murks and Karl,

Do you have a recent gtkdialog-splash installed? It is used to display the image and to provide a bit more information regarding the font. I know that gtkdialog-splash first appeared in later puppies, but it works in my old 3.01, for example. I use the latest version that can display images nicely. You can find it somewhere on the forum. Also, all the help messages appear using gtkdialog-splash, too, so it is pretty essential. It also esablishes a symlink to yaf-splash and replaces it. I have attached the version I think I am using to this post....

With kind regards,
vovchik

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

Re: pfont2

#6 Post by Karl Godt »

vovchik wrote:Dear Karl,

I don't know why the png file is not showing, as I can see it. Please have a look at the code in the "tiff" script (/usr/local/bin). If IM's convert is not found, I use another little program to clip the otherwise large png file.
Dear vovchick ,

I'll attach a screenshot , hope it is not too unclear .

The pic shows a rox filer window open at
/usr/share/fonts/truetype/ttf-liberation/

your main GUI after I dropped a .ttf into the line

the yaf-splash of the preview ; my yaf-splash is a script , while in Puppy 4 it is a binary ..?

another rox filer window showing /tmp

Viewnior 0.6 opens after clicking the /tmp/font.png

For looking into the code , I will first try pfont2 on a puppy4 frugal , to see if it is yaf-splash related .

WIth kind regareds,
karl

[edit] while previewing this post you said something about gtk-dialog3 ... will have a look into it [/edit]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

# diff `which gtkdialog-splash` /root/gtkdialog-splash-20110319/usr/bin/gtkdialog-splash | grep '^>' | wc -l

27

changed lines ....

31a54
> OR <path/to/pixmap> \n
100a124,126
> [ "`echo $arg | grep '^gtk'`" = "" ]&& icon="<pixmap>
> <input file>\"$arg\"</input>
> </pixmap>" #110318


also #!/bin/ash on top instead of #!/bin/sh .

Will report later after I made backups and so .

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#8 Post by Karl Godt »

YES , works now !

Additionally I had
pngcrop: error while loading shared libraries: libpng.so.3: cannot open shared object file: No such file or directory

But
find /usr/lib -name "libpng*"

gave me

/usr/lib/libpng.so
/usr/lib/libpng.a
/usr/lib/libpng12.a
/usr/lib/pkgconfig/libpng.pc
/usr/lib/pkgconfig/libpng12.pc
/usr/lib/libpng12.so
/usr/lib/libpng12.so.0
/usr/lib/libpng12.la

and

ln -s libpng12.so /usr/lib/libpng.so.3

fixed it .

Thank you very much , vovchik !

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

pfont display

#9 Post by vovchik »

Dear Karl,

Thanks for your debugging. In my lucid "ash" is a symlink to /bin/busybox. As for the libpng problem, I simply compiled in my old 3.01 and it must have been in the make file; I must have had that symlink from something I had done earlier, or else I would have had an error, too. So, for older puppies, the symlinks - ash, libpng and yaf-splash - and the new gtkdialog-splash pet are needed. I should then create an install or post-install script to handle those issues, unless you can do that and simply repost the pet, since you have already done all the investigative dirty work :)

With kind regards,
vovchik

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

For the path thingy : I really believe that in libgtk there maybe string fileselect can show something and perhaps reading the large source can show solutions ,

but for now I used some code from the ^buggy^ jwmconfig2 :

diff -U 2 -aNd /usr/local/bin/pfont2-0.21-orig /usr/local/bin/pfont2

Code: Select all

--- /usr/local/bin/pfont2-0.21-orig	2011-06-20 09:27:17.000000000 -0100
+++ /usr/local/bin/pfont2	2011-07-06 16:16:59.025537343 -0100
@@ -131,5 +131,5 @@
 fi
 }
-
+echo > /tmp/ttf_file.pfont2
 # ------------------
 function make_gui()
@@ -151,9 +151,10 @@
 					<entry accept="filename">
 						<variable>FONT</variable>
+						<input>cat /tmp/ttf_file.pfont2</input>
 					</entry>
 					<button>
 						<input file stock="gtk-open"></input>
 						<label>"Select "</label>
-						<action type="fileselect">FONT</action>
+						<action>FNT=`Xdialog --title "Please select your file" --fselect /usr/share/fonts/ 28 48 2>&1` ; echo "$FNT" > /tmp/ttf_file.pfont2 ; sleep 0.1s</action>
 						<action>refresh:FONT</action>
 					</button>
@@ -161,4 +162,5 @@
 						<label>"Clear "</label>
 						<input file stock="gtk-clear"></input>
+						<action>echo > /tmp/ttf_file.pfont2</action>
 						<action>clear:FONT</action>
 						<action>refresh:FONT</action>
the quintessence : using Xdialog --fselect and echoing the variable to a tmp-file .

User avatar
maik.murks
Posts: 327
Joined: Mon 28 Mar 2011, 06:19
Location: at home, at work or on holidays

Re: preview problems

#11 Post by maik.murks »

vovchik wrote:Dear Maik.Murks and Karl,

Do you have a recent gtkdialog-splash installed? It is used to display the image and to provide a bit more information regarding the font. I know that gtkdialog-splash first appeared in later puppies, but it works in my old 3.01, for example. I use the latest version that can display images nicely. You can find it somewhere on the forum. Also, all the help messages appear using gtkdialog-splash, too, so it is pretty essential. It also esablishes a symlink to yaf-splash and replaces it. I have attached the version I think I am using to this post....

With kind regards,
vovchik
Hi vovchik.

After installing of the pet and rebooting the preview of Pfont2 works well :)
But unfortunately after clicking the 'View installed' button still nothing happens. Do you have any idea?

Cheers :wink:

Maik.Murks

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#12 Post by Karl Godt »

<label>View installed </label>
<action>gfontsel &</action>

which gfontsel

/usr/bin/gfontsel

Not missing on mine side

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

view installed

#13 Post by vovchik »

Dear Maik.Murks,

I think you might be missing "gfontsel", which is called by the "View installed" button. Try issuing "which gfontslect" from a terminal. If you get nothing, it means "gfontsel" is missing from your exec dirs (typically /bin, /sbin/, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /usr/X11R7/bin and /root/my-applications/bin). I don't know what is used in 2.14X for showing installed fonts. I think this package might be available, thought, and perhaps somebody can post a version that runs under 2.14X here (or provide a link). I think my lucid version will segfault with an older glib, otherwise I would post it myself. You could replace gfontsel with

Code: Select all

Xdialog --fontsel "" 0 0
and the result should look the same :)

With kind regards,
vovchik

User avatar
maik.murks
Posts: 327
Joined: Mon 28 Mar 2011, 06:19
Location: at home, at work or on holidays

Re: view installed

#14 Post by maik.murks »

vovchik wrote:Dear Maik.Murks,

I think you might be missing "gfontsel", which is called by the "View installed" button. Try issuing "which gfontslect" from a terminal. If you get nothing, it means "gfontsel" is missing from your exec dirs (typically /bin, /sbin/, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /usr/X11R7/bin and /root/my-applications/bin). I don't know what is used in 2.14X for showing installed fonts. I think this package might be available, thought, and perhaps somebody can post a version that runs under 2.14X here (or provide a link). I think my lucid version will segfault with an older glib, otherwise I would post it myself. You could replace gfontsel with

Code: Select all

Xdialog --fontsel "" 0 0
and the result should look the same :)

With kind regards,
vovchik

Hi vovchik.

Yes, you are right. I don‘t have a ‚gfontsel‘. The only ‚fontsel‘ I have is a ‚xfontsel‘.
And now?

And please excuse me for the following question, but what do you exactly mean with:
You could replace gfontsel with

Code: Select all

Xdialog --fontsel "" 0 0
and the result should look the same
?

Cheers :wink:

Maik.Murks

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

Re: view installed

#15 Post by disciple »

You could replace gfontsel with

Code: Select all

Xdialog --fontsel "" 0 0
and the result should look the same :)

With kind regards,
vovchik
What is the point of gfontsel then? Why don't we use this instead?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#16 Post by vovchik »

@ Maik.Murks:

In my little script called "pfont2", which is /usr/local/bin", you can replace the line 179:

Code: Select all

<action>gfontsel &</action>
with

Code: Select all

<action>Xdialog --fontsel "" 0 0 &</action>
I took Zigbert's code, if I remember correctly, but Xdialog does the exact same thing. This should work in all Puppies, since Xdialog is present in all of them, I think. Let me know whether it works for you. If so, I will change Pfont2 to use Xdialog for the installed font display.

@ disciple:

Good question :) I think a tiny script along the lines of the above will do the trick and we can reduce Puppy by a few kilobytes (gfontsel is 6k, but a script is much smaller), and "a byte saved is a byte earned".

With kind regards,
vovchik

PS. Rod/Gatordog has written a font display prog in BaCon. It is in Programming/Bacon Bits.

User avatar
maik.murks
Posts: 327
Joined: Mon 28 Mar 2011, 06:19
Location: at home, at work or on holidays

#17 Post by maik.murks »

vovchik wrote:@ Maik.Murks:

In my little script called "pfont2", which is /usr/local/bin", you can replace the line 179:

Code: Select all

<action>gfontsel &</action>
with

Code: Select all

<action>Xdialog --fontsel "" 0 0 &</action>
I took Zigbert's code, if I remember correctly, but Xdialog does the exact same thing. This should work in all Puppies, since Xdialog is present in all of them, I think. Let me know whether it works for you. If so, I will change Pfont2 to use Xdialog for the installed font display.

Hi vovchik.

I‘ve changed line 179 in that manner you‘ve told me. And what should I say? It simply works. Well, it works like a charme :D
Thank you very much for your help and your patience with me :D

Cheers :wink:

Maik.Murks

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

good news

#18 Post by vovchik »

Dear Maik.Murks,

I am glad you managed to do the edit and that it worked. I think I will do it that way in the next release, if I don't have my own previewer written by then :) What is important is that you pointed out (i) that gfontsel was missing in some Puppies, and (ii) that gfontsel is actually unnecessary in Puppy distros if Xdialog is present. So, thanks to you!

With kind regards,
vovchik

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#19 Post by darkcity »

http://puppylinux.org/wikka/PFont2

I've added to wiki.

I too get the problem of the preview image not showing next to the description and have to use Viewnior.

I've installed the gtk-splash - but then it show the [X] image not found icon next to description.

Cheers ; -)

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#20 Post by disciple »

Are you making any progress with your previewer, vovchik? Will it be able to preview .ttf files which aren't installed? (EDIT - sorry, yes of course it will, that's the whole point of this app, and why I didn't ask this question when I first saw this thread.)
In the past I spent quite a long time searching for something lightweight to do that (the only thing for linux seems to be Opcion, written in Java :(), but I didn't quite have the expertise to write one myself.
Last edited by disciple on Sat 03 Sep 2011, 11:09, edited 1 time in total.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Post Reply