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 Fri 29 May 2020, 16:30
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Font Preview
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 4 [56 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
fredx181


Joined: 11 Dec 2013
Posts: 4435
Location: holland

PostPosted: Fri 22 May 2020, 11:22    Post subject:  

vovchik wrote:
Dear Fred,

Thanks for the font style fix. Works as it should now. I have posted an updated version above.

With kind regards,
vovchik


Thanks vovchik, edited first post with link to your above post.

@all Here's the gtkdialog version as I initially intended, select and preview in one window.
Attached script gfontviewer

Thanks Mochimoppel for the help, only your fstyle variable didn't work well, so changed it back. (and added grep -m 1)

Fred
gfontviewer.gz
Description  Remove fake.gz and make executable
gz

 Download 
Filename  gfontviewer.gz 
Filesize  1.99 KB 
Downloaded  24 Time(s) 
gfontviewer.jpg
 Description   Simple gtkdialog version
 Filesize   53.1 KB
 Viewed   547 Time(s)

gfontviewer.jpg


_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
rockedge


Joined: 11 Apr 2012
Posts: 1800
Location: Connecticut, United States

PostPosted: Fri 22 May 2020, 14:01    Post subject:  

Hello vovchik

The 2nd version of the font previewer is not displaying the special characters. Same font viewed using version 1 the special characters do display correctly.

This is going to be a good tool, thanks again for sharing it.

Test font is NimbusMonoPS-Regular

I have tested all of the scripts offered on the thread in WeeDog64-Arch and it's Void sibling and they all work really well on both
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1534
Location: Ukraine

PostPosted: Fri 22 May 2020, 14:28    Post subject:  

Dear Fred,

Gfontview works very nicely. Many thanks. It might be worthwhile for all our versions (gtkdialog and yad) also to show the the file size and the number of glyphs in the font (perhaps complicated because we have to deal with a number of different file types - otf, ttf, x11 bitmats etc.).Just a thought...

@ rockedge: Thanks for testing. I wonder why that is happening. I have two NimbusMonoPS-Regular fonts installed - one is a type .t1 and the other is .otf. Both show properly. Weird.

With kind regards,
vovchik
Screenshot_2020-05-23_01-15-33.png
 Description   
 Filesize   215.98 KB
 Viewed   470 Time(s)

Screenshot_2020-05-23_01-15-33.png

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2061
Location: Japan

PostPosted: Sat 23 May 2020, 08:58    Post subject:  

vovchik wrote:
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.
Very nice. Now we can see which code points are included in a particular font. That's what I always wanted to know. Thanks.

One problem with your latest script: Doesn't work correctly in older Puppies. Problem is caused by line 45:
Code:
echo "<span font='Mono Bold 13'><b> Name:    <span color='crimson'>${fname}</span></b></span>"
On my system the color 'crimson' doesn't exist. Originally not a X11 color and therefore not compiled into older versions of Xorg. If you replace it with a dummy name you can see what I see (it's a very interesting effect Wink ), if you replace it with a hex value everything is fine.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1534
Location: Ukraine

PostPosted: Sat 23 May 2020, 09:25    Post subject:  

Dear Mochi,

Thanks for testing and discovering the "crimson" anomaly. The hex for crimson is "#DC143C", so I think I should replace it with the hex code in my script. And good thing that "fallback" attribute exists in pango, which takes care of many problems that I had been having in generating font displays.

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


Joined: 11 Dec 2013
Posts: 4435
Location: holland

PostPosted: Sat 23 May 2020, 11:33    Post subject:  

vovchik wrote:
Gfontview works very nicely. Many thanks. It might be worthwhile for all our versions (gtkdialog and yad) also to show the the file size and the number of glyphs in the font (perhaps complicated because we have to deal with a number of different file types - otf, ttf, x11 bitmats etc.).Just a thought...

Doing that is above my knowledge, but feel free to put some of your magic Wink in the Gfontview script, if you like of course.

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
bpuppy


Joined: 25 Apr 2017
Posts: 12
Location: Quebec

