removes rarely used configuration option

svn path=/trunk/kdegraphics/kdvi/; revision=381851
This commit is contained in:
Stefan Kebekus 2005-01-24 07:08:35 +00:00
parent b6aa5fd5da
commit 5d41aeadbd
11 changed files with 42 additions and 135 deletions

View file

@ -161,7 +161,7 @@ glyph *TeXFont_PK::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, QColor co
((g->shrunkenCharacter.isNull()) || (color != g->color)) &&
(characterBitmaps[ch]->w != 0)) {
g->color = color;
double shrinkFactor = MFResolutions[parent->font_pool->getMetafontMode()] / parent->displayResolution_in_dpi;
double shrinkFactor = 1200 / parent->displayResolution_in_dpi;
// All is fine? Then we rescale the bitmap in order to produce the
// required pixmap. Rescaling a character, however, is an art

View file

@ -113,12 +113,11 @@ dviRenderer::~dviRenderer()
}
void dviRenderer::setPrefs(bool flag_showPS, const QString &str_editorCommand,
unsigned int MetaFontMode, bool useFontHints )
void dviRenderer::setPrefs(bool flag_showPS, const QString &str_editorCommand, bool useFontHints )
{
_postscript = flag_showPS;
editorCommand = str_editorCommand;
font_pool.setParameters(MetaFontMode, useFontHints );
font_pool.setParameters( useFontHints );
emit(needsRepainting());
}
@ -168,7 +167,7 @@ void dviRenderer::drawPage(double resolution, documentPage *page)
setResolution(resolution);
currentlyDrawnPage = page;
shrinkfactor = MFResolutions[font_pool.getMetafontMode()]/resolutionInDPI;
shrinkfactor = 1200/resolutionInDPI;
current_page = page->getPageNumber()-1;
@ -632,7 +631,7 @@ void dviRenderer::setResolution(double resolution_in_DPI)
// Pass the information on to the font pool.
font_pool.setDisplayResolution( resolutionInDPI );
shrinkfactor = MFResolutions[font_pool.getMetafontMode()]/(resolutionInDPI);
shrinkfactor = 1200/resolutionInDPI;
return;
}

View file

@ -100,8 +100,7 @@ public:
class dvifile *dviFile;
void setPrefs(bool flag_showPS, const QString &editorCommand,
unsigned int MetaFontMode, bool useFontHints );
void setPrefs(bool flag_showPS, const QString &editorCommand, bool useFontHints );
virtual bool supportsTextSearch(void) {return true;};

View file

