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 23 Aug 2014, 00:04
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Pfont2
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Author Message
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 20 Jun 2011, 05:37    Post subject:  Pfont2
Subject description: TTF font previewer/viewer/installer
 

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 Sad. 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.
pfont2-0.21.pet
Description 
pet

 Download 
Filename  pfont2-0.21.pet 
Filesize  32.27 KB 
Downloaded  848 Time(s) 
pfont211b.jpg
 Description   
 Filesize   23.49 KB
 Viewed   1289 Time(s)

pfont211b.jpg

pfont211a.jpg
 Description   
 Filesize   30.73 KB
 Viewed   1629 Time(s)

pfont211a.jpg

Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Tue 05 Jul 2011, 17:43    Post subject:    

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/graphicsmagick-imagemagick-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
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 06 Jul 2011, 04:11    Post subject: pfont2 bugs  

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
Back to top
View user's profile Send private message 
maik.murks


Joined: 28 Mar 2011
Posts: 331
Location: at home, at work or on holidays

PostPosted: Wed 06 Jul 2011, 07:03    Post subject:  

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 Smile
And congratulations for your Pfont2 Smile

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 Smile
And finally, I really like to have Pfont2 working on my 2.14X Smile

Cheers Wink

Maik.Murks
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 06 Jul 2011, 07:40    Post subject: preview problems  

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
gtkdialog-splash-20110319.pet
Description 
pet

 Download 
Filename  gtkdialog-splash-20110319.pet 
Filesize  3.15 KB 
Downloaded  422 Time(s) 
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Wed 06 Jul 2011, 07:50    Post subject: Re: pfont2  

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]
PFont2.png
 Description   
 Filesize   329.83 KB
 Viewed   1139 Time(s)

PFont2.png

Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Wed 06 Jul 2011, 07:58    Post subject:  

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


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Wed 06 Jul 2011, 08:29    Post subject:  

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 06 Jul 2011, 08:45    Post subject: pfont display  

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 Smile

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


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Wed 06 Jul 2011, 10:30    Post subject:  

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:

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


Joined: 28 Mar 2011
Posts: 331
Location: at home, at work or on holidays

PostPosted: Wed 06 Jul 2011, 10:54    Post subject: Re: preview problems  

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 Smile
But unfortunately after clicking the 'View installed' button still nothing happens. Do you have any idea?

Cheers Wink

Maik.Murks
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Wed 06 Jul 2011, 12:26    Post subject:  

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

which gfontsel

/usr/bin/gfontsel

Not missing on mine side
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 06 Jul 2011, 12:39    Post subject: view installed  

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:
Xdialog --fontsel "" 0 0
and the result should look the same Smile

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


Joined: 28 Mar 2011
Posts: 331
Location: at home, at work or on holidays

PostPosted: Thu 07 Jul 2011, 09:43    Post subject: Re: view installed  

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:
Xdialog --fontsel "" 0 0
and the result should look the same Smile

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:
Quote:
You could replace gfontsel with
Code:
Xdialog --fontsel "" 0 0
and the result should look the same
?

Cheers Wink

Maik.Murks
Back to top
View user's profile Send private message 
disciple

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

PostPosted: Thu 07 Jul 2011, 10:00    Post subject: Re: view installed  

Quote:
You could replace gfontsel with
Code:
Xdialog --fontsel "" 0 0
and the result should look the same Smile

With kind regards,
vovchik

What is the point of gfontsel then? Why don't we use this instead?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [23 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.1090s ][ Queries: 13 (0.0065s) ][ GZIP on ]