Re: fallback fonts? remote display - xlib

2020-06-25 Thread Riccardo Mottola

Hi all!

all is well what ends well after debugging, I convinced myself of an 
error in Base.. made some test cases and proved it.


Richard fixed it and now the Xlib backend font_cacher works again smooth 
as it should!


Riccardo

Riccardo Mottola wrote:

Hi All!

Riccardo Mottola wrote:
Have a look into the font cache file to see which fonts are detected. 
maybe you should delete that file and have it recreated.
As you know the xlib backend is no longer supported especially not 
the XGFont class. You should check, why no better font support is found.


after a long evening of hacking, I print out the results so we can 
keep track of them.


font_cacher already generates a cache were several font names and font 
families are wrong! e.g. "Helvetica" is written as "HelveticA".


The issues are between XGFontPropString, which gets it and makes it 
lowercase and XGFontFamily, which capitalizes it.


Debugging with thousands of fonts is hard, so I put some code to debug 
"Helvetica" and this is what I found out:


    NSLog(@"|%s! |%@|", value, ret);
    NSLog(@"capitalized: %@", [ret capitalizedString]);

2020-06-17 22:40:32.606 font_cacher[16321:100855] |Helvetica! |helvetica|
2020-06-17 22:40:32.608 font_cacher[16321:100855] capitalized: HelveticA

Here, the C string looks sane, the lowercase string too, but the 
capitalized string is totally bogus!


if I cycle and print out the bytes of the C string they look fine:

H 48
e 65
l 6c
v 76
e 65
t 74
i 69
c 63
a 61


A bug! but where? in NSString? a short test case:

  s = [[NSString stringWithCString:"Helvetica"] lowercaseString];
  NSLog(@"%@ - %@", s, [s capitalizedString]);


which I suppose should be equivalent... works perfectly.

I'm a bit clueless now.



I admit I did not expect an overwhelming number of replies, still... a 
hint.
I went further though. I thought to see exactly what comes in into 
NSString's capitalizedString.


First question is... how to print out an unichar in NSLog? %c? or %C?
I get the same results with both:

2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: 
semicondensed

2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: |s|
2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: |e|
2020-06-22 21:43:30.599 font_cacher[22429:100817] capitalizing: |c|
2020-06-22 21:43:30.599 font_cacher[22429:100817] capitalizing: |n|
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: fixed
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: |f|
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: |i|


I am printing out the string itself before, then any character before 
the conversion.


It seems some skipping occours?






Re: fallback fonts? remote display - xlib

2020-06-22 Thread Riccardo Mottola

Hi All!

Riccardo Mottola wrote:
Have a look into the font cache file to see which fonts are detected. 
maybe you should delete that file and have it recreated.
As you know the xlib backend is no longer supported especially not 
the XGFont class. You should check, why no better font support is found.


after a long evening of hacking, I print out the results so we can 
keep track of them.


font_cacher already generates a cache were several font names and font 
families are wrong! e.g. "Helvetica" is written as "HelveticA".


The issues are between XGFontPropString, which gets it and makes it 
lowercase and XGFontFamily, which capitalizes it.


Debugging with thousands of fonts is hard, so I put some code to debug 
"Helvetica" and this is what I found out:


    NSLog(@"|%s! |%@|", value, ret);
    NSLog(@"capitalized: %@", [ret capitalizedString]);

2020-06-17 22:40:32.606 font_cacher[16321:100855] |Helvetica! |helvetica|
2020-06-17 22:40:32.608 font_cacher[16321:100855] capitalized: HelveticA

Here, the C string looks sane, the lowercase string too, but the 
capitalized string is totally bogus!


if I cycle and print out the bytes of the C string they look fine:

H 48
e 65
l 6c
v 76
e 65
t 74
i 69
c 63
a 61


A bug! but where? in NSString? a short test case:

  s = [[NSString stringWithCString:"Helvetica"] lowercaseString];
  NSLog(@"%@ - %@", s, [s capitalizedString]);


which I suppose should be equivalent... works perfectly.

