(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 21 Jan 2021, 05:23
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Font Preview
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 4 of 6 [79 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
misko_2083


Joined: 08 Nov 2016
Posts: 114

PostPosted: Wed 27 May 2020, 13:33    Post subject:  

MochiMoppel wrote:

Quote:
For some reason, at some point in the list, the right column goes to the left and vice versa.
Weird, but cause should be easy to detect. Could you please send me the output of the uniq command (output to text file instead of piping to sed)?

Sure, the command is:
Code:
fc-list -f "<span fallback='false' font='%{family[0]} %{style[0]} $size'>$sample</span>%{family[0]} %{style[0]}  (%{file|basename|xmlescape})\n"|sort|uniq > tempfonts

And this is a small part of it:
For some rason the file begins with
Code:
 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Century Catalogue Roman
  (Century-Catalogue.ttf)
<span fallback='false' font='1942 report 1942 report 28'>AÄ€☃✄ɐʱΣБԔԹ</span>1942 report 1942 report  (1942.ttf)
<span fallback='false' font='aakar medium 28'>AÄ€☃✄ɐʱΣБԔԹ</span>aakar medium  (aakar-medium.ttf)
<span fallback='false' font='Abandoned Bitplane Regular 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Abandoned Bitplane Regular  (abandone.ttf)
<span fallback='false' font='Abberancy Regular 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Abberancy Regular  (abberanc.ttf)
<span fallback='false' font='Abecedario Bold 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Abecedario Bold  (AbecedarioNegrita.ttf)

Later where the glitch is
Code:
<span fallback='false' font='Caslon Black 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Caslon Black  (Caslon-Black.ttf)
<span fallback='false' font='Caslon Bold 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Caslon Bold  (CaslonBold.ttf)
<span fallback='false' font='Caslon Italic 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Caslon Italic  (CaslonItalic.ttf)
<span fallback='false' font='Caslon Roman 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Caslon Roman  (CaslonRoman.ttf)
<span fallback='false' font='Century Catalogue Roman
<span fallback='false' font='Century Schoolbook L Bold 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Century Schoolbook L Bold  (c059016l.pfb)
<span fallback='false' font='Century Schoolbook L Bold Italic 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Century Schoolbook L Bold Italic  (c059036l.pfb)
<span fallback='false' font='Century Schoolbook L Italic 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Century Schoolbook L Italic  (c059033l.pfb)
<span fallback='false' font='Century Schoolbook L Roman 28'>AÄ€☃✄ɐʱΣБԔԹ</span>Century Schoolbook L Roman  (c059013l.pfb)
Peek 2020-05-27 19-20.gif
Description 
gif

 Download 
Filename  Peek 2020-05-27 19-20.gif 
Filesize  76.12 KB 
Downloaded  164 Time(s) 
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Wed 27 May 2020, 13:38    Post subject:  

vovchik wrote:

...I wonder whether you can restore fstyle in the header. It is, I think, useful, and easy to reintroduce.

It is there already but not on a separate line anymore. The font style is the blue section of the single-line heading, name + style + size. Or do you mean that you want name and style on separate lines (with "Font:" and "Style:" labels) as it was before?

Edit: The picture attached to MochiMoppel's last post shows that the style section isn't displayed. So I supposed the same happens to you. That's why you asked for fstyle to be added back.
MochiMoppel also reports failures displaying his fonts. Can we all state which versions of the following packages are installed on your systems? Mine are for Fatdog64-810.
freetype2-2.9.1-x86_64-1
gtk2-2.24.32-x86_64-1
pango-1.42.4-x86_64-1
yad_gtk2-0.42.14-x86_64-1


Thank you
yad-fontview-20200527.png
 Description   
 Filesize   18.39 KB
 Viewed   508 Time(s)

yad-fontview-20200527.png


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

Joined: 04 May 2012
Posts: 1352

PostPosted: Wed 27 May 2020, 14:04    Post subject:  

MochiMoppel wrote:
Short test:
1) Styles are missing. E.g. all different DejaVu Sans fonts display the same font
That's easily explained. As Vovchik's noted, fstyle is missing from the heading. But also from the HTML tags that tell pango which font style to display. Hence the default font style is shown.

The question stands why can the fc-list version installed in my system extract font tags more reliably than the fc-list in your system and vovchik's?
Quote:

2) 2 of my fonts don't display at all. Happened with my script too and I had to fix it. One font contains an ampersand in family name, the other an apostrophe.
I will test font names containing "&" and "'". They should work.
Quote:

3) My biggest concern: None of the presented scripts, including mine, can reliably display the glyphs of a font. Pango itself doesn't claim that it can and despite the fallback=false option it too often fails to show a font correctly even if it supports the characters it is supposed to show. See example in screenshot. All glyphs are "borrowed" from DejaVu Sans although the ASCII characters should display in Alpha Thin and the rest as hex boxes.

Would you please be able to upload that font file somewhere? I want to see how it displays in my system.
Quote:

The GTK font button does a better job and I wonder if it is worthwhile to pursue the pango road if the results cannot be trusted.
It's a valid concern. I don't understand the issues well enough to take a position, yet.
_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1538
Location: Ukraine

PostPosted: Wed 27 May 2020, 16:51    Post subject:  

Dear step (and all),

TTF files with an internal attribute set to "no preview" will not display in preview mode. I posted a link above to ttfpatch, which fixes that "feature" for good.

The syntax is:

Code:
ttfpach ttfont.ttf 12


to permit preview and embedding (e.g. in pdf files).

That attribute might be the source of various display problems.

UPDATED: I added 32-bit and 64-bit binaries.

With kind regards,
vovchik
ttfpatch_64_and_32_bit.tar.gz
Description 
gz

 Download 
Filename  ttfpatch_64_and_32_bit.tar.gz 
Filesize  11.63 KB 
Downloaded  155 Time(s) 
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Wed 27 May 2020, 22:42    Post subject:  

misko_2083 wrote:
For some rason the file begins with
As you can see it begins with the part that is missing from the glitch line. The only way to explain it is that your Century Catalogue Roman font contains a linefeed character in the style name. The following alphabetical sort then puts 28'>AÄ€☃✄ɐʱΣБԔ at the top of the output file and messes up the columns which yad reads line by line. If you post or send me the font I'll try to change the code so that such linefeeds are removed. [EDIT]Don't bother. I've downloaded the font and see the problem.

step wrote:
Would you please be able to upload that font file somewhere?
I sent you some files by PM.

To complete the picture I also tested with the 2 font viewers that are already installed in most Puppies: pfontview and sfontview
Both are the work of Thunor and only sfontview shows all fonts correctly.

@vovchik Applying patch didn't fix display problems.

.

Last edited by MochiMoppel on Fri 29 May 2020, 05:03; edited 1 time in total
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Thu 28 May 2020, 18:16    Post subject:  

I think I found solutions for all corrupted output I was seeing. I don't have time to write a full post now, but I will tomorrow. Hopefully, the next update will work with all of your font collections. We'll see.
_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Fri 29 May 2020, 06:28    Post subject:  

@misko: Indeed fc-query shows a newline character in the oddly named "Roman" style of the Century Catalogue font Shocked
Code:
Pattern has 20 elts (size 32)
   family: "Century Catalogue"(s)
   familylang: "en"(s)
   style: "Roman
"(s)
   stylelang: "en"(s)
   fullname: "Century Catalogue"(s)
   fullnamelang: "en"(s)


I updated my script and it now
- removes any newline characters from family and style names
- allows apostrophes and ampersands in family and style names
- transcodes any Pango special characters present in the sample string into HTML entities
Edit:
- displays all fonts correctly (none will revert to Sans, even when name is ambiguous like Alpha Thin in screenshot)

