2000-02-29 11:27:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1994 Paul Vojta. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* NOTE:
|
|
|
|
* xdvi is based on prior work as noted in the modification history, below.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DVI previewer for X.
|
|
|
|
*
|
|
|
|
* Eric Cooper, CMU, September 1985.
|
|
|
|
*
|
|
|
|
* Code derived from dvi-imagen.c.
|
|
|
|
*
|
|
|
|
* Modification history:
|
|
|
|
* 1/1986 Modified for X.10 --Bob Scheifler, MIT LCS.
|
|
|
|
* 7/1988 Modified for X.11 --Mark Eichin, MIT
|
|
|
|
* 12/1988 Added 'R' option, toolkit, magnifying glass
|
|
|
|
* --Paul Vojta, UC Berkeley.
|
|
|
|
* 2/1989 Added tpic support --Jeffrey Lee, U of Toronto
|
|
|
|
* 4/1989 Modified for System V --Donald Richardson, Clarkson Univ.
|
|
|
|
* 3/1990 Added VMS support --Scott Allendorf, U of Iowa
|
|
|
|
* 7/1990 Added reflection mode --Michael Pak, Hebrew U of Jerusalem
|
|
|
|
* 1/1992 Added greyscale code --Till Brychcy, Techn. Univ. Muenchen
|
|
|
|
* and Lee Hetherington, MIT
|
|
|
|
* 4/1994 Added DPS support, bounding box
|
|
|
|
* --Ricardo Telichevesky
|
|
|
|
* and Luis Miguel Silveira, MIT RLE.
|
|
|
|
*/
|
|
|
|
|
2001-10-18 16:40:34 +00:00
|
|
|
//#define DEBUG_RENDER 0
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2000-06-07 01:41:55 +00:00
|
|
|
#include "dviwin.h"
|
2000-02-29 11:27:53 +00:00
|
|
|
#include "dvi.h"
|
2000-11-25 15:31:29 +00:00
|
|
|
#include "fontpool.h"
|
2004-03-29 15:14:35 +00:00
|
|
|
#include "kdvi_multipage.h"
|
2003-04-06 17:32:11 +00:00
|
|
|
#include "performanceMeasurement.h"
|
2003-03-07 11:54:35 +00:00
|
|
|
#include "TeXFont.h"
|
2003-02-05 08:17:23 +00:00
|
|
|
#include "xdvi.h"
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2000-05-26 00:00:15 +00:00
|
|
|
#include <kdebug.h>
|
2001-09-03 08:57:03 +00:00
|
|
|
#include <klocale.h>
|
|
|
|
#include <kmessagebox.h>
|
2000-06-07 01:41:55 +00:00
|
|
|
#include <kprocess.h>
|
2000-02-29 11:27:53 +00:00
|
|
|
#include <qpainter.h>
|
|
|
|
#include <qbitmap.h>
|
|
|
|
#include <qimage.h>
|
|
|
|
#include <qpaintdevice.h>
|
|
|
|
#include <qfileinfo.h>
|
|
|
|
|
2000-06-07 01:41:55 +00:00
|
|
|
extern QPainter foreGroundPaint;
|
2000-02-29 11:27:53 +00:00
|
|
|
|
|
|
|
|
2000-05-27 05:05:03 +00:00
|
|
|
/** Routine to print characters. */
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
2000-06-09 05:31:11 +00:00
|
|
|
#ifdef DEBUG_RENDER
|
2003-03-07 11:54:35 +00:00
|
|
|
kdDebug(4300) << "set_char #" << ch << endl;
|
2000-06-09 05:31:11 +00:00
|
|
|
#endif
|
2000-05-26 00:00:15 +00:00
|
|
|
|
2003-04-01 11:09:15 +00:00
|
|
|
glyph *g;
|
|
|
|
if (colorStack.isEmpty())
|
|
|
|
g = ((TeXFont *)(currinf.fontp->font))->getGlyph(ch, true, globalColor);
|
|
|
|
else
|
|
|
|
g = ((TeXFont *)(currinf.fontp->font))->getGlyph(ch, true, colorStack.top());
|
2000-05-27 05:05:03 +00:00
|
|
|
if (g == NULL)
|
|
|
|
return;
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2003-02-19 12:54:27 +00:00
|
|
|
long dvi_h_sav = currinf.data.dvi_h;
|
2000-06-09 05:31:11 +00:00
|
|
|
|
2003-09-23 07:40:32 +00:00
|
|
|
QPixmap pix = g->shrunkenCharacter;
|
|
|
|
int x = ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536))) - g->x2;
|
|
|
|
int y = currinf.data.pxl_v - g->y2;
|
|
|
|
|
|
|
|
// Draw the character.
|
|
|
|
foreGroundPaint.drawPixmap(x, y, pix);
|
|
|
|
|
|
|
|
// Are we drawing text for a hyperlink? And are hyperlinks
|
|
|
|
// enabled?
|
2004-10-18 15:23:40 +00:00
|
|
|
if (HTML_href != NULL) {
|
2003-09-23 07:40:32 +00:00
|
|
|
// Now set up a rectangle which is checked against every mouse
|
|
|
|
// event.
|
2001-10-27 11:38:16 +00:00
|
|
|
if (line_boundary_encountered == true) {
|
2003-09-23 07:40:32 +00:00
|
|
|
// Set up hyperlink
|
2004-10-23 12:00:07 +00:00
|
|
|
Hyperlink dhl;
|
2003-09-23 07:40:32 +00:00
|
|
|
dhl.baseline = currinf.data.pxl_v;
|
|
|
|
dhl.box.setRect(x, y, pix.width(), pix.height());
|
|
|
|
dhl.linkText = *HTML_href;
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->hyperLinkList.push_back(dhl);
|
2003-08-20 07:04:56 +00:00
|
|
|
} else {
|
2004-04-19 08:19:15 +00:00
|
|
|
QRect dshunion = currentlyDrawnPage->hyperLinkList[currentlyDrawnPage->hyperLinkList.size()-1].box.unite(QRect(x, y, pix.width(), pix.height())) ;
|
|
|
|
currentlyDrawnPage->hyperLinkList[currentlyDrawnPage->hyperLinkList.size()-1].box = dshunion;
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2003-09-23 07:40:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Are we drawing text for a source hyperlink? And are source
|
|
|
|
// hyperlinks enabled?
|
|
|
|
if (source_href != 0) {
|
|
|
|
// Now set up a rectangle which is checked against every mouse
|
|
|
|
// event.
|
|
|
|
if (line_boundary_encountered == true) {
|
|
|
|
// Set up source hyperlinks
|
2004-10-23 12:00:07 +00:00
|
|
|
Hyperlink dhl;
|
2003-09-23 07:40:32 +00:00
|
|
|
dhl.baseline = currinf.data.pxl_v;
|
|
|
|
dhl.box.setRect(x, y, pix.width(), pix.height());
|
|
|
|
if (source_href != NULL)
|
|
|
|
dhl.linkText = *source_href;
|
2001-10-27 11:38:16 +00:00
|
|
|
else
|
2003-09-23 07:40:32 +00:00
|
|
|
dhl.linkText = "";
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->sourceHyperLinkList.push_back(dhl);
|
2003-09-23 07:40:32 +00:00
|
|
|
} else {
|
2004-04-19 08:19:15 +00:00
|
|
|
QRect dshunion = currentlyDrawnPage->sourceHyperLinkList[currentlyDrawnPage->sourceHyperLinkList.size()-1].box.unite(QRect(x, y, pix.width(), pix.height())) ;
|
|
|
|
currentlyDrawnPage->sourceHyperLinkList[currentlyDrawnPage->sourceHyperLinkList.size()-1].box = dshunion;
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2000-06-09 05:31:11 +00:00
|
|
|
}
|
2003-09-23 07:40:32 +00:00
|
|
|
|
|
|
|
// Code for DVI -> text functions (e.g. marking of text, full text
|
2004-04-19 08:19:15 +00:00
|
|
|
// search, etc.). Set up the currentlyDrawnPage->textLinkList.
|
2003-09-23 07:40:32 +00:00
|
|
|
if (line_boundary_encountered == true) {
|
|
|
|
// Set up source hyperlinks
|
2004-10-23 12:00:07 +00:00
|
|
|
Hyperlink link;
|
2003-09-23 07:40:32 +00:00
|
|
|
link.baseline = currinf.data.pxl_v;
|
|
|
|
link.box.setRect(x, y, pix.width(), pix.height());
|
|
|
|
link.linkText = "";
|
|
|
|
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList.push_back(link);
|
2003-09-23 07:40:32 +00:00
|
|
|
} else {
|
|
|
|
// line boundary encountered
|
2004-04-19 08:19:15 +00:00
|
|
|
QRect dshunion = currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].box.unite(QRect(x, y, pix.width(), pix.height())) ;
|
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].box = dshunion;
|
2003-09-23 07:40:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(ch) {
|
|
|
|
case 0x0b:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "ff";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x0c:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "fi";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x0d:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "fl";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x0e:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "ffi";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x0f:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "ffl";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x7b:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "-";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x7c:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "---";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x7d:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "\"";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x7e:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "~";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
case 0x7f:
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "@@"; // @@@ check!
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ((ch >= 0x21) && (ch <= 0x7a))
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += QChar(ch);
|
2003-09-23 07:40:32 +00:00
|
|
|
else
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += "?";
|
2003-09-23 07:40:32 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
if (cmd == PUT1)
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_h = dvi_h_sav;
|
2000-02-29 11:27:53 +00:00
|
|
|
else
|
2004-05-03 20:52:54 +00:00
|
|
|
currinf.data.dvi_h += (int)(currinf.fontp->scaled_size_in_DVI_units * dviFile->getCmPerDVIunit() *
|
|
|
|
(MFResolutions[font_pool.getMetafontMode()] / 2.54)/16.0 * g->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
|
2001-07-06 10:14:01 +00:00
|
|
|
|
|
|
|
word_boundary_encountered = false;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = false;
|
2000-02-29 11:27:53 +00:00
|
|
|
}
|
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::set_empty_char(unsigned int, unsigned int)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::set_vf_char(unsigned int cmd, unsigned int ch)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
2000-06-09 05:31:11 +00:00
|
|
|
#ifdef DEBUG_RENDER
|
2004-11-15 07:17:50 +00:00
|
|
|
kdDebug(4300) << "dviRenderer::set_vf_char( cmd=" << cmd << ", ch=" << ch << " )" << endl;
|
2000-06-09 05:31:11 +00:00
|
|
|
#endif
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2000-05-26 00:00:15 +00:00
|
|
|
static unsigned char c;
|
2001-10-18 16:40:34 +00:00
|
|
|
macro *m = &currinf.fontp->macrotable[ch];
|
|
|
|
if (m->pos == NULL) {
|
2003-08-20 07:04:56 +00:00
|
|
|
kdError(4300) << "Character " << ch << " not defined in font " << currinf.fontp->fontname << endl;
|
2000-02-29 11:27:53 +00:00
|
|
|
m->pos = m->end = &c;
|
2000-05-27 05:05:03 +00:00
|
|
|
return;
|
2000-02-29 11:27:53 +00:00
|
|
|
}
|
|
|
|
|
2003-02-19 12:54:27 +00:00
|
|
|
long dvi_h_sav = currinf.data.dvi_h;
|
2000-05-26 00:00:15 +00:00
|
|
|
|
2003-09-23 07:40:32 +00:00
|
|
|
struct drawinf oldinfo = currinf;
|
|
|
|
currinf.data.w = 0;
|
|
|
|
currinf.data.x = 0;
|
|
|
|
currinf.data.y = 0;
|
|
|
|
currinf.data.z = 0;
|
|
|
|
|
|
|
|
currinf.fonttable = &(currinf.fontp->vf_table);
|
|
|
|
currinf._virtual = currinf.fontp;
|
|
|
|
Q_UINT8 *command_ptr_sav = command_pointer;
|
|
|
|
Q_UINT8 *end_ptr_sav = end_pointer;
|
|
|
|
command_pointer = m->pos;
|
|
|
|
end_pointer = m->end;
|
2004-05-03 20:52:54 +00:00
|
|
|
draw_part(currinf.fontp->scaled_size_in_DVI_units*(dviFile->getCmPerDVIunit() * MFResolutions[font_pool.getMetafontMode()] / 2.54)/16.0, true);
|
2003-09-23 07:40:32 +00:00
|
|
|
command_pointer = command_ptr_sav;
|
|
|
|
end_pointer = end_ptr_sav;
|
|
|
|
currinf = oldinfo;
|
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
if (cmd == PUT1)
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_h = dvi_h_sav;
|
2000-02-29 11:27:53 +00:00
|
|
|
else
|
2004-05-03 20:52:54 +00:00
|
|
|
currinf.data.dvi_h += (int)(currinf.fontp->scaled_size_in_DVI_units * dviFile->getCmPerDVIunit() *
|
|
|
|
(MFResolutions[font_pool.getMetafontMode()] / 2.54)/16.0 * m->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
|
2000-02-29 11:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::set_no_char(unsigned int cmd, unsigned int ch)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
2000-06-09 05:31:11 +00:00
|
|
|
#ifdef DEBUG_RENDER
|
2004-11-15 07:17:50 +00:00
|
|
|
kdDebug(4300) << "dviRenderer::set_no_char( cmd=" << cmd << ", ch =" << ch << " )" << endl;
|
2000-06-09 05:31:11 +00:00
|
|
|
#endif
|
2003-08-20 07:04:56 +00:00
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
if (currinf._virtual) {
|
|
|
|
currinf.fontp = currinf._virtual->first_font;
|
|
|
|
if (currinf.fontp != NULL) {
|
|
|
|
currinf.set_char_p = currinf.fontp->set_char_p;
|
2000-06-09 05:31:11 +00:00
|
|
|
(this->*currinf.set_char_p)(cmd, ch);
|
2000-02-29 11:27:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2001-11-01 09:53:31 +00:00
|
|
|
|
2004-06-26 10:13:01 +00:00
|
|
|
errorMsg = i18n("The DVI code set a character of an unknown font.");
|
2001-11-01 09:53:31 +00:00
|
|
|
return;
|
2000-02-29 11:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
2000-06-09 05:31:11 +00:00
|
|
|
#ifdef DEBUG_RENDER
|
2003-02-19 12:54:27 +00:00
|
|
|
kdDebug(4300) << "draw_part" << endl;
|
2000-06-09 05:31:11 +00:00
|
|
|
#endif
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2003-02-13 04:59:49 +00:00
|
|
|
Q_INT32 RRtmp=0, WWtmp=0, XXtmp=0, YYtmp=0, ZZtmp=0;
|
2001-10-12 01:32:07 +00:00
|
|
|
Q_UINT8 ch;
|
2000-02-29 11:27:53 +00:00
|
|
|
|
2000-06-07 01:41:55 +00:00
|
|
|
currinf.fontp = NULL;
|
2004-11-15 07:17:50 +00:00
|
|
|
currinf.set_char_p = &dviRenderer::set_no_char;
|
2000-02-29 11:27:53 +00:00
|
|
|
|
|
|
|
for (;;) {
|
2001-10-18 16:40:34 +00:00
|
|
|
ch = readUINT8();
|
|
|
|
if (ch <= (unsigned char) (SETCHAR0 + 127)) {
|
2000-06-09 05:31:11 +00:00
|
|
|
(this->*currinf.set_char_p)(ch, ch);
|
2001-10-18 16:40:34 +00:00
|
|
|
} else
|
2001-11-01 09:53:31 +00:00
|
|
|
if (FNTNUM0 <= ch && ch <= (unsigned char) (FNTNUM0 + 63)) {
|
2003-04-27 15:58:38 +00:00
|
|
|
currinf.fontp = currinf.fonttable->find(ch - FNTNUM0);
|
2001-11-01 09:53:31 +00:00
|
|
|
if (currinf.fontp == NULL) {
|
|
|
|
errorMsg = i18n("The DVI code referred to font #%1, which was not previously defined.").arg(ch - FNTNUM0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
currinf.set_char_p = currinf.fontp->set_char_p;
|
|
|
|
} else {
|
2001-10-12 01:32:07 +00:00
|
|
|
Q_INT32 a, b;
|
2000-02-29 11:27:53 +00:00
|
|
|
|
|
|
|
switch (ch) {
|
|
|
|
case SET1:
|
|
|
|
case PUT1:
|
2001-10-18 16:40:34 +00:00
|
|
|
(this->*currinf.set_char_p)(ch, readUINT8());
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SETRULE:
|
2001-10-27 11:38:16 +00:00
|
|
|
if (is_vfmacro == false) {
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
|
|
|
}
|
2001-08-09 07:35:46 +00:00
|
|
|
/* Be careful, dvicopy outputs rules with height =
|
|
|
|
0x80000000. We don't want any SIGFPE here. */
|
2001-10-18 16:40:34 +00:00
|
|
|
a = readUINT32();
|
|
|
|
b = readUINT32();
|
2003-02-19 12:54:27 +00:00
|
|
|
b = ((long) (b * current_dimconv));
|
2003-09-23 07:40:32 +00:00
|
|
|
if (a > 0 && b > 0) {
|
2003-03-07 11:54:35 +00:00
|
|
|
int h = ((int) ROUNDUP(((long) (a * current_dimconv)), shrinkfactor * 65536));
|
|
|
|
int w = ((int) ROUNDUP(b, shrinkfactor * 65536));
|
2004-02-15 21:00:48 +00:00
|
|
|
|
|
|
|
if (colorStack.isEmpty())
|
|
|
|
foreGroundPaint.fillRect( ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536))),
|
|
|
|
currinf.data.pxl_v - h + 1, w?w:1, h?h:1, globalColor );
|
|
|
|
else
|
|
|
|
foreGroundPaint.fillRect( ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536))),
|
|
|
|
currinf.data.pxl_v - h + 1, w?w:1, h?h:1, colorStack.top() );
|
2003-02-19 12:54:27 +00:00
|
|
|
}
|
|
|
|
currinf.data.dvi_h += b;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PUTRULE:
|
2001-10-27 11:38:16 +00:00
|
|
|
if (is_vfmacro == false) {
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
|
|
|
}
|
2001-10-18 16:40:34 +00:00
|
|
|
a = readUINT32();
|
|
|
|
b = readUINT32();
|
2003-02-19 12:54:27 +00:00
|
|
|
a = ((long) (a * current_dimconv));
|
|
|
|
b = ((long) (b * current_dimconv));
|
2003-09-23 07:40:32 +00:00
|
|
|
if (a > 0 && b > 0) {
|
2003-03-07 11:54:35 +00:00
|
|
|
int h = ((int) ROUNDUP(a, shrinkfactor * 65536));
|
|
|
|
int w = ((int) ROUNDUP(b, shrinkfactor * 65536));
|
2004-02-15 21:00:48 +00:00
|
|
|
if (colorStack.isEmpty())
|
|
|
|
foreGroundPaint.fillRect( ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536))),
|
|
|
|
currinf.data.pxl_v - h + 1, w?w:1, h?h:1, globalColor );
|
|
|
|
else
|
|
|
|
foreGroundPaint.fillRect( ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536))),
|
|
|
|
currinf.data.pxl_v - h + 1, w?w:1, h?h:1, colorStack.top() );
|
2003-02-19 12:54:27 +00:00
|
|
|
}
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NOP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOP:
|
2001-10-27 11:38:16 +00:00
|
|
|
if (is_vfmacro == false) {
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
|
|
|
}
|
2001-10-18 16:40:34 +00:00
|
|
|
command_pointer += 11 * 4;
|
2004-05-03 20:52:54 +00:00
|
|
|
currinf.data.dvi_h = MFResolutions[font_pool.getMetafontMode()] << 16; // Reminder: DVI-coordinates start at (1",1") from top of page
|
|
|
|
currinf.data.dvi_v = MFResolutions[font_pool.getMetafontMode()];
|
2003-03-07 11:54:35 +00:00
|
|
|
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.w = currinf.data.x = currinf.data.y = currinf.data.z = 0;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EOP:
|
2001-08-09 07:35:46 +00:00
|
|
|
// Check if we are just at the end of a virtual font macro.
|
|
|
|
if (is_vfmacro == false) {
|
|
|
|
// This is really the end of a page, and not just the end
|
|
|
|
// of a macro. Mark the end of the current word.
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
2001-08-09 07:35:46 +00:00
|
|
|
// Sanity check for the dvi-file: The DVI-standard asserts
|
|
|
|
// that at the end of a page, the stack should always be
|
|
|
|
// empty.
|
2001-11-01 09:53:31 +00:00
|
|
|
if (!stack.isEmpty()) {
|
2003-09-05 08:57:37 +00:00
|
|
|
kdDebug(4300) << "DRAW: The stack was not empty when the EOP command was encountered." << endl;
|
2001-11-01 09:53:31 +00:00
|
|
|
errorMsg = i18n("The stack was not empty when the EOP command was encountered.");
|
|
|
|
return;
|
|
|
|
}
|
2001-08-09 07:35:46 +00:00
|
|
|
}
|
2000-02-29 11:27:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case PUSH:
|
2001-08-09 07:35:46 +00:00
|
|
|
stack.push(currinf.data);
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case POP:
|
2001-11-01 09:53:31 +00:00
|
|
|
if (stack.isEmpty()) {
|
|
|
|
errorMsg = i18n("The stack was empty when a POP command was encountered.");
|
|
|
|
return;
|
|
|
|
} else
|
2001-08-09 07:35:46 +00:00
|
|
|
currinf.data = stack.pop();
|
2002-01-02 13:38:46 +00:00
|
|
|
word_boundary_encountered = true;
|
|
|
|
line_boundary_encountered = true;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RIGHT1:
|
|
|
|
case RIGHT2:
|
|
|
|
case RIGHT3:
|
|
|
|
case RIGHT4:
|
2001-10-27 11:38:16 +00:00
|
|
|
RRtmp = readINT(ch - RIGHT1 + 1);
|
|
|
|
|
|
|
|
// A horizontal motion in the range 4 * font space [f] < h <
|
|
|
|
// font space [f] will be treated as a kern that is not
|
|
|
|
// indicated in the printouts that DVItype produces between
|
|
|
|
// brackets. We allow a larger space in the negative
|
|
|
|
// direction than in the positive one, because TEX makes
|
|
|
|
// comparatively large backspaces when it positions
|
|
|
|
// accents. (comments stolen from the source of dvitype)
|
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
((RRtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (RRtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0))
|
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += ' ';
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_h += ((long) (RRtmp * current_dimconv));
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
2001-10-27 11:38:16 +00:00
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
case W1:
|
|
|
|
case W2:
|
|
|
|
case W3:
|
|
|
|
case W4:
|
2001-10-27 11:38:16 +00:00
|
|
|
WWtmp = readINT(ch - W0);
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.w = ((long) (WWtmp * current_dimconv));
|
2000-02-29 11:27:53 +00:00
|
|
|
case W0:
|
2001-10-27 11:38:16 +00:00
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
((WWtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (WWtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0) )
|
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += ' ';
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_h += currinf.data.w;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case X1:
|
|
|
|
case X2:
|
|
|
|
case X3:
|
|
|
|
case X4:
|
2001-10-27 11:38:16 +00:00
|
|
|
XXtmp = readINT(ch - X0);
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.x = ((long) (XXtmp * current_dimconv));
|
2000-02-29 11:27:53 +00:00
|
|
|
case X0:
|
2001-10-27 11:38:16 +00:00
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
((XXtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (XXtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0))
|
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += ' ';
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_h += currinf.data.x;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
2001-10-27 11:38:16 +00:00
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
case DOWN1:
|
|
|
|
case DOWN2:
|
|
|
|
case DOWN3:
|
|
|
|
case DOWN4:
|
2001-10-27 11:38:16 +00:00
|
|
|
{
|
|
|
|
Q_INT32 DDtmp = readINT(ch - DOWN1 + 1);
|
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
(abs(DDtmp) >= 5*(currinf.fontp->scaled_size_in_DVI_units/6)) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0)) {
|
2001-10-27 11:38:16 +00:00
|
|
|
word_boundary_encountered = true;
|
|
|
|
line_boundary_encountered = true;
|
2003-02-28 08:27:07 +00:00
|
|
|
if (abs(DDtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += '\n';
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_v += ((long) (DDtmp * current_dimconv))/65536;
|
2003-03-07 11:54:35 +00:00
|
|
|
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
2001-10-27 11:38:16 +00:00
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
case Y1:
|
|
|
|
case Y2:
|
|
|
|
case Y3:
|
|
|
|
case Y4:
|
2001-10-27 11:38:16 +00:00
|
|
|
YYtmp = readINT(ch - Y0);
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.y = ((long) (YYtmp * current_dimconv));
|
2000-02-29 11:27:53 +00:00
|
|
|
case Y0:
|
2001-10-27 11:38:16 +00:00
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
(abs(YYtmp) >= 5*(currinf.fontp->scaled_size_in_DVI_units/6)) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0)) {
|
2001-10-27 11:38:16 +00:00
|
|
|
word_boundary_encountered = true;
|
|
|
|
line_boundary_encountered = true;
|
2003-02-28 08:27:07 +00:00
|
|
|
if (abs(YYtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += '\n';
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_v += currinf.data.y/65536;
|
2003-03-07 11:54:35 +00:00
|
|
|
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
2001-10-27 11:38:16 +00:00
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
case Z1:
|
|
|
|
case Z2:
|
|
|
|
case Z3:
|
|
|
|
case Z4:
|
2001-10-27 11:38:16 +00:00
|
|
|
ZZtmp = readINT(ch - Z0);
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.z = ((long) (ZZtmp * current_dimconv));
|
2000-02-29 11:27:53 +00:00
|
|
|
case Z0:
|
2001-10-27 11:38:16 +00:00
|
|
|
if ((is_vfmacro == false) &&
|
|
|
|
(currinf.fontp != 0) &&
|
2003-02-28 08:27:07 +00:00
|
|
|
(abs(ZZtmp) >= 5*(currinf.fontp->scaled_size_in_DVI_units/6)) &&
|
2004-04-19 08:19:15 +00:00
|
|
|
(currentlyDrawnPage->textLinkList.size() > 0)) {
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
2003-02-28 08:27:07 +00:00
|
|
|
if (abs(ZZtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList[currentlyDrawnPage->textLinkList.size()-1].linkText += '\n';
|
2001-10-27 11:38:16 +00:00
|
|
|
}
|
2003-02-19 12:54:27 +00:00
|
|
|
currinf.data.dvi_v += currinf.data.z/65536;
|
2003-03-07 11:54:35 +00:00
|
|
|
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FNT1:
|
|
|
|
case FNT2:
|
|
|
|
case FNT3:
|
2003-04-27 15:58:38 +00:00
|
|
|
currinf.fontp = currinf.fonttable->find(readUINT(ch - FNT1 + 1));
|
2001-11-01 09:53:31 +00:00
|
|
|
if (currinf.fontp == NULL) {
|
|
|
|
errorMsg = i18n("The DVI code referred to a font which was not previously defined.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
currinf.set_char_p = currinf.fontp->set_char_p;
|
2001-10-18 16:40:34 +00:00
|
|
|
break;
|
|
|
|
|
2000-02-29 11:27:53 +00:00
|
|
|
case FNT4:
|
2003-04-27 15:58:38 +00:00
|
|
|
currinf.fontp = currinf.fonttable->find(readINT(ch - FNT1 + 1));
|
2001-11-01 09:53:31 +00:00
|
|
|
if (currinf.fontp == NULL) {
|
|
|
|
errorMsg = i18n("The DVI code referred to a font which was not previously defined.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
currinf.set_char_p = currinf.fontp->set_char_p;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XXX1:
|
|
|
|
case XXX2:
|
|
|
|
case XXX3:
|
|
|
|
case XXX4:
|
2001-10-27 11:38:16 +00:00
|
|
|
if (is_vfmacro == false) {
|
2001-07-06 10:14:01 +00:00
|
|
|
word_boundary_encountered = true;
|
2001-10-27 11:38:16 +00:00
|
|
|
line_boundary_encountered = true;
|
|
|
|
}
|
2001-10-18 16:40:34 +00:00
|
|
|
a = readUINT(ch - XXX1 + 1);
|
|
|
|
if (a > 0) {
|
|
|
|
char *cmd = new char[a+1];
|
|
|
|
strncpy(cmd, (char *)command_pointer, a);
|
|
|
|
command_pointer += a;
|
|
|
|
cmd[a] = '\0';
|
|
|
|
applicationDoSpecial(cmd);
|
|
|
|
delete [] cmd;
|
|
|
|
}
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FNTDEF1:
|
|
|
|
case FNTDEF2:
|
|
|
|
case FNTDEF3:
|
|
|
|
case FNTDEF4:
|
2001-10-27 11:38:16 +00:00
|
|
|
command_pointer += 12 + ch - FNTDEF1 + 1;
|
|
|
|
command_pointer += readUINT8() + readUINT8();
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PRE:
|
|
|
|
case POST:
|
|
|
|
case POSTPOST:
|
2001-11-01 09:53:31 +00:00
|
|
|
errorMsg = i18n("An illegal command was encountered.");
|
|
|
|
return;
|
2000-02-29 11:27:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2001-11-01 09:53:31 +00:00
|
|
|
errorMsg = i18n("The unknown op-code %1 was encountered.").arg(ch);
|
|
|
|
return;
|
2000-02-29 11:27:53 +00:00
|
|
|
} /* end switch*/
|
|
|
|
} /* end else (ch not a SETCHAR or FNTNUM) */
|
|
|
|
} /* end for */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-15 07:17:50 +00:00
|
|
|
void dviRenderer::draw_page(void)
|
2000-02-29 11:27:53 +00:00
|
|
|
{
|
2001-09-03 08:57:03 +00:00
|
|
|
// Reset a couple of variables
|
2003-07-22 07:02:42 +00:00
|
|
|
HTML_href = 0;
|
|
|
|
source_href = 0;
|
|
|
|
penWidth_in_mInch = 0.0;
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->hyperLinkList.clear();
|
2003-04-18 11:17:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Calling resize() here rather than clear() means that the memory
|
|
|
|
// taken up by the vector is not freed. This is faster than
|
|
|
|
// constantly allocating/freeing memory.
|
2004-04-19 08:19:15 +00:00
|
|
|
currentlyDrawnPage->textLinkList.resize(0);
|
|
|
|
currentlyDrawnPage->sourceHyperLinkList.resize(0);
|
2001-09-03 08:57:03 +00:00
|
|
|
|
2003-04-06 17:32:11 +00:00
|
|
|
#ifdef PERFORMANCE_MEASUREMENT
|
|
|
|
// If this is the first time a page is drawn, take the time that is
|
|
|
|
// elapsed till the kdvi_multipage was constructed, and print
|
|
|
|
// it. Set the flag so that is message will not be printed again.
|
|
|
|
if (performanceFlag == 0) {
|
|
|
|
kdDebug(4300) << "Time elapsed till the first page is drawn: " << performanceTimer.restart() << "ms" << endl;
|
|
|
|
performanceFlag = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-06-09 05:31:11 +00:00
|
|
|
#ifdef DEBUG_RENDER
|
2004-03-14 13:01:41 +00:00
|
|
|
kdDebug(4300) <<"draw_page" << endl;
|
2000-06-09 05:31:11 +00:00
|
|
|
#endif
|
2000-03-21 12:36:34 +00:00
|
|
|
|
2004-12-01 18:13:55 +00:00
|
|
|
foreGroundPaint.fillRect( foreGroundPaint.viewport(), PS_interface->getBackgroundColor(current_page) );
|
2003-04-06 17:32:11 +00:00
|
|
|
|
2000-06-23 00:22:44 +00:00
|
|
|
// Render the PostScript background, if there is one.
|
|
|
|
if (_postscript) {
|
2004-12-12 13:44:38 +00:00
|
|
|
kdError() << "Trying to render PS: TODO" << endl;
|
|
|
|
QPixmap *pxm = PS_interface->graphics(current_page, resolutionInDPI, foreGroundPaint.viewport().width(), foreGroundPaint.viewport().height() );
|
2000-06-23 00:22:44 +00:00
|
|
|
if (pxm != NULL) {
|
|
|
|
foreGroundPaint.drawPixmap(0, 0, *pxm);
|
|
|
|
delete pxm;
|
2001-03-15 15:11:36 +00:00
|
|
|
}
|
2004-12-12 13:44:38 +00:00
|
|
|
} else
|
|
|
|
kdError() << "Trying to not render PS" << endl;
|
2001-10-18 16:40:34 +00:00
|
|
|
|
2001-07-06 10:14:01 +00:00
|
|
|
// Now really write the text
|
2004-08-22 17:39:15 +00:00
|
|
|
if (dviFile->page_offset.isEmpty() == true)
|
2001-10-18 16:40:34 +00:00
|
|
|
return;
|
2004-05-03 20:52:54 +00:00
|
|
|
if (current_page < dviFile->total_pages) {
|
2004-08-22 17:39:15 +00:00
|
|
|
command_pointer = dviFile->dvi_Data() + dviFile->page_offset[current_page];
|
|
|
|
end_pointer = dviFile->dvi_Data() + dviFile->page_offset[current_page+1];
|
2001-10-18 16:40:34 +00:00
|
|
|
} else
|
|
|
|
command_pointer = end_pointer = 0;
|
|
|
|
|
2000-07-24 21:21:21 +00:00
|
|
|
memset((char *) &currinf.data, 0, sizeof(currinf.data));
|
2004-05-03 20:52:54 +00:00
|
|
|
currinf.fonttable = &(dviFile->tn_table);
|
2001-09-03 08:57:03 +00:00
|
|
|
currinf._virtual = 0;
|
2004-03-29 15:14:35 +00:00
|
|
|
|
2004-05-03 20:52:54 +00:00
|
|
|
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() *
|
|
|
|
MFResolutions[font_pool.getMetafontMode()]/2.54;
|
2004-03-29 15:14:35 +00:00
|
|
|
|
|
|
|
draw_part(65536.0*fontPixelPerDVIunit, false);
|
2001-09-03 08:57:03 +00:00
|
|
|
if (HTML_href != 0) {
|
2000-06-09 05:31:11 +00:00
|
|
|
delete HTML_href;
|
2001-09-03 08:57:03 +00:00
|
|
|
HTML_href = 0;
|
|
|
|
}
|
|
|
|
if (source_href != 0) {
|
|
|
|
delete source_href;
|
|
|
|
source_href = 0;
|
2000-06-09 05:31:11 +00:00
|
|
|
}
|
2001-07-06 10:14:01 +00:00
|
|
|
|
|
|
|
// Mark hyperlinks in blue. We draw a blue line under the
|
|
|
|
// character whose width is equivalent to 0.5 mm, but at least
|
|
|
|
// one pixel.
|
2004-05-03 20:52:54 +00:00
|
|
|
int h = (int)(MFResolutions[font_pool.getMetafontMode()]*0.05/(2.54*shrinkfactor) + 0.5);
|
2001-07-06 10:14:01 +00:00
|
|
|
h = (h < 1) ? 1 : h;
|
2004-04-19 08:19:15 +00:00
|
|
|
for(unsigned int i=0; i<currentlyDrawnPage->hyperLinkList.size(); i++) {
|
|
|
|
int x = currentlyDrawnPage->hyperLinkList[i].box.left();
|
|
|
|
int w = currentlyDrawnPage->hyperLinkList[i].box.width();
|
|
|
|
int y = currentlyDrawnPage->hyperLinkList[i].baseline;
|
2001-07-06 10:14:01 +00:00
|
|
|
foreGroundPaint.fillRect(x, y, w, h, Qt::blue);
|
|
|
|
}
|
2000-02-29 11:27:53 +00:00
|
|
|
}
|