I'm a bit clueless now.



I admit I did not expect an overwhelming number of replies, still... a hint.
I went further though. I thought to see exactly what comes in into 
NSString's capitalizedString.


First question is... how to print out an unichar in NSLog? %c? or %C?
I get the same results with both:

2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: 
semicondensed

2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: |s|
2020-06-22 21:43:30.598 font_cacher[22429:100817] capitalizing: |e|
2020-06-22 21:43:30.599 font_cacher[22429:100817] capitalizing: |c|
2020-06-22 21:43:30.599 font_cacher[22429:100817] capitalizing: |n|
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: fixed
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: |f|
2020-06-22 21:43:30.625 font_cacher[22429:100817] capitalizing: |i|


I am printing out the string itself before, then any character before 
the conversion.


It seems some skipping occours?



Re: fallback fonts? remote display - xlib

2020-06-17 Thread Riccardo Mottola

Hi,

Fred Kiefer wrote:

Have a look into the font cache file to see which fonts are detected. maybe you 
should delete that file and have it recreated.
As you know the xlib backend is no longer supported especially not the XGFont 
class. You should check, why no better font support is found.


after a long evening of hacking, I print out the results so we can keep 
track of them.


font_cacher already generates a cache were several font names and font 
families are wrong! e.g. "Helvetica" is written as "HelveticA".


The issues are between XGFontPropString, which gets it and makes it 
lowercase and XGFontFamily, which capitalizes it.


Debugging with thousands of fonts is hard, so I put some code to debug 
"Helvetica" and this is what I found out:


NSLog(@"|%s! |%@|", value, ret);
NSLog(@"capitalized: %@", [ret capitalizedString]);

2020-06-17 22:40:32.606 font_cacher[16321:100855] |Helvetica! |helvetica|
2020-06-17 22:40:32.608 font_cacher[16321:100855] capitalized: HelveticA

Here, the C string looks sane, the lowercase string too, but the 
capitalized string is totally bogus!


if I cycle and print out the bytes of the C string they look fine:

H 48
e 65
l 6c
v 76
e 65
t 74
i 69
c 63
a 61


A bug! but where? in NSString? a short test case:

  s = [[NSString stringWithCString:"Helvetica"] lowercaseString];
  NSLog(@"%@ - %@", s, [s capitalizedString]);


which I suppose should be equivalent... works perfectly.

I'm a bit clueless now.


Riccardo



Re: fallback fonts? remote display - xlib

2020-06-17 Thread Fred Kiefer



> Am 16.06.2020 um 18:54 schrieb Riccardo Mottola :
> 
> I launch an app on my Raspberry with xlib and remote display.
> 
> 2020-06-16 10:40:33.831 ProjectCenter[29598:29598] No font cache available - 
> building new one - this may take several seconds (or minutes on a slow 
> machine with lots of fonts)
> 2020-06-16 10:40:33.834 ProjectCenter[29598:29598] Running 
> /GNUstep/System/Tools/font_cacher
> 2020-06-16 10:42:03.487 ProjectCenter[29598:29598] XGFont: selected font: 
> Helvetica at 12.00 ((null)) is not available.
> 2020-06-16 10:42:03.488 ProjectCenter[29598:29598] The font specified for 
> NSFont, Helvetica, can't be found.
> 2020-06-16 10:42:03.488 ProjectCenter[29598:29598] XGFont: selected font: 
> Helvetica at 12.00 ((null)) is not available.
> 2020-06-16 10:42:03.489 ProjectCenter[29598:29598] XGFont: selected font: 
> Helvetica at 12.00 ((null)) is not available.
> 2020-06-16 10:42:03.489 ProjectCenter[29598:29598] XGFont: selected font: 
> Helvetica at 12.00 ((null)) is not available.
> 2020-06-16 10:42:03.490 ProjectCenter[29598:29598] XGFont: selected font: 
> Courier at 12.00 ((null)) is not available.
> 2020-06-16 10:42:03.491 ProjectCenter[29598:29598] XGFont: selected font: 
> Fixed at 12.00 ((null)) is not available.
> 
> <<...>>
> 
> 2020-06-16 10:42:04.267 ProjectCenter[29598:29598] NSFont.m:1513 Assertion 
> failed in GSCInlineString(instance), method initWithCoder:. Couldn't find a 
> valid font when decoding.
> 2020-06-16 10:42:04.270 ProjectCenter[29598:29598] Exception occurred while 
> loading model: NSFont.m:1513  Assertion failed in GSCInlineString(instance), 
> method initWithCoder:.  Couldn't find a valid font when decoding.
> 2020-06-16 10:42:04.272 ProjectCenter[29598:29598] Failed to load Gorm
> 
> <<...>>
> 
> 2020-06-16 10:42:04.342 ProjectCenter[29598:29598] XGFont: selected font: 
> Fixed at 12.00 ((null)) is not available.
> Segmentation fault
> 
> now.. I wonder why? I launched "xfontsel" on the raspberry.
> Am I right to assume that the fonts seen there are the one availbale to the 
> backend too?
> 
> I see Helvetica, e.g.:
> 
> -*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*
> 
> -*-courier-*-r-*-*-12-*-*-*-*-*-*-*
> 
> what am I missing?