@ -198,7 +198,7 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
currinf.data.dvi_h = dvi_h_sav;
else
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);
(1200.0 / 2.54)/16.0 * g->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
word_boundary_encountered = false;
line_boundary_encountered = false;
@ -237,7 +237,7 @@ void dviRenderer::set_vf_char(unsigned int cmd, unsigned int ch)
Q_UINT8 *end_ptr_sav = end_pointer;
command_pointer = m->pos;
end_pointer = m->end;
draw_part(currinf.fontp->scaled_size_in_DVI_units*(dviFile->getCmPerDVIunit() * MFResolutions[font_pool.getMetafontMode()] / 2.54)/16.0, true);
draw_part(currinf.fontp->scaled_size_in_DVI_units*(dviFile->getCmPerDVIunit() * 1200.0 / 2.54)/16.0, true);
command_pointer = command_ptr_sav;
end_pointer = end_ptr_sav;
currinf = oldinfo;
@ -246,7 +246,7 @@ void dviRenderer::set_vf_char(unsigned int cmd, unsigned int ch)
currinf.data.dvi_h = dvi_h_sav;
else
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);
(1200.0 / 2.54)/16.0 * m->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
}
@ -357,8 +357,8 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
line_boundary_encountered = true;
}
command_pointer += 11 * 4;
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()];
currinf.data.dvi_h = 1200 << 16; // Reminder: DVI-coordinates start at (1",1") from top of page
currinf.data.dvi_v = 1200;
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
currinf.data.w = currinf.data.x = currinf.data.y = currinf.data.z = 0;
break;
@ -618,8 +618,7 @@ void dviRenderer::draw_page(void)
currinf.fonttable = &(dviFile->tn_table);
currinf._virtual = 0;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() *
MFResolutions[font_pool.getMetafontMode()]/2.54;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * 1200.0/2.54;
draw_part(65536.0*fontPixelPerDVIunit, false);
if (HTML_href != 0) {

View file

@ -293,8 +293,8 @@ void dviRenderer::prescan_ParsePSQuoteSpecial(QString cp)
#endif
double PS_H = (currinf.data.dvi_h*300.0)/(65536*MFResolutions[font_pool.getMetafontMode()])-300;
double PS_V = (currinf.data.dvi_v*300.0)/MFResolutions[font_pool.getMetafontMode()] - 300;
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
PostScriptOutPutString->append( " @beginspecial @setspecial \n" );
PostScriptOutPutString->append( cp );
@ -338,8 +338,8 @@ void dviRenderer::prescan_ParsePSSpecial(QString cp)
}
double PS_H = (currinf.data.dvi_h*300.0)/(65536*MFResolutions[font_pool.getMetafontMode()])-300;
double PS_V = (currinf.data.dvi_v*300.0)/MFResolutions[font_pool.getMetafontMode()] - 300;
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
if (cp.find("ps::[begin]", 0, false) == 0) {
PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
@ -419,8 +419,8 @@ void dviRenderer::prescan_ParsePSFileSpecial(QString cp)
if (QFile::exists(EPSfilename)) {
double PS_H = (currinf.data.dvi_h*300.0)/(65536*MFResolutions[font_pool.getMetafontMode()])-300;
double PS_V = (currinf.data.dvi_v*300.0)/MFResolutions[font_pool.getMetafontMode()] - 300;
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
PostScriptOutPutString->append( "@beginspecial " );
PostScriptOutPutString->append( QString(" %1 @llx").arg(llx) );
@ -547,7 +547,7 @@ void dviRenderer::prescan_setChar(unsigned int ch)
if (g == NULL)
return;
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);
(1200.0 / 2.54)/16.0 * g->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
return;
}
@ -556,7 +556,7 @@ void dviRenderer::prescan_setChar(unsigned int ch)
if (m->pos == NULL)
return;
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);
(1200.0 / 2.54)/16.0 * m->dvi_advance_in_units_of_design_size_by_2e20 + 0.5);
return;
}
}
@ -573,8 +573,7 @@ void dviRenderer::prescan(parseSpecials specialParser)
Q_INT32 RRtmp=0, WWtmp=0, XXtmp=0, YYtmp=0, ZZtmp=0;
Q_UINT8 ch;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() *
MFResolutions[font_pool.getMetafontMode()]/2.54;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * 1200.0/2.54;
stack.clear();
@ -627,8 +626,8 @@ void dviRenderer::prescan(parseSpecials specialParser)
case BOP:
command_pointer += 11 * 4;
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()];
currinf.data.dvi_h = 1200 << 16; // Reminder: DVI-coordinates start at (1",1") from top of page
currinf.data.dvi_v = 1200;
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
currinf.data.w = currinf.data.x = currinf.data.y = currinf.data.z = 0;
break;

View file

