@@ -417,7 +417,8 @@ namespace My {
417
417
* Here for convenience. Sets wrap mode and font parameters.
418
418
* Does not set width or text.
419
419
*
420
- * @param cr The Cairo context with which this layout will be used
420
+ * @param cr The Cairo context with which this layout will be
421
+ * used. The device units of cr must be points.
421
422
* @param fontname The name of the font (a Pango family list and
422
423
* style options)
423
424
* @param fontsizeT The font size to use, in points.
@@ -432,11 +433,23 @@ namespace My {
432
433
layout. set_wrap(Pango . WrapMode . WORD_CHAR );
433
434
434
435
// Font
435
- var font_description = Pango . FontDescription . from_string(
436
- " %s %f " . printf(fontname, fontsizeT)
437
- );
436
+ var font_description = Pango . FontDescription . from_string(fontname);
437
+ font_description. set_absolute_size(c2p(fontsizeT));
438
438
layout. set_font_description(font_description);
439
439
440
+ if (lenabled(DEBUG )) {
441
+ var metrics = layout. get_context(). get_metrics(font_description, null );
442
+ ldebugo(layout, " approx char width %f " , p2i(metrics. get_approximate_char_width()));
443
+ ldebugo(layout, " approx digit width %f " , p2i(metrics. get_approximate_digit_width()));
444
+ ldebugo(layout, " ascent %f " , p2i(metrics. get_ascent()));
445
+ ldebugo(layout, " descent %f " , p2i(metrics. get_descent()));
446
+ // Requires Pango 1.44+ => ldebugo(layout, "line height %f", p2i(metrics.get_height()));
447
+ ldebugo(layout, " strikethrough position %f " , p2i(metrics. get_strikethrough_position()));
448
+ ldebugo(layout, " strikethrough thickness %f " , p2i(metrics. get_strikethrough_thickness()));
449
+ ldebugo(layout, " underline position %f " , p2i(metrics. get_underline_position()));
450
+ ldebugo(layout, " underline thickness %f " , p2i(metrics. get_underline_thickness()));
451
+ }
452
+
440
453
// Paragraph
441
454
Pango . Alignment palign = LEFT ;
442
455
switch (align) {
0 commit comments