Comment 9 for bug 1853617

Revision history for this message
Roland Lutz (rlutz) wrote :

These are interesting results. The fact that only the lower alignments are affected means that either the font descent or the height of the logical text bounding box are calculated incorrectly. But why does this depend on font size?

You didn't attach the rendered result of your new testcase; maybe this could help understand the issue better. Also, I created and attached a new testcase with all font sizes from 1 to 20.

You can observe the font descent and logical text bounding box by adding the following lines to libgedacairo/edarenderer.c:

@@ -971,6 +971,15 @@ eda_renderer_calc_text_position (EdaRenderer *renderer, OBJECT *object,
   y_middle = y_upper - inked_rect.height / 2.; /* Middle of inked extents */
   y_lower = descent - logical_rect.height; /* Baseline of bottom line */

+ fprintf (stderr, "%.3f %.3f ",
+ (double) y_lower / PANGO_SCALE,
+ (double) descent / PANGO_SCALE);
+ fprintf (stderr, "[%.3f %.3f %.3f %.3f]\n",
+ (double) logical_rect.x / PANGO_SCALE,
+ (double) logical_rect.y / PANGO_SCALE,
+ (double) logical_rect.width / PANGO_SCALE,
+ (double) logical_rect.height / PANGO_SCALE);
+
   /* Special case flips attachment point to opposite corner when
    * the text is rotated to 180 degrees, since the drawing code
    * does not rotate the text to be shown upside down.

Maybe a pattern emerges here.