@ -29,9 +29,9 @@
// List of permissible MetaFontModes which are supported by kdvi.
const char *MFModes[] = { "cx", "ljfour", "lexmarks" };
const char *MFModenames[] = { "Canon CX", "LaserJet 4", "Lexmark S" };
const int MFResolutions[] = { 300, 600, 1200 };
//const char *MFModes[] = { "cx", "ljfour", "lexmarks" };
//const char *MFModenames[] = { "Canon CX", "LaserJet 4", "Lexmark S" };
//const int MFResolutions[] = { 300, 600, 1200 };
#ifdef PERFORMANCE_MEASUREMENT
QTime fontPoolTimer;
@ -57,7 +57,6 @@ fontPool::fontPool(void)
setName("Font Pool");
displayResolution_in_dpi = 100.0; // A not-too-bad-default
MetafontMode = DefaultMFMode;
useFontHints = true;
CMperDVIunit = 0;
extraSearchPath = QString::null;
@ -118,28 +117,8 @@ fontPool::~fontPool(void)
}
void fontPool::setParameters( unsigned int _metafontMode, bool _useFontHints )
void fontPool::setParameters( bool _useFontHints )
{
if (_metafontMode >= NumberOfMFModes) {
kdError(4300) << "fontPool::setMetafontMode called with argument " << _metafontMode
<< " which is more than the allowed value of " << NumberOfMFModes-1 << endl;
kdError(4300) << "setting mode to " << MFModes[DefaultMFMode] << " at "
<< MFResolutions[DefaultMFMode] << "dpi" << endl;
_metafontMode = DefaultMFMode;
}
bool kpsewhichNeeded = false;
// Check if a new run of kpsewhich is required
if (_metafontMode != MetafontMode) {
TeXFontDefinition *fontp = fontList.first();
while(fontp != 0 ) {
fontp->reset();
fontp = fontList.next();
}
kpsewhichNeeded = true;
}
// Check if glyphs need to be cleared
if (_useFontHints != useFontHints) {
double displayResolution = displayResolution_in_dpi;
@ -150,12 +129,7 @@ void fontPool::setParameters( unsigned int _metafontMode, bool _useFontHints )
}
}
MetafontMode = _metafontMode;
useFontHints = _useFontHints;
// Initiate a new concurrently running process of kpsewhich, if
// necessary. Otherwise, let the dvi window be redrawn
locateFonts();
}
@ -314,16 +288,6 @@ void fontPool::locateFonts(void)
void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFound)
{
// Just make sure that MetafontMode is in the permissible range, so
// as to avoid segfaults.
if (MetafontMode >= NumberOfMFModes) {
kdError(4300) << "fontPool::locateFonts called with bad MetafontMode " << MetafontMode
<< " which is more than the allowed value of " << NumberOfMFModes-1 << endl
<< "setting mode to " << MFModes[DefaultMFMode] << " at "
<< MFResolutions[DefaultMFMode] << "dpi" << endl;
MetafontMode = DefaultMFMode;
}
// Set up the kpsewhich process. If pass == 0, look for vf-fonts and
// disable automatic font generation as vf-fonts can't be
// generated. If pass == 0, ennable font generation, if it was
@ -345,8 +309,8 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
// Now generate the command line for the kpsewhich
// program. Unfortunately, this can be rather long and involved...
shellProcessCmdLine += "kpsewhich";
shellProcessCmdLine += QString("--dpi %1").arg(MFResolutions[MetafontMode]);
shellProcessCmdLine += QString("--mode %1").arg(KShellProcess::quote(MFModes[MetafontMode]));
shellProcessCmdLine += QString("--dpi 1200");
shellProcessCmdLine += QString("--mode lexmarks");
// Disable automatic pk-font generation.
if (makePK == true)
@ -372,7 +336,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
}
#endif
shellProcessCmdLine += KShellProcess::quote(QString("%1.vf").arg(fontp->fontname));
shellProcessCmdLine += KShellProcess::quote(QString("%2.%1pk").arg(MFResolutions[MetafontMode]).arg(fontp->fontname));
shellProcessCmdLine += KShellProcess::quote(QString("%1.1200pk").arg(fontp->fontname));
}
}
fontp=fontList.next();

View file

@ -26,12 +26,6 @@
class KProcess;
class KShellProcess;
#define NumberOfMFModes 3
#define DefaultMFMode 1
extern const char *MFModes[];
extern const char *MFModenames[];
extern const int MFResolutions[];
/**
* A list of fonts and a compilation of utility functions
@ -56,17 +50,10 @@ public:
~fontPool( void );
/** Method used to set the MetafontMode for the PK font files. This
data is used when loading fonts. Currently, a change here will
be applied only to those font which were not yet loaded
---expect funny results when changing the data in the
mid-work. The integer argument must be smaller than
NumberOfMFModes, which is defined in fontpool.h and refers to a
Mode/Resolution pair in the lists MFModes and MFResolutins which
are also defined in fontpool.h and implemented in
fontpool.cpp. Returns the mode number of the mode which was
actually set ---if an invalid argument is given, this will be
the DefaultMFMode as defined in fontPool.h */
void setParameters( unsigned int MetaFontMode, bool useFontHints );
data is used when loading fonts. Currently, a change here will be
applied only to those font which were not yet loaded ---expect
funny results when changing the data in the mid-work. */
void setParameters( bool useFontHints );
/** Sets the DVI file's path. This information is used to set the
current working directory for the kpsewhich command, so that
@ -79,9 +66,6 @@ public:
that are stored in the DVI file's directory. */
QString getExtraSearchPath( ) const {return extraSearchPath;};
/** Returns the currently set MetafontMode */
unsigned int getMetafontMode(void) const {return MetafontMode;}
/** Sets the resolution of the output device. */
void setDisplayResolution( double _displayResolution_in_dpi );
@ -177,13 +161,6 @@ private:
// should use hinted fonts or not
bool useFontHints;
// This integer determines the Metafont-Mode which is used in
// generating bitmaps. The value must satisfy 0 <= MetafontMode <
// NumberOfMFModes, and refers to an entry in the lists
// MFModenames/MFModes and MFResolutions which are defined in
// fontpool.cpp
unsigned int MetafontMode;
// Resolution of the output device.
double displayResolution_in_dpi;