PostPosted: Sat 23 May 2020, 15:41    Post subject: Font Preview
Subject description: Where to get it
 

@vovchik
Dear fellow from Ukraine,

I see the screenshot you posted earlier.
Where does this script or program 'Font Preview'
come from?

I prefer this layout as I too, wish to see
more than one language set.

bpuppy
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1534
Location: Ukraine

PostPosted: Sat 23 May 2020, 16:12    Post subject:  

Dear bpuppy,

It's on the previous page, near the bottom. Here is the direct link: http://murga-linux.com/puppy/viewtopic.php?mode=attach&id=128230.

I hope it will be useful.

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


Joined: 25 Apr 2017
Posts: 12
Location: Quebec

PostPosted: Sat 23 May 2020, 21:22    Post subject: Font Preview  

Thank you vovchik.
This meets my needs perfectly.

With the superb YAD package and talented programmers, who would want to leave the great Puppy familly?

bpuppy
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1534
Location: Ukraine

PostPosted: Sun 24 May 2020, 06:30    Post subject:  

Dear bpuppy,

Thanks. I modded the script a bit - fixing the display categories and adding a few missing diacriticals (Polish, Czech and Croatian). I will have to check Hunagrian and Romanian, and, perhaps, a few other languages. If you can thing of some chars I should add, let me know.

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

Joined: 04 May 2012
Posts: 1312

PostPosted: Sun 24 May 2020, 17:47    Post subject:
Subject description: update 4
 

Dear vovchik, your script is so good! Fred's gtkdialog script is good too but I'm more likely to use yad than gtkdialog these days. I changed and added a few things to the script, and gave it a slightly different name to avoid confusion. Please feel free to take whatever you think is worth adding to your script.

Changelog

20200529
* Fix view pane corruption issues with serializer.
* Add Save button to XML and PNG (with pango-view).
* Support font collection files (TTC part 2).
* Change font list sort order (numbers at the end).
* Set small font for button labels to help keep within 600px width.
* Factor YAD_OPTIONS.
* Fix for family name containing apostrophe (MM).
* Fix 'Fixed' font display size.
* Fix "'" in font file path, reported by MM.
* Fix "&" in font file path, reported my MM.

20200527
* Fold font name, style and size on one line.
* New method to compose the font name - $LANG used.
* merge charset updates from vovchik's last edit 13.
* Fix 'crimson' color from vovchick's last edit 10.

20200525
* Add over/under layout button. Powered by new options --over and --under.
* Add dialog to change options (font size) on-the-fly.
* Shorten button labels.
Code:

Usage:   [YAD_FONTVIEW_FONTSIZE=13] yad-fontview [--flip] [--left | --right | --over | --under]


20200524
Initial version by vovchik, Puppy Linux forum [1]
- Retrieved 2020-05-23 at 10:15 GMT, unlicensed.
- [1] http://murga-linux.com/puppy/viewtopic.php?t=118810
- Last edited by vovchik on 20200522 at 19:11 GMT; edited 5 times in total
Changes:
* Speed up generating the preview sheet.
* Use fc-list -f to format font info -- faster and less error-prone.
* Add button to open the font file location with rox.
* Allow same named font files. Requires yad version >= 0.41.
* Allow '&' (and other markup) in font file name.
* Shrink window size to fit smaller netbook screens.
* Add option --flip as $1 to flip the window layout.
* Add side-by-side layout button for easy comparison. Powered by new options --left and --right.
* Fix left alignment.
* Fix: exclude \x20 from the preview character set.
* Add powerline font character set (PUA).
* Escape to HTML entity using bash only (no sed).
* Add programmer's font with ligatures charset.
* Allow changing font size via environment variable YAD_FONTVIEW_FONTSIZE. Ideally changing font size should be a GUI option but...
Code:

Usage: [YAD_FONTVIEW_FONTSIZE=13] ./yad-fontview [--left | [ --flip --right ]]


vovchik wrote:
It might be worthwhile for all our versions (gtkdialog and yad) also to show the the file size and the number of glyphs in the font (perhaps complicated because we have to deal with a number of different file types - otf, ttf, x11 bitmats etc.).Just a thought...