Have a look into the font cache file to see which fonts are detected. maybe you 
should delete that file and have it recreated.
As you know the xlib backend is no longer supported especially not the XGFont 
class. You should check, why no better font support is found.


fallback fonts? remote display - xlib

2020-06-16 Thread Riccardo Mottola

Hi,

I launch an app on my Raspberry with xlib and remote display.

2020-06-16 10:40:33.831 ProjectCenter[29598:29598] No font cache 
available - building new one - this may take several seconds (or minutes 
on a slow machine with lots of fonts)
2020-06-16 10:40:33.834 ProjectCenter[29598:29598] Running 
/GNUstep/System/Tools/font_cacher
2020-06-16 10:42:03.487 ProjectCenter[29598:29598] XGFont: selected 
font: Helvetica at 12.00 ((null)) is not available.
2020-06-16 10:42:03.488 ProjectCenter[29598:29598] The font specified 
for NSFont, Helvetica, can't be found.
2020-06-16 10:42:03.488 ProjectCenter[29598:29598] XGFont: selected 
font: Helvetica at 12.00 ((null)) is not available.
2020-06-16 10:42:03.489 ProjectCenter[29598:29598] XGFont: selected 
font: Helvetica at 12.00 ((null)) is not available.
2020-06-16 10:42:03.489 ProjectCenter[29598:29598] XGFont: selected 
font: Helvetica at 12.00 ((null)) is not available.
2020-06-16 10:42:03.490 ProjectCenter[29598:29598] XGFont: selected 
font: Courier at 12.00 ((null)) is not available.
2020-06-16 10:42:03.491 ProjectCenter[29598:29598] XGFont: selected 
font: Fixed at 12.00 ((null)) is not available.


<<...>>

2020-06-16 10:42:04.267 ProjectCenter[29598:29598] NSFont.m:1513 
Assertion failed in GSCInlineString(instance), method initWithCoder:. 
Couldn't find a valid font when decoding.
2020-06-16 10:42:04.270 ProjectCenter[29598:29598] Exception occurred 
while loading model: NSFont.m:1513  Assertion failed in 
GSCInlineString(instance), method initWithCoder:.  Couldn't find a valid 
font when decoding.

2020-06-16 10:42:04.272 ProjectCenter[29598:29598] Failed to load Gorm

<<...>>

2020-06-16 10:42:04.342 ProjectCenter[29598:29598] XGFont: selected 
font: Fixed at 12.00 ((null)) is not available.

Segmentation fault

now.. I wonder why? I launched "xfontsel" on the raspberry.
Am I right to assume that the fonts seen there are the one availbale to 
the backend too?


I see Helvetica, e.g.:

-*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*

-*-courier-*-r-*-*-12-*-*-*-*-*-*-*

what am I missing?

Riccardo