X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FT1Font.cc;h=9815e490147c5278de8a9d55ee9d9964cec96f31;hb=28c37dbcf87665a4ccec58bef9ef8ff0697022dd;hp=7b79d8747fe4a9e8685244ae1045e344b4f6a42a;hpb=2a393c134fe3fe8eb85bf818cb7ad6ae4396322a;p=evince.git diff --git a/pdf/xpdf/T1Font.cc b/pdf/xpdf/T1Font.cc index 7b79d874..9815e490 100644 --- a/pdf/xpdf/T1Font.cc +++ b/pdf/xpdf/T1Font.cc @@ -6,14 +6,14 @@ // //======================================================================== -#ifdef __GNUC__ -#pragma implementation -#endif - #include #if HAVE_T1LIB_H +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include #include #include @@ -23,6 +23,10 @@ //------------------------------------------------------------------------ +int T1FontEngine::t1libInitCount = 0; + +//------------------------------------------------------------------------ + T1FontEngine::T1FontEngine(Display *displayA, Visual *visualA, int depthA, Colormap colormapA, GBool aaA, GBool aaHighA): SFontEngine(displayA, visualA, depthA, colormapA) @@ -32,30 +36,37 @@ T1FontEngine::T1FontEngine(Display *displayA, Visual *visualA, int depthA, }; ok = gFalse; - T1_SetBitmapPad(8); - if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | - T1_NO_AFM)) { - return; - } aa = aaA; aaHigh = aaHighA; - if (aa) { - T1_AASetBitsPerPixel(8); - if (aaHigh) { - T1_AASetLevel(T1_AA_HIGH); - T1_AAHSetGrayValues(grayVals); + //~ for multithreading: need a mutex here + if (t1libInitCount == 0) { + T1_SetBitmapPad(8); + if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | + T1_NO_AFM)) { + return; + } + if (aa) { + T1_AASetBitsPerPixel(8); + if (aaHigh) { + T1_AASetLevel(T1_AA_HIGH); + T1_AAHSetGrayValues(grayVals); + } else { + T1_AASetLevel(T1_AA_LOW); + T1_AASetGrayValues(0, 1, 2, 3, 4); + } } else { - T1_AASetLevel(T1_AA_LOW); - T1_AASetGrayValues(0, 1, 2, 3, 4); + T1_AANSetGrayValues(0, 1); } - } else { - T1_AANSetGrayValues(0, 1); } + ++t1libInitCount; ok = gTrue; } T1FontEngine::~T1FontEngine() { - T1_CloseLib(); + //~ for multithreading: need a mutex here + if (--t1libInitCount == 0) { + T1_CloseLib(); + } } //------------------------------------------------------------------------