View file

@ -248,12 +248,10 @@ void KDVIMultiPage::preferencesChanged()
kdDebug(4300) << "preferencesChanged" << endl;
#endif
int mfmode = Prefs::metafontMode();
bool showPS = Prefs::showPS();
bool useFontHints = Prefs::useFontHints();
DVIRenderer.setPrefs( showPS, Prefs::editorCommand(), mfmode, useFontHints);
DVIRenderer.setPrefs( showPS, Prefs::editorCommand(), useFontHints);
}

View file

@ -25,10 +25,6 @@
optionDialogFontsWidget::optionDialogFontsWidget( QWidget* parent, const char* name, WFlags fl )
: optionDialogFontsWidget_base( parent, name, fl )
{
// Important! The default values here must be the same as in kdvi_multipage.cpp
for(int i=0; i<NumberOfMFModes; i++)
kcfg_MetafontMode->insertItem(QString("%1 dpi / %2").arg(MFResolutions[i]).arg(MFModenames[i]));
#ifndef HAVE_FREETYPE
kcfg_UseType1Fonts->setChecked(false);
kcfg_UseType1Fonts->setEnabled(false);

View file

@ -9,10 +9,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>349</width>
<height>54</height>
<width>335</width>
<height>24</height>
</rect>
</property>
<property name="caption">
<string>optionDialogFontsWidget_base</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
@ -34,36 +37,9 @@
<string>Many modern fonts contain "font hinting" information which can be used to improve the appearance of a font on low-resolution displays, such as a computer monitor, or a notebook screen. However, many people find the "improved" fonts quite ugly and prefer to have this option disabled.</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>MetaFont mode used for PK fonts:</string>
</property>
</widget>
<widget class="KComboBox" row="1" column="1">
<property name="name">
<cstring>kcfg_MetafontMode</cstring>
</property>
<property name="toolTip" stdset="0">
<string>LaserJet 4 is usually a good choice.</string>
</property>
<property name="whatsThis" stdset="0">
<string>&lt;p&gt;With this option you choose the type of bitmap fonts used for
the display. As a general rule, the higher the dpi value, the better
quality of the output. On the other hand, large dpi fonts use more
resources and make KDVI slower.&lt;/p&gt;
&lt;p&gt;If you are low on hard disk space, or have a slow machine, you
may want to choose the same setting that is also used by dvips.
That way you avoid generating several bitmap versions of the same
font.&lt;/p&gt;</string>
</property>
</widget>
</grid>
</widget>
<tabstops>
<tabstop>kcfg_MetafontMode</tabstop>
</tabstops>
<includes>
<include location="global" impldecl="in implementation">kdialog.h</include>

View file

@ -298,7 +298,7 @@ void dviRenderer::epsf_special(QString cp)
bbox_height = rhi;
}
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * MFResolutions[font_pool.getMetafontMode()]/2.54;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * 1200.0/2.54;
bbox_width *= 0.1 * 65536.0*fontPixelPerDVIunit / shrinkfactor;
bbox_height *= 0.1 * 65536.0*fontPixelPerDVIunit / shrinkfactor;
@ -324,7 +324,7 @@ void dviRenderer::epsf_special(QString cp)
bbox_height = rhi;
}
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * MFResolutions[font_pool.getMetafontMode()]/2.54;
double fontPixelPerDVIunit = dviFile->getCmPerDVIunit() * 1200.0/2.54;
bbox_width *= 0.1 * 65536.0*fontPixelPerDVIunit / shrinkfactor;
bbox_height *= 0.1 * 65536.0*fontPixelPerDVIunit / shrinkfactor;