Take a look at my changes, you'll see that funtion font_preview saves all available font information a temporary file that any bash function can source. Take example from font_preview itself and also function open_location. The key to this is the following piece of code:
Code:

fc-list -f '
fullpath=%{file|shescape}
family=%{family[0]|shescape}
fstyle=%{style[0]|shescape}
unparse=%{=unparse|shescape}
' | grep -m1 -A3 -F "fullpath='$FULLPATH'" > "$meta"
. "$meta"
fname=$family

This code extracts and formats as shell variables the font file full path, the font family name (commonly used as font name), font style, and the whole font metadata record (unparse, for debugging). Look at unparse, all formatting keys for a font are there followed by an equal sign. For each new key you will add between fullpath= and grep, increment the number after option -A.

Edit - further updates changed the way the font name is composed. See the updated script and also my gist.
yad-fontview-20200529.tar.gz
Description 
gz

 Download 
Filename  yad-fontview-20200529.tar.gz 
Filesize  5.78 KB 
Downloaded  45 Time(s) 
yad-fontview-20200524-f.png
 Description   
 Filesize   133.87 KB
 Viewed   226 Time(s)

yad-fontview-20200524-f.png


_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus

Last edited by step on Today, at 11:13; edited 3 times in total
Back to top
View user's profile Send private message 
rockedge


Joined: 11 Apr 2012
Posts: 1800
Location: Connecticut, United States

PostPosted: Sun 24 May 2020, 19:32    Post subject:  

Nice step! nice...

More than the doctor ordered, I thank you and vovchik for this really useful tool.

Outstanding work people.........take a coffee break
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2061
Location: Japan

PostPosted: Sun 24 May 2020, 23:15    Post subject:  

May I add my own bare bone yad version? Different layout, only 2 lines of code.
I like to see all font samples at once so I can compare them more easily. Makes it easier for me to determine, which fonts support a certain unicode block.

Some features:
- User can set sample string and font size from command line
Syntax: scriptname [sample string [font size]]

Without arguments script will display sample string "AÄ€☃✄ɐʱΣБԔԹ" which contains characters from different unicode blocks:
‎A U+0041 Basic Latin
‎Ä U+00C4 Latin-1 Supplement
‎€ U+20AC Currency Symbols
‎☃ U+2603 Miscellaneous Symbols
‎✄ U+2704 Dingbats
‎ɐ U+0250 IPA Extensions
‎ʱ U+02B1 Spacing Modifier Letters
‎Σ U+03A3 Greek and Coptic
‎Б U+0411 Cyrillic
‎Ԕ U+0514 Cyrillic Supplement
‎Թ U+0539 Armenian

- Characters '&><' in file names supported
- Window resizeable

And what do we learn here? Japanese Meiryo font builds the best snowman !

Code:
#!/bin/sh
[[ $1 ]] && sample=$1 size=${2:-28} || sample="AÄ€☃✄ɐʱΣБԔԹ" size=28
fc-list -f "<span fallback='false' font='%{family[0]} %{style[0]} $size'>$sample</span>%{family[0]} %{style[0]}  (%{file|basename|xmlescape})\n"|sort|uniq|sed 's|</span>|&\n|'|yad --list --title=mm_fontview --column="Sampletext  (font size $size)" --column=Font --width=600 --height=600
mm_fontview.png
 Description   
 Filesize   51.02 KB
 Viewed   190 Time(s)

mm_fontview.png

Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1312

PostPosted: Mon 25 May 2020, 05:52    Post subject:  

Nice MochiMoppel, I will use your concept, thank you.

Update 2 of my spin is here.

_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1534
Location: Ukraine

PostPosted: Mon 25 May 2020, 07:50    Post subject:  

Dear step,

Nice job. I like that scaling button - it is useful. I modded some of the character categories in my latest, adding a few missing cyrillic glyphs. I think we are getting somewhere. Smile Thanks.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 4 [56 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0723s ][ Queries: 13 (0.0112s) ][ GZIP on ]