mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 10:55:37 +00:00
further improve font rendering, virtual fonts are now displayed 50% faster
svn path=/trunk/kdegraphics/kdvi/; revision=222420
This commit is contained in:
parent
0eb0c5e7a1
commit
a557c99724
|
@ -553,7 +553,7 @@ bool dviWindow::setFile(QString fname, QString ref, bool sourceMarker)
|
|||
command_pointer = end_pointer = 0;
|
||||
|
||||
memset((char *) &currinf.data, 0, sizeof(currinf.data));
|
||||
currinf.fonttable = dviFile->tn_table;
|
||||
currinf.fonttable = &(dviFile->tn_table);
|
||||
currinf._virtual = NULL;
|
||||
draw_part(65536.0*fontPixelPerDVIunit(), false);
|
||||
|
||||
|
|
2
dviwin.h
2
dviwin.h
|
@ -96,7 +96,7 @@ struct drawinf {
|
|||
TeXFontDefinition *fontp;
|
||||
set_char_proc set_char_p;
|
||||
|
||||
QIntDict<TeXFontDefinition> fonttable;
|
||||
QIntDict<TeXFontDefinition> *fonttable;
|
||||
TeXFontDefinition *_virtual;
|
||||
};
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void dviWindow::set_vf_char(unsigned int cmd, unsigned int ch)
|
|||
currinf.data.y = 0;
|
||||
currinf.data.z = 0;
|
||||
|
||||
currinf.fonttable = currinf.fontp->vf_table;
|
||||
currinf.fonttable = &(currinf.fontp->vf_table);
|
||||
currinf._virtual = currinf.fontp;
|
||||
Q_UINT8 *command_ptr_sav = command_pointer;
|
||||
Q_UINT8 *end_ptr_sav = end_pointer;
|
||||
|
@ -284,7 +284,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
(this->*currinf.set_char_p)(ch, ch);
|
||||
} else
|
||||
if (FNTNUM0 <= ch && ch <= (unsigned char) (FNTNUM0 + 63)) {
|
||||
currinf.fontp = currinf.fonttable[ch - FNTNUM0];
|
||||
currinf.fontp = currinf.fonttable->find(ch - FNTNUM0);
|
||||
if (currinf.fontp == NULL) {
|
||||
errorMsg = i18n("The DVI code referred to font #%1, which was not previously defined.").arg(ch - FNTNUM0);
|
||||
return;
|
||||
|
@ -495,7 +495,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case FNT1:
|
||||
case FNT2:
|
||||
case FNT3:
|
||||
currinf.fontp = currinf.fonttable[readUINT(ch - FNT1 + 1)];
|
||||
currinf.fontp = currinf.fonttable->find(readUINT(ch - FNT1 + 1));
|
||||
if (currinf.fontp == NULL) {
|
||||
errorMsg = i18n("The DVI code referred to a font which was not previously defined.");
|
||||
return;
|
||||
|
@ -504,7 +504,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
break;
|
||||
|
||||
case FNT4:
|
||||
currinf.fontp = currinf.fonttable[readINT(ch - FNT1 + 1)];
|
||||
currinf.fontp = currinf.fonttable->find(readINT(ch - FNT1 + 1));
|
||||
if (currinf.fontp == NULL) {
|
||||
errorMsg = i18n("The DVI code referred to a font which was not previously defined.");
|
||||
return;
|
||||
|
@ -612,7 +612,7 @@ void dviWindow::draw_page(void)
|
|||
command_pointer = end_pointer = 0;
|
||||
|
||||
memset((char *) &currinf.data, 0, sizeof(currinf.data));
|
||||
currinf.fonttable = dviFile->tn_table;
|
||||
currinf.fonttable = &(dviFile->tn_table);
|
||||
currinf._virtual = 0;
|
||||
draw_part(65536.0*fontPixelPerDVIunit(), false);
|
||||
if (HTML_href != 0) {
|
||||
|
|
14
fontpool.cpp
14
fontpool.cpp
|
@ -45,7 +45,6 @@ fontPool::fontPool(void)
|
|||
|
||||
proc = 0;
|
||||
makepk = true; // By default, fonts are generated
|
||||
enlargeFonts = true; // By default, fonts are enlarged
|
||||
displayResolution_in_dpi = 100.0; // A not-too-bad-default
|
||||
MetafontMode = DefaultMFMode;
|
||||
fontList.setAutoDelete(TRUE);
|
||||
|
@ -124,7 +123,7 @@ fontPool::~fontPool(void)
|
|||
}
|
||||
|
||||
|
||||
void fontPool::setParameters( unsigned int _metafontMode, bool _makePK, bool _enlargeFonts, bool _useType1Fonts, bool _useFontHints )
|
||||
void fontPool::setParameters( unsigned int _metafontMode, bool _makePK, bool _useType1Fonts, bool _useFontHints )
|
||||
{
|
||||
if (_metafontMode >= NumberOfMFModes) {
|
||||
kdError(4300) << "fontPool::setMetafontMode called with argument " << _metafontMode
|
||||
|
@ -160,10 +159,8 @@ void fontPool::setParameters( unsigned int _metafontMode, bool _makePK, bool _en
|
|||
}
|
||||
|
||||
// Check if glyphs need to be cleared
|
||||
if ((_enlargeFonts != enlargeFonts) || (_useFontHints != useFontHints)) {
|
||||
if (_useFontHints != useFontHints) {
|
||||
double displayResolution = displayResolution_in_dpi;
|
||||
if (_enlargeFonts == true)
|
||||
displayResolution *= 1.1;
|
||||
TeXFontDefinition *fontp = fontList.first();
|
||||
while(fontp != 0 ) {
|
||||
fontp->setDisplayResolution(displayResolution * fontp->enlargement);
|
||||
|
@ -173,7 +170,6 @@ void fontPool::setParameters( unsigned int _metafontMode, bool _makePK, bool _en
|
|||
|
||||
MetafontMode = _metafontMode;
|
||||
makepk = _makePK;
|
||||
enlargeFonts = _enlargeFonts;
|
||||
useType1Fonts = _useType1Fonts;
|
||||
useFontHints = _useFontHints;
|
||||
|
||||
|
@ -204,8 +200,6 @@ class TeXFontDefinition *fontPool::appendx(QString fontname, Q_UINT32 checksum,
|
|||
// If font doesn't exist yet, we have to generate a new font.
|
||||
|
||||
double displayResolution = displayResolution_in_dpi;
|
||||
if (enlargeFonts == true)
|
||||
displayResolution *= 1.1;
|
||||
|
||||
fontp = new TeXFontDefinition(fontname, displayResolution*enlargement, checksum, scale, this, enlargement);
|
||||
if (fontp == 0) {
|
||||
|
@ -597,7 +591,7 @@ void fontPool::kpsewhich_terminated(KProcess *)
|
|||
config->setGroup("kdvi");
|
||||
config->writeEntry( "MakePK", true );
|
||||
config->sync();
|
||||
setParameters( MetafontMode, true, enlargeFonts, useType1Fonts, useFontHints ); // That will start kpsewhich again.
|
||||
setParameters( MetafontMode, true, useType1Fonts, useFontHints ); // That will start kpsewhich again.
|
||||
return;
|
||||
}
|
||||
} else
|
||||
|
@ -618,8 +612,6 @@ void fontPool::setDisplayResolution( double _displayResolution_in_dpi )
|
|||
#endif
|
||||
displayResolution_in_dpi = _displayResolution_in_dpi;
|
||||
double displayResolution = displayResolution_in_dpi;
|
||||
if (enlargeFonts == true)
|
||||
displayResolution *= 1.1;
|
||||
|
||||
TeXFontDefinition *fontp = fontList.first();
|
||||
while(fontp != 0 ) {
|
||||
|
|
36
fontpool.h
36
fontpool.h
|
@ -62,36 +62,24 @@ Q_OBJECT
|
|||
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 */
|
||||
// unsigned int setMetafontMode( unsigned int );
|
||||
|
||||
void setParameters( unsigned int MetaFontMode, bool makePK, bool enlargeFonts, bool useType1Fonts, bool useFontHints );
|
||||
/** Sets whether fonts will be generated by running MetaFont, or a
|
||||
similar programm. If (flag == 0), fonts will not be generated,
|
||||
otherwise they will. */
|
||||
|
||||
/** Determines if Adobe Type 1 (*.pfb) fonts should be used or not */
|
||||
|
||||
/** Sets the resolution of the output device and determines if font hinting should be used. */
|
||||
|
||||
void setParameters( unsigned int MetaFontMode, bool makePK, bool useType1Fonts, bool useFontHints );
|
||||
|
||||
/** Returns the currently set MetafontMode */
|
||||
|
||||
unsigned int getMetafontMode(void) {return MetafontMode;};
|
||||
|
||||
/** Sets whether fonts will be generated by running MetaFont, or a
|
||||
similar programm. If (flag == 0), fonts will not be generated,
|
||||
otherwise they will. */
|
||||
// void setMakePK( bool flag );
|
||||
|
||||
/** Sets whether glyphs will be enlarged or not. If (flag == 0),
|
||||
glyphs will not be enlarged, otherwise they will. */
|
||||
// void setEnlargeFonts( bool flag );
|
||||
|
||||
/** Sets the resolution of the output device. */
|
||||
void setDisplayResolution( double _displayResolution_in_dpi );
|
||||
|
||||
/** Sets the resolution of the output device and determines if font hinting should be used. */
|
||||
// void setUseFontHints( bool _useFontHinting );
|
||||
|
||||
/** Determines if Adobe Type 1 (*.pfb) fonts should be used or not */
|
||||
// void setUseType1Fonts( bool _useType1Fonts );
|
||||
|
||||
/** Returns the status of enlargeFonts. If the return value is ==
|
||||
0, glyphs will not be enlarged, otherwise they will. */
|
||||
bool getEnlargeFonts() {return enlargeFonts;};
|
||||
|
||||
/** If return value is true, font hinting should be used if
|
||||
possible */
|
||||
bool getUseFontHints(void) {return useFontHints;};
|
||||
|
@ -233,11 +221,7 @@ public slots:
|
|||
font if a bitmap is not available. If makepk == 0, then bitmaps
|
||||
are NOT generated. */
|
||||
bool makepk;
|
||||
|
||||
/** This flag determines whether the glyphs should be enlarged by 10%
|
||||
or not. If enlargeFonts==0, then fonts are NOT enlarged. */
|
||||
bool enlargeFonts;
|
||||
|
||||
|
||||
/** This flag is used by PFB fonts to determine if the FREETYPE
|
||||
engine should use hinted fonts or not */
|
||||
bool useFontHints;
|
||||
|
|
|
@ -350,8 +350,6 @@ void KDVIMultiPage::preferencesChanged()
|
|||
config->writeEntry( "MetafontMode", mfmode = DefaultMFMode );
|
||||
|
||||
bool makepk = config->readBoolEntry( "MakePK", true );
|
||||
bool enlargeFonts = config->readBoolEntry( "enlarge_for_readability", true );
|
||||
|
||||
bool showPS = config->readBoolEntry( "ShowPS", true );
|
||||
if (showPS != window->showPS())
|
||||
window->setShowPS(showPS);
|
||||
|
@ -363,7 +361,7 @@ void KDVIMultiPage::preferencesChanged()
|
|||
bool useType1Fonts = config->readBoolEntry( "UseType1Fonts", true );
|
||||
bool useFontHints = config->readBoolEntry( "UseFontHints", true );
|
||||
|
||||
window->font_pool->setParameters(mfmode, makepk, enlargeFonts, useType1Fonts, useFontHints);
|
||||
window->font_pool->setParameters(mfmode, makepk, useType1Fonts, useFontHints);
|
||||
|
||||
window->setEditorCommand( config->readEntry( "EditorCommand", "" ));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ optionDialogFontsWidget::optionDialogFontsWidget( QWidget* parent, const char*
|
|||
#endif
|
||||
|
||||
fontGenerationCheckBox->setChecked( config->readBoolEntry( "MakePK", true ) );
|
||||
fontEnlargementCheckBox->setChecked( config->readBoolEntry( "enlarge_for_readability", true ) );
|
||||
}
|
||||
|
||||
optionDialogFontsWidget::~optionDialogFontsWidget()
|
||||
|
@ -75,7 +74,6 @@ void optionDialogFontsWidget::apply(void)
|
|||
#endif
|
||||
config->writeEntry( "MetafontMode", metafontMode->currentItem() );
|
||||
config->writeEntry( "MakePK", fontGenerationCheckBox->isChecked() );
|
||||
config->writeEntry( "enlarge_for_readability", fontEnlargementCheckBox->isChecked() );
|
||||
config->sync();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>259</width>
|
||||
<height>241</height>
|
||||
<height>299</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
|
@ -120,14 +120,6 @@
|
|||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fontEnlargementCheckBox</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enlarge fonts for better readability</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer2</cstring>
|
||||
|
|
Loading…
Reference in a new issue