The time now is Thu 28 Jan 2021, 08:19
All times are UTC - 4 |
Page 1 of 6 [79 Posts] |
Goto page: 1, 2, 3, 4, 5, 6 Next |
Author |
Message |
fredx181

Joined: 11 Dec 2013 Posts: 4481 Location: holland
|
Posted: Thu 21 May 2020, 03:30 Post subject:
Font Preview |
|
Update 2020-05-25(and updated later on) Forum member step made a yad version too based on vovchik's, see:
http://murga-linux.com/puppy/viewtopic.php?p=1058847#1058847
And MochiMoppel made his own version:
http://murga-linux.com/puppy/viewtopic.php?p=1059251#1059251
Update 2020-05-22(and updated later on by vochik) Misko (initially) and vovchik made a special yad version, see here (and pic below):
http://murga-linux.com/puppy/viewtopic.php?p=1058652#1058652
And gtkdialog fontviewer improved (select and preview in one window, as my question below was about, thanks Mochimoppel)
http://murga-linux.com/puppy/viewtopic.php?p=1058669#1058669
=================================================================
Here are two gtkdialog scripts attached to preview fonts.
- fontviewer: select from list of available fonts to preview. (see pic below)
- fontview, can be used with a font file (e.g. ttf or .pfb) as argument, e.g (if fontview is in PATH):
Code: | fontview /usr/share/fonts/truetype/dejavu/DejaVuSerifCondensed-Italic.ttf |
Or set fontview as default "open with" for .ttf and/or .pfb and you can just click in filemanager to preview a font.
The concept code from Here was a great help, so thanks SFR !
Question, as it is now, fontviewer opens a new window when selecting a font.
I've tried to make it as one window, e.g. top part for selecting and bottom part for the preview, but no luck.
Anyone knows how ? (or maybe it isn't possible).
Fred
Description |
yad fontviewer by vovchik |
Filesize |
84.01 KB |
Viewed |
289 Time(s) |

|
Description |
Fontviewer |
Filesize |
78.21 KB |
Viewed |
643 Time(s) |

|
Description |
Remove fake .gz and make executable
|

Download |
Filename |
fontviewer.gz |
Filesize |
2.83 KB |
Downloaded |
195 Time(s) |
Description |
Remove fake .gz and make executable
|

Download |
Filename |
fontview.gz |
Filesize |
2.49 KB |
Downloaded |
193 Time(s) |
_________________ Dog Linux website
Tinylinux blog by wiak
Last edited by fredx181 on Wed 03 Jun 2020, 04:10; edited 17 times in total
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 2084 Location: Japan
|
Posted: Thu 21 May 2020, 09:09 Post subject:
Re: Font Preview |
|
fredx181 wrote: | Question, as it is now, fontviewer opens a new window when selecting a font.
I've tried to make it as one window, e.g. top part for selecting and bottom part for the preview, but no luck.
Anyone knows how ? (or maybe it isn't possible). |
Maybe something like this:
Code: | #!/bin/bash
fclist () {
# echo "$(fc-list | awk -F':' '{print $1}' | sort | uniq)"
echo "$(fc-list | awk -F'/' 'split($NF,a,":") {print a[1]}'| sort | uniq)"
};export -f fclist
function demo {
fname=$(fc-list | grep "$1" | awk -F[:=,] '{print $2}')
fstyle=$(fc-list | grep "$1" | awk -F[:=,] '{print $4}')
echo -e "<span font=\"$fname $fstyle 12 \">$fname $fstyle</span>
<span font=\"$fname $fstyle 12 \">12 The quick brown fox jumps over the lazy dog.</span>
<span font=\"$fname $fstyle 18 \">18 The quick brown fox jumps over the lazy dog.</span>"
};export -f demo
echo '
<window title="Font Viewer" icon-name="gtk-font">
<vbox>
<hbox height-request="450" width-request="690">
<frame Available fonts, select to preview >
<tree headers-visible="false" selected-row="0">
<variable>TREE_INCLUDED_ITEMS</variable>
<input>fclist</input>
<action signal="button-release-event">refresh:SAMPLETEXT</action>
<action signal="key-release-event">refresh:SAMPLETEXT</action>
</tree>
</frame>
</hbox>
<text xalign="0" visible="false" use-markup="true" wrap="false"><variable>SAMPLETEXT</variable>
<input>demo "$TREE_INCLUDED_ITEMS"</input>
</text>
</vbox>
<action signal="show">refresh:SAMPLETEXT</action>
<action signal="map-event">show:SAMPLETEXT</action>
</window>
' | gtkdialog -s |
BTW: Your function fclist produces duplicates when font folders are symlinked. Your uniq command has no effect since full paths are always unique, only basenames may appear more than once. .
[Edit] Changed the awk statement in the fclist function. The list now displays only unique font files (basenames only)
Last edited by MochiMoppel on Thu 21 May 2020, 11:53; edited 1 time in total
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Thu 21 May 2020, 10:22 Post subject:
|
|
Dear Fred and Mochi,
I often have to look up whether a font has the characters that I need (i.e. cyrillic, accented latin, symbol). Here is a little variant that would show that.
WIth kind regards,
vovchik
Code: | #!/bin/bash
fclist () {
# echo "$(fc-list | awk -F':' '{print $1}' | sort | uniq)"
echo "$(fc-list | awk -F'/' 'split($NF,a,":") {print a[1]}'| sort | uniq)"
};export -f fclist
function demo {
fname=$(fc-list | grep "$1" | awk -F':' '{print $2}' | cut -d ',' -f 1 | sort | uniq)
fstyle=$(fc-list | grep "$1" | awk -F':' '{print $3}' | cut -d ',' -f 1 | sed 's/style=//')
echo -e "<span color='blue'>Font name: $fname $fstyle</span>
<span font=\"$fname $fstyle 22 \">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
<span font=\"$fname $fstyle 22 \">abcdefghijklmnopqrstuvwxyz</span>
<span font=\"$fname $fstyle 22 \">0123456789 -_=+;?,.[]{}</span>
<span font=\"$fname $fstyle 22 \">ФІВА ЇҐЄЗ ЫЪЭЁ ÜÖÄß</span>
<span font=\"$fname $fstyle 22 \">фіва їґєз ыъэё üöäß</span>
<span font=\"$fname $fstyle 22 \">áÁàÀâÂåÅäÄãêæÆçÇðÐ</span>
<span font=\"$fname $fstyle 22 \">éÉèÈêÊëËğĞíÍìÌîÎïÏıİ</span>
<span font=\"$fname $fstyle 22 \">ñÑóÓòÒôÔöÖõÕœŒšŠşŞ</span>
<span font=\"$fname $fstyle 22 \">þÞúÚùÙûÛüÜýÝÿŸžŽ</span>
<span font=\"$fname $fstyle 22 \">すべての意味は翻訳で失われる</span>
<span font=\"$fname $fstyle 22 \">←→↑↓↔↕↨↗↘↳↵⇐⇒⇔⇤⇥</span>"
};export -f demo
echo '
<window title="Font Viewer" icon-name="gtk-font" border="8">
<vbox>
<hbox height-request="450" width-request="690">
<frame Available fonts, select to preview >
<tree headers-visible="false" selected-row="0" rules-hint="true">
<variable>TREE_INCLUDED_ITEMS</variable>
<input>fclist</input>
<action signal="button-release-event">refresh:SAMPLETEXT</action>
<action signal="key-release-event">refresh:SAMPLETEXT</action>
</tree>
</frame>
</hbox>
<frame Font preview below>
<text xalign="0" visible="false" use-markup="true" wrap="false"><variable>SAMPLETEXT</variable>
<input>demo "$TREE_INCLUDED_ITEMS"</input>
</text>
</frame>
</vbox>
<action signal="show">refresh:SAMPLETEXT</action>
<action signal="map-event">show:SAMPLETEXT</action>
</window>
' | gtkdialog --center -s
|
UPDATED: Added zebra stripes to the treeview.
Last edited by vovchik on Thu 21 May 2020, 15:03; edited 4 times in total
|
Back to top
|
|
 |
rockedge

Joined: 11 Apr 2012 Posts: 1874 Location: Connecticut, United States
|
Posted: Thu 21 May 2020, 10:24 Post subject:
|
|
@fredx181 Fantastic! Works great, thanks for the quick work throwing this together...I am using it on a Weedog64-Arch-rc2 as I set up the desktop and experiment.
Tried it out on a Bionic64-v8 which is my main working dog and same results..works very well.
Description |
|
Filesize |
177.97 KB |
Viewed |
565 Time(s) |

|
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 2084 Location: Japan
|
Posted: Thu 21 May 2020, 11:58 Post subject:
|
|
I edited the fclist function. This should fix the issue of duplicate font files in the main list.
vovchik wrote: | I often have to look up whether a font has the characters that I need (i.e. cyrillic, accented latin, symbol). Here is a little variant that would show that. | Dear vovchik, I'm afraid that this will not answer your question. What you see is the result of font substitution that occurs when the selected font does not support the characters you mentioned. With your variant all selected fonts display your Japanese sample text correctly (means readable) though only 2 of my fonts support the Japanese character set.
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Thu 21 May 2020, 13:28 Post subject:
|
|
Dear Mochi,
Thanks for the reply. I am aware of the fact that I am seeing the code points for unicodes missing from the selected font being mapped to the default gtk charset, which is fine for my my purposes. If the chars are missing, they display in the standard font, and, usually, that is sufficiently different in style from the selected one to indicate, at least to me, that those code points are missing. I have quite a few ornamental or special purpose fonts installed, and some have cyrillic but not accented European, or vice vesa. And I can see that clearly from the display.
With kind regards,
vovchik
|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 114
|
Posted: Thu 21 May 2020, 15:18 Post subject:
|
|
fredx some fonts are displayed incorrectly.
"1942 report" nad "Signerica Medium"
Most are correct but some default to system font.
I've tried to make a yad version most work but Signerica Medium and some other don't.
Font Manager application displays all correctly so I'm using that for testing.
Code: | #!/bin/bash
function font_preview()
{
echo -e "\f"
local FONT=$*
FONT="${FONT##*'/'}"
fname="$(fc-list | grep -m 1 "${FONT}" | awk -F[:=,] '{print $2}')"
fname="${fname/\\/}"
fstyle="$(fc-list | grep -m 1 "${fname}" | awk -Fstyle= '{print $2}' | awk -F, '{print $1}')"
echo "${fname}" | sed "s/\&/\&/g"
echo "${fstyle}" | sed "s/\&/\&/g"
echo "<span font=\"${fname} ${fstyle}\" size=\"large\">abcdefghijklmnopqrstuvwxyz </span>
<span font=\"${fname} ${fstyle}\" size=\"large\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
<span font=\"${fname} ${fstyle}\" size=\"large\">0123456789.:,;(*!?}^)#{%&-+@</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">11 </span><span font=\"${fname} ${fstyle} 11\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">14 </span><span font=\"${fname} ${fstyle} 14\" size=\"large\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">20 </span><span font=\"${fname} ${fstyle} 20\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">28 </span><span font=\"${fname} ${fstyle} 28\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">36 </span><span font=\"${fname} ${fstyle} 36\" size=\"large\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">48 </span><span font=\"${fname} ${fstyle} 48\" size=\"large\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
echo "<span size=\"x-large\">60 </span><span font=\"${fname} ${fstyle} 60\" size=\"large\">The quick brown fox jumps over the lazy dog.</span>" | sed "s/\&/\&/g"
}
export -f font_preview
yadkey="$((${RANDOM} * $$))"
yad --paned --key="${yadkey}" \
--title="Font Preview" --width=800 --height=700 --orient=hor --splitter=400 &
echo "$(fc-list | awk -F':' '{print $1}' | sort | uniq | tail -n +2 )" | sed "s/\&/\&/g" \
| yad --list --plug=${yadkey} --tabnum=1 --column="Fonts" --search-column=1 \
--select-action='bash -c "font_preview %s"' | yad --plug=${yadkey} --tabnum=2 --list \
--column=Preview --no-selection |
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Thu 21 May 2020, 19:15 Post subject:
|
|
Dear Misko,
Thanks. Also very useful. I have attached a modded yad version that does what I need most, like the gtkdialog version I posted above.
WIth kind regards,
vovchik
Description |
|

Download |
Filename |
yfontview.tar.gz |
Filesize |
1.36 KB |
Downloaded |
196 Time(s) |
|
Back to top
|
|
 |
rockedge

Joined: 11 Apr 2012 Posts: 1874 Location: Connecticut, United States
|
Posted: Thu 21 May 2020, 20:30 Post subject:
|
|
Hello vovchik
nice script. I am trying it out on several different Puppy's and on a WeeDog64-Arch. Works well on all of them.
|
Back to top
|
|
 |
fredx181

Joined: 11 Dec 2013 Posts: 4481 Location: holland
|
Posted: Fri 22 May 2020, 03:49 Post subject:
|
|
Thanks all for the replies, even a yad version, thanks misko.
Got some more to play with now !
Fred
_________________ Dog Linux website
Tinylinux blog by wiak
|
Back to top
|
|
 |
fredx181

Joined: 11 Dec 2013 Posts: 4481 Location: holland
|
Posted: Fri 22 May 2020, 04:44 Post subject:
|
|
Quickly tried the yad version from misko and vovchik and somehow many fonts are not displaying correctly, for example DejaVuSansCondensed-BoldOblique.ttf, see pic, it shows style "Book" where it should be "Condensed Bold Oblique"
(didn't look at the code yet, so no idea why)
Fred
Description |
|
Filesize |
76.5 KB |
Viewed |
439 Time(s) |

|
_________________ Dog Linux website
Tinylinux blog by wiak
|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 114
|
Posted: Fri 22 May 2020, 04:55 Post subject:
|
|
fredx181 wrote: | Thanks all for the replies, even a yad version, thanks misko.
Got some more to play with now !
Fred |
Fun stuff. There is also a font selection dialog with the small preview pane yad --font.
Vovčik, thank you, I like your script more.
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Fri 22 May 2020, 06:23 Post subject:
|
|
Dear Fred and Misko,
Thanks. I discovered the "fallback" attribute in pango markup, so we now get squares with hex values for code points that are missing - a great improvement I think - in terms of determining whether a particular font suits our purposes. Here is a revised script.
With kind regards,
vovchik
PS. I also improved the sample chars (more complete cyrillic and added a few dingbat chars).
UPDATED: It now displays the char group names, for a bit more clarity.
UPDATED: Fixed an ampersand problem in the numbers and punctuation line.
UPDATED: Incorporated Fred's fix for font style display. Thanks!
UPDATED: Increased character spacing in display.
UPDATED: Added simple logo.
UPDATED: Added a bit of eyecandy and adjustment.
UPDATED: Changed "crimson" to "#DC143C" since crimson (named color) is missing in some Puppies. Thanks Mochi.
UPDATED: Added some missing Polish, Czech and Croatian diacriticals. Modded the categories for better display.
UPDATED: Finally added Belarusian Ў to cyrillic set and pre-Revolutionary Ѣ.
UPDATED: Added unicode Serbian "Ј". Thanks Misko.
UPDATED: Added Polish "Ł" and "ł" to the diacritical tables. Thanks SFR.
 |
Description |
|

Download |
Filename |
yfontview.tar.gz |
Filesize |
2.16 KB |
Downloaded |
192 Time(s) |
Last edited by vovchik on Mon 25 May 2020, 19:30; edited 13 times in total
|
Back to top
|
|
 |
fredx181

Joined: 11 Dec 2013 Posts: 4481 Location: holland
|
Posted: Fri 22 May 2020, 10:02 Post subject:
|
|
Hello misko and vovchik,
FYI, changing fstyle line in yfontview to:
Code: | fstyle="$(fc-list | grep -m 1 "${FONT}" | awk -F':' '{print $3}' | cut -d ',' -f 1 | sed 's/style=//')" |
fixes for me the wrong style display, e.g for DejaVu ExtraLight and others
Great work, btw, thanks vovchik !
Fred
Description |
|
Filesize |
89.62 KB |
Viewed |
380 Time(s) |

|
_________________ Dog Linux website
Tinylinux blog by wiak
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Fri 22 May 2020, 10:44 Post subject:
|
|
Dear Fred,
Thanks for the font style fix. Works as it should now. I have posted an updated version above. I also added a simple logo in the latest update.
With kind regards,
vovchik
Last edited by vovchik on Fri 22 May 2020, 13:17; edited 1 time in total
|
Back to top
|
|
 |
|
Page 1 of 6 [79 Posts] |
Goto page: 1, 2, 3, 4, 5, 6 Next |
|
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
|