From 93252c6fc3585f6c226514e9c476af82b7c55d86 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 1 Mar 2023 10:59:04 -0700 Subject: [PATCH] [justify] Debug output --- src/hb-debug.hh | 4 ++++ src/hb-shape.cc | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/hb-debug.hh b/src/hb-debug.hh index efab37464..0ac4515fa 100644 --- a/src/hb-debug.hh +++ b/src/hb-debug.hh @@ -373,6 +373,10 @@ struct hb_no_trace_t { #define HB_DEBUG_FT (HB_DEBUG+0) #endif +#ifndef HB_DEBUG_JUSTIFY +#define HB_DEBUG_JUSTIFY (HB_DEBUG+0) +#endif + #ifndef HB_DEBUG_OBJECT #define HB_DEBUG_OBJECT (HB_DEBUG+0) #endif diff --git a/src/hb-shape.cc b/src/hb-shape.cc index d04cc214b..5aae008d7 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -26,6 +26,8 @@ * Google Author(s): Behdad Esfahbod */ +#define HB_DEBUG_JUSTIFY 1 + #include "hb.hh" #include "hb-shaper.hh" @@ -345,11 +347,14 @@ hb_shape_justify (hb_font_t *font, shaper_list))) { failed = true; - return min_target_width; + return (double) min_target_width; } - printf ("%g\n", x); - return buffer_width (buffer); + double w = buffer_width (buffer); + DEBUG_MSG (JUSTIFY, nullptr, "Trying '%c%c%c%c' axis parameter %f. Width %g. Target: min %g max %g", + HB_UNTAG (tag), x, w, + (double) min_target_width, (double) max_target_width); + return w; }; double y = 0;