aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/outofflowmgr.cc6
-rw-r--r--dw/textblock_linebreaking.cc24
-rw-r--r--lout/debug.hh10
3 files changed, 37 insertions, 3 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 58eb7728..83431da3 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1608,7 +1608,8 @@ int OutOfFlowMgr::getLeftBorder (Textblock *textblock, int y, int h,
Textblock *lastGB, int lastExtIndex)
{
int b = getBorder (textblock, LEFT, y, h, lastGB, lastExtIndex);
- //printf ("getLeftBorder (%p, %d, %d) => %d\n", textblock, y, h, b);
+ DBG_OBJ_MSGF_O ("border", 0, textblock,
+ "left border (y = %d, h = %d) => %d\n", y, h, b);
return b;
}
@@ -1622,7 +1623,8 @@ int OutOfFlowMgr::getRightBorder (Textblock *textblock, int y, int h,
Textblock *lastGB, int lastExtIndex)
{
int b = getBorder (textblock, RIGHT, y, h, lastGB, lastExtIndex);
- //printf ("getRightBorder (%p, %d, %d) => %d\n", textblock, y, h, b);
+ DBG_OBJ_MSGF_O ("border", 0, textblock,
+ "right border (y = %d, h = %d) => %d\n", y, h, b);
return b;
}
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index e18b637a..69e20c1e 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -759,16 +759,31 @@ bool Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
*/
void Textblock::checkPossibleLineHeightChange (int wordIndex)
{
+ DBG_OBJ_MSGF ("construct.line.border", 0,
+ "<b>checkPossibleLineHeightChange</b> (%d)", wordIndex);
+ DBG_OBJ_MSG_START ();
+
Word *w = words->getRef (wordIndex);
bool heightIncreased =
containingBlock->outOfFlowMgr &&
- (w->size.ascent > newLineAscent || w->size.descent >= newLineDescent);
+ (w->size.ascent > newLineAscent || w->size.descent > newLineDescent);
+
+ DBG_OBJ_MSGF ("construct.line.border", 1,
+ "(old) line height = %d + %d, word height = %d + %d",
+ newLineAscent, newLineDescent, w->size.ascent,
+ w->size.descent);
newLineAscent = misc::max (newLineAscent, w->size.ascent);
newLineDescent = misc::max (newLineDescent, w->size.descent);
+ DBG_OBJ_MSGF ("construct.line.border", 1,
+ "height increased? %s. (new) line height = %d + %d",
+ heightIncreased ? "yes" : "no", newLineAscent, newLineDescent);
+
if (heightIncreased)
updateBorders (wordIndex, true, true);
+
+ DBG_OBJ_MSG_END ();
}
bool Textblock::wrapWordOofRef (int wordIndex, bool wrapAll)
@@ -803,6 +818,11 @@ bool Textblock::wrapWordOofRef (int wordIndex, bool wrapAll)
*/
void Textblock::updateBorders (int wordIndex, bool left, bool right)
{
+ DBG_OBJ_MSGF ("construct.line.border", 0,
+ "<b>updateBorders</b> (%d, %s, %s)",
+ wordIndex, left ? "true" : "false", right ? "true" : "false");
+ DBG_OBJ_MSG_START ();
+
assert (left || right);
int y = yOffsetOfPossiblyMissingLine (lines->size ());
@@ -835,6 +855,8 @@ void Textblock::updateBorders (int wordIndex, bool left, bool right)
for (int i = firstIndex; i <= wordIndex; i++)
accumulateWordData (i);
+
+ DBG_OBJ_MSG_END ();
}
int Textblock::searchMinBap (int firstWord, int lastWord, int penaltyIndex,
diff --git a/lout/debug.hh b/lout/debug.hh
index f78012f5..98823b52 100644
--- a/lout/debug.hh
+++ b/lout/debug.hh
@@ -57,6 +57,15 @@
fflush (stdout); \
} D_STMT_END
+// Variant which does not use "this", but an explicitly passed
+// object. Should be applied to other macros. (Also, for use in C.)
+#define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt, ...) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:" fmt "\n", \
+ RTFL_PREFIX_ARGS, obj, aspect, prio, __VA_ARGS__); \
+ fflush (stdout); \
+ } D_STMT_END
+
#define DBG_OBJ_MSG_START() \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-msg-start:%p\n", \
@@ -180,6 +189,7 @@
#define DBG_OBJ_MSG(aspect, prio, msg)
#define DBG_OBJ_MSGF(aspect, prio, fmt, ...)
+#define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt, ...)
#define DBG_OBJ_MSG_START(obj)
#define DBG_OBJ_MSG_END(obj)
#define DBG_OBJ_CREATE(klass)