From 28c37dbcf87665a4ccec58bef9ef8ff0697022dd Mon Sep 17 00:00:00 2001 From: Martin Kretzschmar Date: Mon, 31 Mar 2003 16:45:09 +0000 Subject: Import of Xpdf 2.00 for merge --- (limited to 'pdf/xpdf/T1Font.cc') diff --git a/pdf/xpdf/T1Font.cc b/pdf/xpdf/T1Font.cc index 7b79d87..9815e49 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(); + } } //------------------------------------------------------------------------ -- cgit v0.9.1