Three things to be fixed for the rule nodes with subtypes 1 to 4 in DVi mode. (Function dvi_place_rule from dvigen.c file) void dvi_place_rule(PDF pdf, halfword q, scaledpos size) { synch_dvi_with_pos(pdf->posstruct->pos); if ((subtype(q) >= box_rule) && (subtype(q) <= user_rule)) { /*tex place nothing, only take space */ if (textdir_is_L(pdf->posstruct->dir)) dvi.h += size.h; } else { /*tex normal_rule or >= 100 being a leader rule */ if (textdir_is_L(pdf->posstruct->dir)) { /*tex movement optimization for |dir_*L*| */ dvi_out(set_rule); dvi.h += size.h; } else dvi_out(put_rule); } dvi_four(size.v); dvi_four(size.h); } Problem 1. Bad dvi file due the arguments output without dvi command (misplaced the two last lines in the code). Possible fix: void dvi_place_rule(PDF pdf, halfword q, scaledpos size) { synch_dvi_with_pos(pdf->posstruct->pos); if ((subtype(q) >= box_rule) && (subtype(q) <= user_rule)) { /*tex place nothing, only take space */ if (textdir_is_L(pdf->posstruct->dir)) dvi.h += size.h; } else { /*tex normal_rule or >= 100 being a leader rule */ if (textdir_is_L(pdf->posstruct->dir)) { /*tex movement optimization for |dir_*L*| */ dvi_out(set_rule); dvi.h += size.h; } else dvi_out(put_rule); dvi_four(size.v); dvi_four(size.h); } } Problem 2. Not reserved space for the rule in the output. Possible fix: void dvi_place_rule(PDF pdf, halfword q, scaledpos size) { synch_dvi_with_pos(pdf->posstruct->pos); if ((subtype(q) >= box_rule) && (subtype(q) <= user_rule)) { /*tex place nothing, only take space */ if (textdir_is_L(pdf->posstruct->dir)) dvi.h += size.h; movement(size.h, right1); } else { /*tex normal_rule or >= 100 being a leader rule */ if (textdir_is_L(pdf->posstruct->dir)) { /*tex movement optimization for |dir_*L*| */ dvi_out(set_rule); dvi.h += size.h; } else dvi_out(put_rule); dvi_four(size.v); dvi_four(size.h); } } Problem 3. Broken consistency with PDF mode as process_rule callback is missing in DVI mode. Possible fix: void dvi_place_rule(PDF pdf, halfword q, scaledpos size, int callback_id) { synch_dvi_with_pos(pdf->posstruct->pos); if ((subtype(q) >= box_rule) && (subtype(q) <= user_rule)) { /*tex place nothing, only take space */ if (textdir_is_L(pdf->posstruct->dir)) dvi.h += size.h; if (subtype(q) == user_rule && callback_id != 0) { run_callback(callback_id, “Ndd->”, q, size.h, size.v); } movement(size.h, right1); } else { /*tex normal_rule or >= 100 being a leader rule */ if (textdir_is_L(pdf->posstruct->dir)) { /*tex movement optimization for |dir_*L*| */ dvi_out(set_rule); dvi.h += size.h; } else dvi_out(put_rule); dvi_four(size.v); dvi_four(size.h); } } and fix in dvigen.h < extern void dvi_place_rule(PDF pdf, halfword q, scaledpos size);
extern void dvi_place_rule(PDF pdf, halfword q, scaledpos size, int callback_id);
Regards, Sigitas P.S. Some point for the discussion. For the wider usabillity maybe the rules with zero dimensions (width, height+depth) can be allowed in the output.