From 5d41aeadbd0a527f25a59b43cafcd03285777e44 Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Mon, 24 Jan 2005 07:08:35 +0000 Subject: [PATCH] removes rarely used configuration option svn path=/trunk/kdegraphics/kdvi/; revision=381851 --- TeXFont_PK.cpp | 2 +- dviwin.cpp | 9 +++--- dviwin.h | 3 +- dviwin_draw.cpp | 13 ++++----- dviwin_prescan.cpp | 23 ++++++++------- fontpool.cpp | 50 +++++---------------------------- fontpool.h | 31 +++----------------- kdvi_multipage.cpp | 4 +-- optionDialogFontsWidget.cpp | 4 --- optionDialogFontsWidget_base.ui | 34 ++++------------------ special.cpp | 4 +-- 11 files changed, 42 insertions(+), 135 deletions(-) diff --git a/TeXFont_PK.cpp b/TeXFont_PK.cpp index 1f497758c..f131a5dc5 100644 --- a/TeXFont_PK.cpp +++ b/TeXFont_PK.cpp @@ -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 diff --git a/dviwin.cpp b/dviwin.cpp index e14027479..2697e9159 100644 --- a/dviwin.cpp +++ b/dviwin.cpp @@ -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; } diff --git a/dviwin.h b/dviwin.h index b9dc70c2d..dbce01ddf 100644 --- a/dviwin.h +++ b/dviwin.h @@ -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;}; diff --git a/dviwin_draw.cpp b/dviwin_draw.cpp index e13042ca2..32f94c4c7 100644 --- a/dviwin_draw.cpp +++ b/dviwin_draw.cpp @@ -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) { diff --git a/dviwin_prescan.cpp b/dviwin_prescan.cpp index 828fa1390..a147c3106 100644 --- a/dviwin_prescan.cpp +++ b/dviwin_prescan.cpp @@ -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; diff --git a/fontpool.cpp b/fontpool.cpp index 975b7a569..62db3f05b 100644 --- a/fontpool.cpp +++ b/fontpool.cpp @@ -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(); diff --git a/fontpool.h b/fontpool.h index 57d499512..1eb7d8797 100644 --- a/fontpool.h +++ b/fontpool.h @@ -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; diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp index 127a12d33..296184b57 100644 --- a/kdvi_multipage.cpp +++ b/kdvi_multipage.cpp @@ -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); } diff --git a/optionDialogFontsWidget.cpp b/optionDialogFontsWidget.cpp index ed7c55f6c..c465a8b05 100644 --- a/optionDialogFontsWidget.cpp +++ b/optionDialogFontsWidget.cpp @@ -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; iinsertItem(QString("%1 dpi / %2").arg(MFResolutions[i]).arg(MFModenames[i])); - #ifndef HAVE_FREETYPE kcfg_UseType1Fonts->setChecked(false); kcfg_UseType1Fonts->setEnabled(false); diff --git a/optionDialogFontsWidget_base.ui b/optionDialogFontsWidget_base.ui index 7d5b62883..4065dfb44 100644 --- a/optionDialogFontsWidget_base.ui +++ b/optionDialogFontsWidget_base.ui @@ -9,10 +9,13 @@ 0 0 - 349 - 54 + 335 + 24 + + optionDialogFontsWidget_base + unnamed @@ -34,36 +37,9 @@ 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. - - - textLabel1 - - - MetaFont mode used for PK fonts: - - - - - kcfg_MetafontMode - - - LaserJet 4 is usually a good choice. - - - <p>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.</p> -<p>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.</p> - - - kcfg_MetafontMode kdialog.h diff --git a/special.cpp b/special.cpp index 044d85e5e..8472367eb 100644 --- a/special.cpp +++ b/special.cpp @@ -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;