dzen2 - use of fonts

For talk and support relating specifically to Puppy derivatives
Post Reply
Message
Author
User avatar
linuph
Posts: 128
Joined: Mon 04 Jun 2012, 02:29
Location: Philippines

dzen2 - use of fonts

#1 Post by linuph »

Using Dpup Exprimo 5.X.3.4.12

dzen is a configurable, flexible utility to show text on screen or even menu's.

I can't choose other fonts than 'fixed' in dzen2, though fc-list and xfontsel show fonts like courier, dejavu sans, nimbus etc.

I have not been able to find a solution. There's Archlinux info, but that doesn't suit Puppy. Does someone know how to select other fonts?

For example:

#echo "Hello World" | dzen2 -fn "DejaVu Sans" -p' gives an error: cannot load font 'DejaVu Sans'. With 'fixed' font it works.

Programmatically, a line could look as follows:

awk ..... { print x | "dzen2 | -fn '-*-fixed-bold-r-*-*-24-*-*-*-*-*-*-*' -fg white -bg black -h 30 -ta l -x 0 -y 574 -w 800" }

That works with the fixed font, but not with others. By the way, the (terrible) -*-*-*-* thing is produced by xfontsel but unforunately I cannot select/copy from xfontsel, but that's another matter.

I suspect dzen looks for fonts in a Puppy place that's not the same as in Archlinux but I don't know for sure....

Attached pets of dzen2 (standard package) and dzen2g (dzen gadgets).

Any help appreciated....

PS I wanted to upload dzen2 pets but it's too slow right now. I'll try again later.

User avatar
linuph
Posts: 128
Joined: Mon 04 Jun 2012, 02:29
Location: Philippines

#2 Post by linuph »

I found a solution to use 'DejaVu Sans' in stead of 'fixed' font. Well, sort of. It's a coincidence on the one hand and a classic 'escape' issue with awk on the other. This program line now works:

#awk .....{ print x | "dzen2 -fn \"-*-DejaVu Sans-*-r-*-*-22-*-*-*-*-*-*\" -bg black -fg white -h 30 -ta l -x 600 -y 450 -w 200"}

Note the the \"....\".

Fine, I'm happy with this but I have no explanation why other fonts (except 'fixed') don't work though reported by xfontsel....

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#3 Post by SFR »

Hey Linuph

Nice find, thanks!

BTW, I compiled it myself from the source (simple 'make') and have no problems using other fonts in Slacko-5.4.

Greetings!
Attachments
dzen2.png
(14.54 KiB) Downloaded 1268 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#4 Post by Keef »

Have you tried using a script?

Code: Select all

#!/bin/sh

FG='#ffffff'
BG='#003aff'
FONT='-adobe-helvetica-*-*-*-*-24-*-*-*-*-*-*-*'
while true ; do
    dt=`date +"%a %b %d %l:%M %p "`
    printf "%s\n" "$dt"
    sleep 20
done | dzen2 -e '' -x '800' -h '24' -w '880' -ta r -fn $FONT -fg $FG -bg $BG 
Can't remember where I got this - probably the ArchWiki...
Puts the date and time at the top right.
Attachments
dzen2.png
(185.37 KiB) Downloaded 1232 times

User avatar
linuph
Posts: 128
Joined: Mon 04 Jun 2012, 02:29
Location: Philippines

#5 Post by linuph »

@SFR
Yes, compiles without problems.

@Keef
I do use a script. Since I call dzen2 from within an awk command, variable substitution is not as straightforward.

Thanks!

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#6 Post by greengeek »

Sorry, I failed to even understand the git site. Does anyone already have a .pet suitable for Slacko 5.6 please? If not - a suggestion as to how I should interpret/use the following site would be great...
https://github.com/robm/dzen

cheers!

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#7 Post by Geoffrey »

greengeek wrote:Sorry, I failed to even understand the git site. Does anyone already have a .pet suitable for Slacko 5.6 please? If not - a suggestion as to how I should interpret/use the following site would be great...
https://github.com/robm/dzen

cheers!
Just download the ZIP from the git page, it's located lower right-hand side, extract it somewhere open a terminal in the source directory and type make, a binary will be created
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

Many thanks Geoffrey - I couldn't see the wood for the trees :-)
Got it ok now. cheers

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#9 Post by rcrsn51 »

I got fonts working by using an argument like

Code: Select all

-fn "Sans:size=20"

Post Reply