discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hang in font panel with certain fonts


From: Riccardo Mottola
Subject: Re: Hang in font panel with certain fonts
Date: Sun, 25 Jan 2015 19:09:55 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:35.0) Gecko/20100101 Firefox/35.0 SeaMonkey/2.32

Hi Fred,

using Eric's code, the size of CGFloat on my machine is4:

CGFloat size: 4


Fred Kiefer wrote:
By using %f you assume that you have a float here not a double. Which should 
settle the question about CGFloat.
And the NSLog statement is exactly what I would like to know, but rather before 
the if statement and not after the assignment. And maybe you should also 
inspect __new_height although it gets assigned with h.


#define WANT_LINE_HEIGHT(h) \
  do { \
    CGFloat __new_height = (h); \
    if (max_line_height > 0 && __new_height > max_line_height) \
      __new_height = max_line_height; \
    NSLog(@"lh = %f, h = %f, gt? %d", line_height, h, line_height > h); \
    if (__new_height > line_height) \
      { \
        line_height = __new_height; \
        COMPUTE_BASELINE; \
        goto restart; \
      } \
  } while (0)


This is the first printout:

2015-01-25 18:47:59.315 Ink[3603] layoutGlyphsInLayoutManager index 0 howMany 0
2015-01-25 18:47:59.338 Ink[3603] f_ascender: 10.285714
2015-01-25 18:47:59.341 Ink[3603] Main glyph layout loop. i:0
2015-01-25 18:47:59.343 Ink[3603] lh = 12.857142, h = 12.857143, gt? 0


This is the printout of the loop after it has run for a while:

2015-01-25 18:48:13.700 Ink[3603] lh = 12.857142, h = 12.857143, gt? 0
2015-01-25 18:48:13.702 Ink[3603] f_ascender: 10.285714

We see the values remain constant.

I thought that __new_height might interest you and this is what I get:

2015-01-25 19:05:50.664 Ink[4657] f_ascender: 10.285714
2015-01-25 19:05:50.666 Ink[4657] Main glyph layout loop. i:0
2015-01-25 19:05:50.669 Ink[4657] nh = 12.857143, lh = 12.857142, h = 12.857143, gt? 0
2015-01-25 19:05:50.672 Ink[4657] f_ascender: 10.285714
2015-01-25 19:05:50.674 Ink[4657] Main glyph layout loop. i:0
2015-01-25 19:05:50.676 Ink[4657] nh = 12.857143, lh = 12.857143, h = 12.857143, gt? 0
2015-01-25 19:05:50.679 Ink[4657] 2-WantLineHeight completed

and the loop end: that log line "fixes" our problem. At this point I start to guess that we have a math error amplified or triggered by compiler optimizations. Forcing the printout of __new_line forces the compiler not to perform a certain optimization and the code works again.

Do you have any clue on how to improve/fix the code? Or at least a better explanation of my rough idea?

Riccardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]