Code:
#!/bin/sh
[[ $1 ]] && sample=$1 size=${2:-28} || sample="AÄ€☃✄ɐʱΣБԔԹ" size=24
sample=${sample//&/&amp;};sample=${sample//</&lt;};sample=${sample//>/&gt;};sample=${sample//\\/&#\92;};sample=${sample//%/&#\37;}
pFAMLY='%{family[0]|xmlescape|delete(\n)}'
pSTYLE='%{style[0]|xmlescape|delete(\n)}'
pFILE='%{file|basename|xmlescape}'
fc-list -f "<span fallback=\"false\" font=\"$pFAMLY, $pSTYLE $size\">$sample</span>$pFAMLY $pSTYLE ($pFILE)\n"|sort|uniq|sed 's|</span>|&\n|'| yad --list --title=mm_fontview --column="Sampletext  (font size $size)" --column=Font --width=600 --height=600
I added backslashes before 92 and 37 in line 2 to fool the forum SW which would otherwise convert the HTML entities back into '\' and '%' .
mm_fontview.png
 Description   
 Filesize   46.91 KB
 Viewed   321 Time(s)

mm_fontview.png


Last edited by MochiMoppel on Sat 06 Jun 2020, 07:36; edited 2 times in total
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Fri 29 May 2020, 11:26    Post subject:  

I think I cracked the main issue that causes corrupted output. If I'm correct, it's a programming issue in my script. I haven't had time to look if vovchik's and MochiMoppel's script are also affected.

Basically this kind of (simplified) yad programming pattern is prone to corrupting data and should be used with great care:
Code:

yad --list ... --select-action="bash -c some_output_function" | yad --list ...


The reason is that keeping the arrow key down in the first yad will spawn lots of some_output_functions as fast as it can. Each function is an independent process subject to the kernel's scheduler. There is no guarantee that the output of all those functions will be serialized into the output pipe. That's the reason we are seeing all those corrupted data into the viewer pane.

To longer each process takes to run, and the more I/O it does, the more likely it is that its output will mix with the output of its kin processes. To fix this issue I changed --select-action to something very minimalistic and swift. Then I added a buffer process between the two yad --list commands:
Code:

yad --list ... --select-action="echo -E one_line_of_info" | serializer | yad --list

buffer:   while read line; do process_line_to_output; done

The buffer resynchronizes all the heavy formatting that was running asynchronously in the first pattern.
I didn't want to delete --select-action altogether because from a user experience standpoint --select-action provides an optimal experience for this script, I think. It should be noted that this implementation mitigates the problem -- to the point that it just doesn't happen on modern hardware -- but on very slow hardware it could still happen.

@MochiMoppel, my fourth update can display three out of the four fonts you sent me. 'Alpha Thin' is the outlier. It falls back to DejaVu sans on my system too.

@vovchik, thanks for posting the tools to fix bad font files. I didn't need to use them but they will go into my toolbox for sure!

Cheers!

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

Joined: 04 May 2012
Posts: 1352

PostPosted: Fri 29 May 2020, 11:27    Post subject:
Subject description: update 20200529
 

My fourth update is here.
_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1538
Location: Ukraine

PostPosted: Fri 29 May 2020, 12:08    Post subject:  

Dear step,

Great job. It's working nicely for me. I may reinstate that old logo (just for optics) and center the window, but that is about it. Smile

Thanks.

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


Joined: 11 Dec 2013
Posts: 4481
Location: holland

PostPosted: Fri 29 May 2020, 15:25    Post subject:
Subject description: update 20200529
 

step wrote:
My fourth update is here.


Thanks step, great work!

Fred

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


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Fri 29 May 2020, 21:15    Post subject:  

step wrote:
@MochiMoppel, my fourth update can display three out of the four fonts you sent me. 'Alpha Thin' is the outlier. It falls back to DejaVu sans on my system too.
Comic Book displays correctly on your system? Still shows DejaVu sans here, and so do about 20 other fonts out of 450. I find this failure rate too high and have no idea how this can be fixed.

The syntax $'\ue0a0' used for the PUA 1 category does not work with bash 4.1 or older. The bytestring syntax \xee\x82\xa0 would work but I guess the easiest way would be to insert the characters directly into the script the same way you do with all other characters, even if your editor most likely will show them as hex boxes.

Funny things happen with "Century Catalogue". When clicking on the file name the Preview pane goes blank and stays blank even when clicking a different file. Only a restart helps.

..

Last edited by MochiMoppel on Sat 30 May 2020, 02:34; edited 2 times in total
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Sat 30 May 2020, 02:28    Post subject:  

@vovchik, @fredx181, thank you!
@MochiMoppel, thank for reporting. You're correct the Comic Book font file you sent me still falls back to DejaVu Book on my system. I looked at too many font samples yesterday and must have tired out. Regarding Century Catalogue, I went looking for it on the Internet but couldn't find a version that fails. Would you please PM me the file? Regarding PUA 1, I will insert the characters directly for the benefit of older bash versions.

I'm going to wait a few more days to collect more issues like these before posting a fifth, hopefully final, update. Thanks everyone.

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


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sat 30 May 2020, 02:46    Post subject:  

step wrote:
Regarding Century Catalogue, I went looking for it on the Internet but couldn't find a version that fails.
I got mine here (click on HelloFont for Windows)
I also tried a different pack of Comic Book fonts, this time in OTF format, and they also fail.
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Mon 01 Jun 2020, 13:49    Post subject:
Subject description: update 5 20200601
 

Fifth update here. It incorporates MochiMoppel's script (thanks MochiMoppel) with some additions. This is my last planned update for this script. Thanks everyone for the fun!
_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 6 [79 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. 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.4851s ][ Queries: 13 (0.3424s) ][ GZIP on ]