1114402Sru// -*- C++ -*- 2114402Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2002 Free Software Foundation, Inc. 3114402Sru Written by James Clark (jjc@jclark.com) 4114402Sru 5114402SruThis file is part of groff. 6114402Sru 7114402Srugroff is free software; you can redistribute it and/or modify it under 8114402Sruthe terms of the GNU General Public License as published by the Free 9114402SruSoftware Foundation; either version 2, or (at your option) any later 10114402Sruversion. 11114402Sru 12114402Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 13114402SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 14114402SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15114402Srufor more details. 16114402Sru 17114402SruYou should have received a copy of the GNU General Public License along 18114402Sruwith groff; see the file COPYING. If not, write to the Free Software 19151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 20114402Sru 21114402Sru#include "eqn.h" 22114402Sru#include "pbox.h" 23114402Sru 24114402Sruclass accent_box : public pointer_box { 25114402Sruprivate: 26114402Sru box *ab; 27114402Srupublic: 28114402Sru accent_box(box *, box *); 29114402Sru ~accent_box(); 30114402Sru int compute_metrics(int); 31114402Sru void output(); 32114402Sru void debug_print(); 33114402Sru void check_tabs(int); 34114402Sru}; 35114402Sru 36114402Srubox *make_accent_box(box *p, box *q) 37114402Sru{ 38114402Sru return new accent_box(p, q); 39114402Sru} 40114402Sru 41114402Sruaccent_box::accent_box(box *pp, box *qq) : pointer_box(pp), ab(qq) 42114402Sru{ 43114402Sru} 44114402Sru 45114402Sruaccent_box::~accent_box() 46114402Sru{ 47114402Sru delete ab; 48114402Sru} 49114402Sru 50114402Sru#if 0 51114402Sruint accent_box::compute_metrics(int style) 52114402Sru{ 53114402Sru int r = p->compute_metrics(style); 54114402Sru p->compute_skew(); 55114402Sru ab->compute_metrics(style); 56114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 57114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 58114402Sru printf(".nr " SUP_RAISE_FORMAT " \\n[" HEIGHT_FORMAT "]-%dM>?0\n", 59114402Sru uid, p->uid, x_height); 60114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]+\\n[" 61114402Sru SUP_RAISE_FORMAT "]\n", 62114402Sru uid, ab->uid, uid); 63114402Sru return r; 64114402Sru} 65114402Sru 66114402Sruvoid accent_box::output() 67114402Sru{ 68114402Sru printf("\\h'\\n[" WIDTH_FORMAT "]u-\\n[" WIDTH_FORMAT "]u/2u+\\n[" 69114402Sru SKEW_FORMAT "]u'", 70114402Sru p->uid, ab->uid, p->uid); 71114402Sru printf("\\v'-\\n[" SUP_RAISE_FORMAT "]u'", uid); 72114402Sru ab->output(); 73114402Sru printf("\\h'-\\n[" WIDTH_FORMAT "]u'", ab->uid); 74114402Sru printf("\\v'\\n[" SUP_RAISE_FORMAT "]u'", uid); 75114402Sru printf("\\h'-(\\n[" WIDTH_FORMAT "]u-\\n[" WIDTH_FORMAT "]u/2u+\\n[" 76114402Sru SKEW_FORMAT "]u)'", 77114402Sru p->uid, ab->uid, p->uid); 78114402Sru p->output(); 79114402Sru} 80114402Sru#endif 81114402Sru 82114402Sru/* This version copes with the possibility of an accent's being wider 83114402Sruthan its accentee. LEFT_WIDTH_FORMAT gives the distance from the 84114402Sruleft edge of the resulting box to the middle of the accentee's box.*/ 85114402Sru 86114402Sruint accent_box::compute_metrics(int style) 87114402Sru{ 88114402Sru int r = p->compute_metrics(style); 89114402Sru p->compute_skew(); 90114402Sru ab->compute_metrics(style); 91114402Sru printf(".nr " LEFT_WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]/2" 92114402Sru ">?(\\n[" WIDTH_FORMAT "]/2-\\n[" SKEW_FORMAT "])\n", 93114402Sru uid, p->uid, ab->uid, p->uid); 94114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]/2" 95114402Sru ">?(\\n[" WIDTH_FORMAT "]/2+\\n[" SKEW_FORMAT "])" 96114402Sru "+\\n[" LEFT_WIDTH_FORMAT "]\n", 97114402Sru uid, p->uid, ab->uid, p->uid, uid); 98114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 99114402Sru printf(".nr " SUP_RAISE_FORMAT " \\n[" HEIGHT_FORMAT "]-%dM>?0\n", 100114402Sru uid, p->uid, x_height); 101114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]+\\n[" 102114402Sru SUP_RAISE_FORMAT "]\n", 103114402Sru uid, ab->uid, uid); 104114402Sru if (r) 105114402Sru printf(".nr " MARK_REG " +\\n[" LEFT_WIDTH_FORMAT "]" 106114402Sru "-(\\n[" WIDTH_FORMAT "]/2)'\n", 107114402Sru uid, p->uid); 108114402Sru return r; 109114402Sru} 110114402Sru 111114402Sruvoid accent_box::output() 112114402Sru{ 113114402Sru printf("\\Z" DELIMITER_CHAR); 114114402Sru printf("\\h'\\n[" LEFT_WIDTH_FORMAT "]u+\\n[" SKEW_FORMAT "]u" 115114402Sru "-(\\n[" WIDTH_FORMAT "]u/2u)'", 116114402Sru uid, p->uid, ab->uid); 117114402Sru printf("\\v'-\\n[" SUP_RAISE_FORMAT "]u'", uid); 118114402Sru ab->output(); 119114402Sru printf(DELIMITER_CHAR); 120114402Sru printf("\\Z" DELIMITER_CHAR); 121114402Sru printf("\\h'\\n[" LEFT_WIDTH_FORMAT "]u-(\\n[" WIDTH_FORMAT "]u/2u)'", 122114402Sru uid, p->uid); 123114402Sru p->output(); 124114402Sru printf(DELIMITER_CHAR); 125114402Sru printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); 126114402Sru} 127114402Sru 128114402Sruvoid accent_box::check_tabs(int level) 129114402Sru{ 130114402Sru ab->check_tabs(level + 1); 131114402Sru p->check_tabs(level + 1); 132114402Sru} 133114402Sru 134114402Sruvoid accent_box::debug_print() 135114402Sru{ 136114402Sru fprintf(stderr, "{ "); 137114402Sru p->debug_print(); 138114402Sru fprintf(stderr, " } accent { "); 139114402Sru ab->debug_print(); 140114402Sru fprintf(stderr, " }"); 141114402Sru} 142114402Sru 143114402Sruclass overline_char_box : public simple_box { 144114402Srupublic: 145114402Sru overline_char_box(); 146114402Sru void output(); 147114402Sru void debug_print(); 148114402Sru}; 149114402Sru 150114402Sruoverline_char_box::overline_char_box() 151114402Sru{ 152114402Sru} 153114402Sru 154114402Sruvoid overline_char_box::output() 155114402Sru{ 156114402Sru printf("\\v'-%dM/2u-%dM'", 7*default_rule_thickness, x_height); 157114402Sru printf((draw_flag ? "\\D'l%dM 0'" : "\\l'%dM\\&\\(ru'"), 158114402Sru accent_width); 159114402Sru printf("\\v'%dM/2u+%dM'", 7*default_rule_thickness, x_height); 160114402Sru} 161114402Sru 162114402Sruvoid overline_char_box::debug_print() 163114402Sru{ 164114402Sru fprintf(stderr, "<overline char>"); 165114402Sru} 166114402Sru 167114402Sruclass overline_box : public pointer_box { 168114402Srupublic: 169114402Sru overline_box(box *); 170114402Sru int compute_metrics(int); 171114402Sru void output(); 172114402Sru void debug_print(); 173114402Sru}; 174114402Sru 175114402Srubox *make_overline_box(box *p) 176114402Sru{ 177114402Sru if (p->is_char()) 178114402Sru return new accent_box(p, new overline_char_box); 179114402Sru else 180114402Sru return new overline_box(p); 181114402Sru} 182114402Sru 183114402Sruoverline_box::overline_box(box *pp) : pointer_box(pp) 184114402Sru{ 185114402Sru} 186114402Sru 187114402Sruint overline_box::compute_metrics(int style) 188114402Sru{ 189114402Sru int r = p->compute_metrics(cramped_style(style)); 190114402Sru // 9 191114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]+%dM\n", 192114402Sru uid, p->uid, default_rule_thickness*5); 193114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 194114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 195114402Sru return r; 196114402Sru} 197114402Sru 198114402Sruvoid overline_box::output() 199114402Sru{ 200114402Sru // 9 201114402Sru printf("\\Z" DELIMITER_CHAR); 202114402Sru printf("\\v'-\\n[" HEIGHT_FORMAT "]u-(%dM/2u)'", 203114402Sru p->uid, 7*default_rule_thickness); 204114402Sru if (draw_flag) 205114402Sru printf("\\D'l\\n[" WIDTH_FORMAT "]u 0'", p->uid); 206114402Sru else 207114402Sru printf("\\l'\\n[" WIDTH_FORMAT "]u\\&\\(ru'", p->uid); 208114402Sru printf(DELIMITER_CHAR); 209114402Sru p->output(); 210114402Sru} 211114402Sru 212114402Sruvoid overline_box::debug_print() 213114402Sru{ 214114402Sru fprintf(stderr, "{ "); 215114402Sru p->debug_print(); 216114402Sru fprintf(stderr, " } bar"); 217114402Sru} 218114402Sru 219114402Sruclass uaccent_box : public pointer_box { 220114402Sru box *ab; 221114402Srupublic: 222114402Sru uaccent_box(box *, box *); 223114402Sru ~uaccent_box(); 224114402Sru int compute_metrics(int); 225114402Sru void output(); 226114402Sru void compute_subscript_kern(); 227114402Sru void check_tabs(int); 228114402Sru void debug_print(); 229114402Sru}; 230114402Sru 231114402Srubox *make_uaccent_box(box *p, box *q) 232114402Sru{ 233114402Sru return new uaccent_box(p, q); 234114402Sru} 235114402Sru 236114402Sruuaccent_box::uaccent_box(box *pp, box *qq) 237114402Sru: pointer_box(pp), ab(qq) 238114402Sru{ 239114402Sru} 240114402Sru 241114402Sruuaccent_box::~uaccent_box() 242114402Sru{ 243114402Sru delete ab; 244114402Sru} 245114402Sru 246114402Sruint uaccent_box::compute_metrics(int style) 247114402Sru{ 248114402Sru int r = p->compute_metrics(style); 249114402Sru ab->compute_metrics(style); 250114402Sru printf(".nr " LEFT_WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]/2" 251114402Sru ">?(\\n[" WIDTH_FORMAT "]/2)\n", 252114402Sru uid, p->uid, ab->uid); 253114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]/2" 254114402Sru ">?(\\n[" WIDTH_FORMAT "]/2)" 255114402Sru "+\\n[" LEFT_WIDTH_FORMAT "]\n", 256114402Sru uid, p->uid, ab->uid, uid); 257114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 258114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]" 259114402Sru "+\\n[" DEPTH_FORMAT "]\n", 260114402Sru uid, p->uid, ab->uid); 261114402Sru if (r) 262114402Sru printf(".nr " MARK_REG " +\\n[" LEFT_WIDTH_FORMAT "]" 263114402Sru "-(\\n[" WIDTH_FORMAT "]/2)'\n", 264114402Sru uid, p->uid); 265114402Sru return r; 266114402Sru} 267114402Sru 268114402Sruvoid uaccent_box::output() 269114402Sru{ 270114402Sru printf("\\Z" DELIMITER_CHAR); 271114402Sru printf("\\h'\\n[" LEFT_WIDTH_FORMAT "]u-(\\n[" WIDTH_FORMAT "]u/2u)'", 272114402Sru uid, ab->uid); 273114402Sru printf("\\v'\\n[" DEPTH_FORMAT "]u'", p->uid); 274114402Sru ab->output(); 275114402Sru printf(DELIMITER_CHAR); 276114402Sru printf("\\Z" DELIMITER_CHAR); 277114402Sru printf("\\h'\\n[" LEFT_WIDTH_FORMAT "]u-(\\n[" WIDTH_FORMAT "]u/2u)'", 278114402Sru uid, p->uid); 279114402Sru p->output(); 280114402Sru printf(DELIMITER_CHAR); 281114402Sru printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); 282114402Sru} 283114402Sru 284114402Sruvoid uaccent_box::check_tabs(int level) 285114402Sru{ 286114402Sru ab->check_tabs(level + 1); 287114402Sru p->check_tabs(level + 1); 288114402Sru} 289114402Sru 290114402Sruvoid uaccent_box::compute_subscript_kern() 291114402Sru{ 292114402Sru box::compute_subscript_kern(); // want 0 subscript kern 293114402Sru} 294114402Sru 295114402Sruvoid uaccent_box::debug_print() 296114402Sru{ 297114402Sru fprintf(stderr, "{ "); 298114402Sru p->debug_print(); 299114402Sru fprintf(stderr, " } uaccent { "); 300114402Sru ab->debug_print(); 301114402Sru fprintf(stderr, " }"); 302114402Sru} 303114402Sru 304114402Sruclass underline_char_box : public simple_box { 305114402Srupublic: 306114402Sru underline_char_box(); 307114402Sru void output(); 308114402Sru void debug_print(); 309114402Sru}; 310114402Sru 311114402Sruunderline_char_box::underline_char_box() 312114402Sru{ 313114402Sru} 314114402Sru 315114402Sruvoid underline_char_box::output() 316114402Sru{ 317114402Sru printf("\\v'%dM/2u'", 7*default_rule_thickness); 318114402Sru printf((draw_flag ? "\\D'l%dM 0'" : "\\l'%dM\\&\\(ru'"), 319114402Sru accent_width); 320114402Sru printf("\\v'-%dM/2u'", 7*default_rule_thickness); 321114402Sru} 322114402Sru 323114402Sruvoid underline_char_box::debug_print() 324114402Sru{ 325114402Sru fprintf(stderr, "<underline char>"); 326114402Sru} 327114402Sru 328114402Sru 329114402Sruclass underline_box : public pointer_box { 330114402Srupublic: 331114402Sru underline_box(box *); 332114402Sru int compute_metrics(int); 333114402Sru void output(); 334114402Sru void compute_subscript_kern(); 335114402Sru void debug_print(); 336114402Sru}; 337114402Sru 338114402Srubox *make_underline_box(box *p) 339114402Sru{ 340114402Sru if (p->is_char()) 341114402Sru return new uaccent_box(p, new underline_char_box); 342114402Sru else 343114402Sru return new underline_box(p); 344114402Sru} 345114402Sru 346114402Sruunderline_box::underline_box(box *pp) : pointer_box(pp) 347114402Sru{ 348114402Sru} 349114402Sru 350114402Sruint underline_box::compute_metrics(int style) 351114402Sru{ 352114402Sru int r = p->compute_metrics(style); 353114402Sru // 10 354114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]+%dM\n", 355114402Sru uid, p->uid, default_rule_thickness*5); 356114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 357114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 358114402Sru return r; 359114402Sru} 360114402Sru 361114402Sruvoid underline_box::output() 362114402Sru{ 363114402Sru // 10 364114402Sru printf("\\Z" DELIMITER_CHAR); 365114402Sru printf("\\v'\\n[" DEPTH_FORMAT "]u+(%dM/2u)'", 366114402Sru p->uid, 7*default_rule_thickness); 367114402Sru if (draw_flag) 368114402Sru printf("\\D'l\\n[" WIDTH_FORMAT "]u 0'", p->uid); 369114402Sru else 370114402Sru printf("\\l'\\n[" WIDTH_FORMAT "]u\\&\\(ru'", p->uid); 371114402Sru printf(DELIMITER_CHAR); 372114402Sru p->output(); 373114402Sru} 374114402Sru 375114402Sru// we want an underline box to have 0 subscript kern 376114402Sru 377114402Sruvoid underline_box::compute_subscript_kern() 378114402Sru{ 379114402Sru box::compute_subscript_kern(); 380114402Sru} 381114402Sru 382114402Sruvoid underline_box::debug_print() 383114402Sru{ 384114402Sru fprintf(stderr, "{ "); 385114402Sru p->debug_print(); 386114402Sru fprintf(stderr, " } under"); 387114402Sru} 388114402Sru 389114402Srusize_box::size_box(char *s, box *pp) : pointer_box(pp), size(s) 390114402Sru{ 391114402Sru} 392114402Sru 393114402Sruint size_box::compute_metrics(int style) 394114402Sru{ 395114402Sru printf(".nr " SIZE_FORMAT " \\n[.ps]\n", uid); 396114402Sru printf(".ps %s\n", size); 397114402Sru printf(".nr " SMALL_SIZE_FORMAT " \\n[.ps]\n", uid); 398114402Sru int r = p->compute_metrics(style); 399114402Sru printf(".ps \\n[" SIZE_FORMAT "]u\n", uid); 400114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 401114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 402114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 403114402Sru return r; 404114402Sru} 405114402Sru 406114402Sruvoid size_box::output() 407114402Sru{ 408114402Sru printf("\\s[\\n[" SMALL_SIZE_FORMAT "]u]", uid); 409114402Sru p->output(); 410114402Sru printf("\\s[\\n[" SIZE_FORMAT "]u]", uid); 411114402Sru} 412114402Sru 413114402Srusize_box::~size_box() 414114402Sru{ 415114402Sru a_delete size; 416114402Sru} 417114402Sru 418114402Sruvoid size_box::debug_print() 419114402Sru{ 420114402Sru fprintf(stderr, "size %s { ", size); 421114402Sru p->debug_print(); 422114402Sru fprintf(stderr, " }"); 423114402Sru} 424114402Sru 425114402Sru 426114402Srufont_box::font_box(char *s, box *pp) : pointer_box(pp), f(s) 427114402Sru{ 428114402Sru} 429114402Sru 430114402Srufont_box::~font_box() 431114402Sru{ 432114402Sru a_delete f; 433114402Sru} 434114402Sru 435114402Sruint font_box::compute_metrics(int style) 436114402Sru{ 437114402Sru const char *old_roman_font = current_roman_font; 438114402Sru current_roman_font = f; 439114402Sru printf(".nr " FONT_FORMAT " \\n[.f]\n", uid); 440114402Sru printf(".ft %s\n", f); 441114402Sru int r = p->compute_metrics(style); 442114402Sru current_roman_font = old_roman_font; 443114402Sru printf(".ft \\n[" FONT_FORMAT "]\n", uid); 444114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 445114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 446114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 447114402Sru return r; 448114402Sru} 449114402Sru 450114402Sruvoid font_box::output() 451114402Sru{ 452114402Sru printf("\\f[%s]", f); 453114402Sru const char *old_roman_font = current_roman_font; 454114402Sru current_roman_font = f; 455114402Sru p->output(); 456114402Sru current_roman_font = old_roman_font; 457114402Sru printf("\\f[\\n[" FONT_FORMAT "]]", uid); 458114402Sru} 459114402Sru 460114402Sruvoid font_box::debug_print() 461114402Sru{ 462114402Sru fprintf(stderr, "font %s { ", f); 463114402Sru p->debug_print(); 464114402Sru fprintf(stderr, " }"); 465114402Sru} 466114402Sru 467114402Srufat_box::fat_box(box *pp) : pointer_box(pp) 468114402Sru{ 469114402Sru} 470114402Sru 471114402Sruint fat_box::compute_metrics(int style) 472114402Sru{ 473114402Sru int r = p->compute_metrics(style); 474114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]+%dM\n", 475114402Sru uid, p->uid, fat_offset); 476114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 477114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 478114402Sru return r; 479114402Sru} 480114402Sru 481114402Sruvoid fat_box::output() 482114402Sru{ 483114402Sru p->output(); 484114402Sru printf("\\h'-\\n[" WIDTH_FORMAT "]u'", p->uid); 485114402Sru printf("\\h'%dM'", fat_offset); 486114402Sru p->output(); 487114402Sru} 488114402Sru 489114402Sru 490114402Sruvoid fat_box::debug_print() 491114402Sru{ 492114402Sru fprintf(stderr, "fat { "); 493114402Sru p->debug_print(); 494114402Sru fprintf(stderr, " }"); 495114402Sru} 496114402Sru 497114402Sru 498114402Sruvmotion_box::vmotion_box(int i, box *pp) : pointer_box(pp), n(i) 499114402Sru{ 500114402Sru} 501114402Sru 502114402Sruint vmotion_box::compute_metrics(int style) 503114402Sru{ 504114402Sru int r = p->compute_metrics(style); 505114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 506114402Sru if (n > 0) { 507114402Sru printf(".nr " HEIGHT_FORMAT " %dM+\\n[" HEIGHT_FORMAT "]\n", 508114402Sru uid, n, p->uid); 509114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 510114402Sru } 511114402Sru else { 512114402Sru printf(".nr " DEPTH_FORMAT " %dM+\\n[" DEPTH_FORMAT "]>?0\n", 513114402Sru uid, -n, p->uid); 514114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", 515114402Sru uid, p->uid); 516114402Sru } 517114402Sru return r; 518114402Sru} 519114402Sru 520114402Sruvoid vmotion_box::output() 521114402Sru{ 522114402Sru printf("\\v'%dM'", -n); 523114402Sru p->output(); 524114402Sru printf("\\v'%dM'", n); 525114402Sru} 526114402Sru 527114402Sruvoid vmotion_box::debug_print() 528114402Sru{ 529114402Sru if (n >= 0) 530114402Sru fprintf(stderr, "up %d { ", n); 531114402Sru else 532114402Sru fprintf(stderr, "down %d { ", -n); 533114402Sru p->debug_print(); 534114402Sru fprintf(stderr, " }"); 535114402Sru} 536114402Sru 537114402Sruhmotion_box::hmotion_box(int i, box *pp) : pointer_box(pp), n(i) 538114402Sru{ 539114402Sru} 540114402Sru 541114402Sruint hmotion_box::compute_metrics(int style) 542114402Sru{ 543114402Sru int r = p->compute_metrics(style); 544114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]+%dM\n", 545114402Sru uid, p->uid, n); 546114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid); 547114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid); 548114402Sru if (r) 549114402Sru printf(".nr " MARK_REG " +%dM\n", n); 550114402Sru return r; 551114402Sru} 552114402Sru 553114402Sruvoid hmotion_box::output() 554114402Sru{ 555114402Sru printf("\\h'%dM'", n); 556114402Sru p->output(); 557114402Sru} 558114402Sru 559114402Sruvoid hmotion_box::debug_print() 560114402Sru{ 561114402Sru if (n >= 0) 562114402Sru fprintf(stderr, "fwd %d { ", n); 563114402Sru else 564114402Sru fprintf(stderr, "back %d { ", -n); 565114402Sru p->debug_print(); 566114402Sru fprintf(stderr, " }"); 567114402Sru} 568114402Sru 569114402Sruvcenter_box::vcenter_box(box *pp) : pointer_box(pp) 570114402Sru{ 571114402Sru} 572114402Sru 573114402Sruint vcenter_box::compute_metrics(int style) 574114402Sru{ 575114402Sru int r = p->compute_metrics(style); 576114402Sru printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid); 577114402Sru printf(".nr " SUP_RAISE_FORMAT " \\n[" DEPTH_FORMAT "]-\\n[" 578114402Sru HEIGHT_FORMAT "]/2+%dM\n", 579114402Sru uid, p->uid, p->uid, axis_height); 580114402Sru printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]+\\n[" 581114402Sru SUP_RAISE_FORMAT "]>?0\n", uid, p->uid, uid); 582114402Sru printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]-\\n[" 583114402Sru SUP_RAISE_FORMAT "]>?0\n", uid, p->uid, uid); 584114402Sru 585114402Sru return r; 586114402Sru} 587114402Sru 588114402Sruvoid vcenter_box::output() 589114402Sru{ 590114402Sru printf("\\v'-\\n[" SUP_RAISE_FORMAT "]u'", uid); 591114402Sru p->output(); 592114402Sru printf("\\v'\\n[" SUP_RAISE_FORMAT "]u'", uid); 593114402Sru} 594114402Sru 595114402Sruvoid vcenter_box::debug_print() 596114402Sru{ 597114402Sru fprintf(stderr, "vcenter { "); 598114402Sru p->debug_print(); 599114402Sru fprintf(stderr, " }"); 600114402Sru} 601114402Sru 602