589: def techbook_toc(progress = nil)
590: insert_mode :on
591: insert_position :after
592: insert_page 1
593: start_new_page
594:
595: style = H1_STYLE
596: save_state
597:
598: if style[:bar]
599: fill_color style[:background]
600: fh = font_height(style[:font_size]) * 1.01
601: fd = font_descender(style[:font_size]) * 1.01
602: x = absolute_left_margin
603: w = absolute_right_margin - absolute_left_margin
604: rectangle(x, y - fh + fd, w, fh).fill
605: end
606:
607: fill_color style[:foreground]
608: text(@toc_title, :font_size => style[:font_size],
609: :justification => style[:justification])
610:
611: restore_state
612:
613: self.y += font_descender(style[:font_size])
614:
615: right = absolute_right_margin
616:
617:
618: @table_of_contents.each do |entry|
619: progress.inc if progress
620:
621: info = "<c:ilink dest='#{entry[:xref]}'>#{entry[:title]}</c:ilink>"
622: info << "<C:tocdots level='#{entry[:level]}' page='#{entry[:page]}' xref='#{entry[:xref]}'/>"
623:
624: case entry[:level]
625: when 1
626: text info, :font_size => 16, :absolute_right => right
627: when 2
628: text info, :font_size => 12, :left => 50, :absolute_right => right
629: end
630: end
631: end