diff options
63 files changed, 840 insertions, 900 deletions
diff --git a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx index 7b451970c565..a29204eadc3f 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx @@ -174,6 +174,20 @@ namespace basegfx bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, const double& rfSmallValue); bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB); + /** snap some polygon coordinates to discrete coordinates + + This method allows to snap some polygon points to discrete (integer) values + which equals e.g. a snap to discrete coordinates. It will snap points of + horizontal and vertical edges + + @param rCandidate + The source polygon + + @return + The modified version of the source polygon + */ + B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate); + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 3ea163a85e89..ea303886dd88 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -39,6 +39,7 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/tuple/b3ituple.hxx> #include <numeric> ////////////////////////////////////////////////////////////////////////////// @@ -1101,6 +1102,67 @@ namespace basegfx return equal(rCandidateA, rCandidateB, fSmallValue); } + // snap points of horizontal or vertical edges to discrete values + B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate) + { + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount > 1) + { + // Start by copying the source polygon to get a writeable copy. The closed state is + // copied by aRetval's initialisation, too, so no need to copy it in this method + B3DPolygon aRetval(rCandidate); + + // prepare geometry data. Get rounded from original + B3ITuple aPrevTuple(basegfx::fround(rCandidate.getB3DPoint(nPointCount - 1))); + B3DPoint aCurrPoint(rCandidate.getB3DPoint(0)); + B3ITuple aCurrTuple(basegfx::fround(aCurrPoint)); + + // loop over all points. This will also snap the implicit closing edge + // even when not closed, but that's no problem here + for(sal_uInt32 a(0); a < nPointCount; a++) + { + // get next point. Get rounded from original + const bool bLastRun(a + 1 == nPointCount); + const sal_uInt32 nNextIndex(bLastRun ? 0 : a + 1); + const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex)); + const B3ITuple aNextTuple(basegfx::fround(aNextPoint)); + + // get the states + const bool bPrevVertical(aPrevTuple.getX() == aCurrTuple.getX()); + const bool bNextVertical(aNextTuple.getX() == aCurrTuple.getX()); + const bool bPrevHorizontal(aPrevTuple.getY() == aCurrTuple.getY()); + const bool bNextHorizontal(aNextTuple.getY() == aCurrTuple.getY()); + const bool bSnapX(bPrevVertical || bNextVertical); + const bool bSnapY(bPrevHorizontal || bNextHorizontal); + + if(bSnapX || bSnapY) + { + const B3DPoint aSnappedPoint( + bSnapX ? aCurrTuple.getX() : aCurrPoint.getX(), + bSnapY ? aCurrTuple.getY() : aCurrPoint.getY(), + aCurrPoint.getZ()); + + aRetval.setB3DPoint(a, aSnappedPoint); + } + + // prepare next point + if(!bLastRun) + { + aPrevTuple = aCurrTuple; + aCurrPoint = aNextPoint; + aCurrTuple = aNextTuple; + } + } + + return aRetval; + } + else + { + return rCandidate; + } + } + } // end of namespace tools } // end of namespace basegfx diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 7d63ed7a43f5..d2284409bdce 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -427,7 +427,7 @@ sal_Bool OStorageHelper::IsValidZipEntryFileName( return sal_False; break; default: - if ( pChar[i] < 32 || pChar[i] >= 0xD800 && pChar[i] <= 0xDFFF ) + if ( pChar[i] < 32 || (pChar[i] >= 0xD800 && pChar[i] <= 0xDFFF) ) return sal_False; } } diff --git a/i18nutil/inc/i18nutil/casefolding.hxx b/i18nutil/inc/i18nutil/casefolding.hxx index 2c993d43f75d..bc67f4fce47e 100644 --- a/i18nutil/inc/i18nutil/casefolding.hxx +++ b/i18nutil/inc/i18nutil/casefolding.hxx @@ -37,20 +37,20 @@ namespace com { namespace sun { namespace star { namespace i18n { -#define MappingTypeLowerToUpper 1 << 0 // Upper to Lower mapping -#define MappingTypeUpperToLower 1 << 1 // Lower to Upper mapping -#define MappingTypeToUpper 1 << 2 // to Upper mapping -#define MappingTypeToLower 1 << 3 // to Lower mapping -#define MappingTypeToTitle 1 << 4 // to Title mapping -#define MappingTypeSimpleFolding 1 << 5 // Simple Case Folding -#define MappingTypeFullFolding 1 << 6 // Full Case Folding -#define MappingTypeMask MappingTypeLowerToUpper|MappingTypeUpperToLower|\ +#define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping +#define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping +#define MappingTypeToUpper (1 << 2) // to Upper mapping +#define MappingTypeToLower (1 << 3) // to Lower mapping +#define MappingTypeToTitle (1 << 4) // to Title mapping +#define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding +#define MappingTypeFullFolding (1 << 6) // Full Case Folding +#define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\ MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ - MappingTypeSimpleFolding|MappingTypeFullFolding + MappingTypeSimpleFolding|MappingTypeFullFolding) -#define ValueTypeNotValue 1 << 7 // Value field is an address +#define ValueTypeNotValue (1 << 7) // Value field is an address -#define CasedLetter MappingTypeMask // for final sigmar +#define CasedLetter (MappingTypeMask) // for final sigmar struct Value { @@ -68,7 +68,7 @@ struct Mapping struct MappingElement { - MappingElement() {element.nmap = current = 0;}; + MappingElement() {element.nmap = current = 0;} Mapping element; sal_Int8 current; }; diff --git a/i18nutil/source/utility/casefolding.cxx b/i18nutil/source/utility/casefolding.cxx index 8a679b8afbe5..7a74609b0342 100644 --- a/i18nutil/source/utility/casefolding.cxx +++ b/i18nutil/source/utility/casefolding.cxx @@ -51,13 +51,13 @@ static Mapping mapping_0130[] = {{0, 1, {0x0069, 0, 0}},{0, 1, {0x0130, 0, 0}}}; #define langIs(lang) (aLocale.Language.compareToAscii(lang) == 0) // only check simple case, there is more complicated case need to be checked. -#define type_i(ch) (ch == 0x0069 || ch == 0x006a) +#define type_i(ch) ((ch) == 0x0069 || (ch) == 0x006a) -#define cased_letter(ch) (CaseMappingIndex[ch>>8] >= 0 && (CaseMappingValue[(CaseMappingIndex[ch>>8] << 8) + (ch&0xff)].type & CasedLetter)) +#define cased_letter(ch) (CaseMappingIndex[(ch)>>8] >= 0 && (CaseMappingValue[(CaseMappingIndex[(ch)>>8] << 8) + ((ch)&0xff)].type & CasedLetter)) // for Lithuanian, condition to make explicit dot above when lowercasing capital I's and J's // whenever there are more accents above. -#define accent_above(ch) (ch >= 0x0300 && ch <= 0x0314 || ch >= 0x033D && ch <= 0x0344 || ch == 0x0346 || ch >= 0x034A && ch <= 0x034C) +#define accent_above(ch) (((ch) >= 0x0300 && (ch) <= 0x0314) || ((ch) >= 0x033D && (ch) <= 0x0344) || (ch) == 0x0346 || ((ch) >= 0x034A && (ch) <= 0x034C)) Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale& aLocale, sal_uInt8 nMappingType) throw (RuntimeException) { @@ -68,8 +68,8 @@ Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos, return !(pos < len && cased_letter(str[pos+1])) && (pos > 0 && cased_letter(str[pos-1])) ? mapping_03a3[0] : mapping_03a3[1]; case 0x0307: - return ((nMappingType == MappingTypeLowerToUpper && langIs("lt") || - nMappingType == MappingTypeUpperToLower && (langIs("tr") || langIs("az"))) && + return (((nMappingType == MappingTypeLowerToUpper && langIs("lt")) || + (nMappingType == MappingTypeUpperToLower && (langIs("tr") || langIs("az")))) && (pos > 0 && type_i(str[pos-1]))) ? // after_i mapping_0307[0] : mapping_0307[1]; case 0x0130: @@ -147,7 +147,7 @@ sal_Unicode casefolding::getNextChar(const sal_Unicode *str, sal_Int32& idx, sal } if (moduleLoaded & TransliterationModules_IGNORE_KANA) { - if (0x3040 <= c && c <= 0x3094 || 0x309d <= c && c <= 0x309f) + if ((0x3040 <= c && c <= 0x3094) || (0x309d <= c && c <= 0x309f)) c += 0x60; } diff --git a/padmin/prj/build.lst b/padmin/prj/build.lst index 9aaab83cf7de..765675d73137 100644 --- a/padmin/prj/build.lst +++ b/padmin/prj/build.lst @@ -1,3 +1,3 @@ -pd padmin : vcl svtools NULL +pd padmin : psprint vcl svtools NULL pd padmin usr1 - all pd_mkout NULL pd padmin\source nmake - all pd_source NULL diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index 1a6894789bb5..6cf4f8b257b1 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -148,23 +148,6 @@ RTSDialog::~RTSDialog() // -------------------------------------------------------------------------- -String RTSDialog::getPaperSize() -{ - String aRet; - if( m_aJobData.m_pParser ) - { - const PPDKey* pKey = m_aJobData.m_pParser->getKey( String::CreateFromAscii( "PageSize" ) ); - if( pKey ) - { - const PPDValue* pValue = m_aJobData.m_aContext.getValue( pKey ); - aRet = pValue->m_aOption; - } - } - return aRet; -} - -// -------------------------------------------------------------------------- - IMPL_LINK( RTSDialog, ActivatePage, TabControl*, pTabCtrl ) { if( pTabCtrl != &m_aTabControl ) diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx index 56e68336dfd8..8487daa158da 100644 --- a/padmin/source/prtsetup.hxx +++ b/padmin/source/prtsetup.hxx @@ -86,8 +86,6 @@ class RTSDialog : public TabDialog // helper functions void insertAllPPDValues( ListBox&, const ::psp::PPDKey* ); - - String getPaperSize(); public: RTSDialog( const ::psp::PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent = NULL ); ~RTSDialog(); diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 334b19ccd98d..74d72e32155c 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -108,8 +108,11 @@ void MultiLineEditSyntaxHighlight::DoBracketHilight(USHORT aKey) { for (long aPara =nStartPara; aPara>=0;--aPara) { + if ( aStartPos == 0 ) + continue; + String aLine( GetTextEngine()->GetText( aPara ) ); - for (USHORT i = ((unsigned long)aPara==nStartPara) ? aStartPos-1 : (USHORT)(GetTextEngine()->GetTextLen()-1); i>0; --i) + for (USHORT i = ((unsigned long)aPara==nStartPara) ? aStartPos-1 : (USHORT)(aLine.Len()-1); i>0; --i) { if (aLine.GetChar(i)==aChar) { diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 42026382385f..279af7c83cef 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -218,7 +218,7 @@ void ImpSvMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) bNeedVScroll = true; } - const BOOL bNeedScrollBox = bNeedVScroll || bNeedHScroll; + const BOOL bNeedScrollBox = bNeedVScroll && bNeedHScroll; BOOL bScrollbarsChanged = false; if ( bHaveVScroll != bNeedVScroll ) diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx index c8e44a9c9180..0ef31560b69f 100644 --- a/toolkit/workben/layout/editor.cxx +++ b/toolkit/workben/layout/editor.cxx @@ -34,6 +34,7 @@ #undef NDEBUG #include <assert.h> #include <stdio.h> +#include <string.h> #include <vector> #include <list> diff --git a/toolkit/workben/layout/makefile.mk b/toolkit/workben/layout/makefile.mk index 8612992303d8..a7f1a8dfcb97 100644 --- a/toolkit/workben/layout/makefile.mk +++ b/toolkit/workben/layout/makefile.mk @@ -89,7 +89,7 @@ XML_FILES=\ wordcount.xml\ zoom.xml\ -TRALAY=tralay +TRALAY=$(AUGMENT_LIBRARY_PATH) tralay XML_LANGS=$(alllangiso) #ALL_XMLS=$(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $i/$j)) diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 7c394dcdaee8..d4411058a6fb 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -96,7 +96,9 @@ main( int argc, char **argv ) String aSrsBaseName; BOOL bSource = FALSE; ByteString aRespArg; - String aDelim = String(DirEntry::GetAccessDelimiter()); +// who needs anything but '/' ? +// String aDelim = String(DirEntry::GetAccessDelimiter()); + String aDelim = '/'; RscHrcDep *pDep = new RscHrcDep; @@ -256,6 +258,7 @@ main( int argc, char **argv ) printf("further arguments : "); #endif aString = ByteString( pSrsFileName ); + aString.SearchAndReplaceAll('\\', ByteString( aDelim, RTL_TEXTENCODING_ASCII_US )); aString += ByteString(" : " ); while ( optind < argc ) @@ -289,12 +292,7 @@ main( int argc, char **argv ) for ( ULONG j=0; j<nCount; j++ ) { ByteString *pStr = pLst->GetObject(j); -#ifdef UNX pStr->SearchAndReplaceAll('\\', ByteString( aDelim, RTL_TEXTENCODING_ASCII_US )); -#endif -#ifdef WNT - pStr->SearchAndReplaceAll('/', ByteString( aDelim, RTL_TEXTENCODING_ASCII_US )); -#endif if ( j != (nCount-1) ) *pStr += ByteString( "\\" ); aOutStream.WriteLine( *pStr ); diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index 931369982f03..dc629b9a3b8c 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -107,9 +107,10 @@ struct SalData bool mbIsScrollbarDoubleMax; // TODO: support DoubleMin and DoubleBoth too SInt32 mnSystemVersion; // Store System Version MainController* mpMainController; // Apple Remote - bool mbIsTestTool; NSObject* mpDockIconClickHandler; + long mnDPIX; // #i100617# read DPI only once per office life + long mnDPIY; // #i100617# read DPI only once per office life SalData(); ~SalData(); diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index b110141fb224..a70854306122 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -61,8 +61,9 @@ SalData::SalData() mbIsScrollbarDoubleMax( false ), mnSystemVersion( VER_TIGER ), mpMainController( NULL ), - mbIsTestTool( false ), - mpDockIconClickHandler( nil ) + mpDockIconClickHandler( nil ), + mnDPIX( 0 ), + mnDPIY( 0 ) { if( s_aAutoReleaseKey == 0 ) s_aAutoReleaseKey = osl_createThreadKey( releasePool ); diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 0523381b9223..b9d66d1e02d3 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -178,7 +178,6 @@ static void initNSApp() // get System Version and store the value in GetSalData()->mnSystemVersion [NSApp getSystemVersionMajor: (unsigned int *)major minor:(unsigned int *)minor bugFix:(unsigned int *)bugFix ]; -// ----------------------------------------------------------------------------------------------------------------- // Initialize Apple Remote GetSalData()->mpMainController = [[MainController alloc] init]; @@ -191,13 +190,9 @@ static void initNSApp() selector: @selector(applicationWillResignActive:) name: @"AppleRemoteWillResignActive" object: nil ]; -// ----------------------------------------------------------------------------------------------------------------- - if( AquaSalInstance::isOnCommandLine( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "-enableautomation" ) ) ) ) - { + if( ImplGetSVData()->mbIsTestTool ) [NSApp activateIgnoringOtherApps: YES]; - GetSalData()->mbIsTestTool = true; - } } BOOL ImplSVMainHook( BOOL * pbInit ) diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 929c8dd19c64..f47920004f7a 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -711,6 +711,31 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons if( !maATSULayout ) return STRING_LEN; + // the semantics of the legacy use case (nCharExtra!=0) cannot be mapped to ATSUBreakLine() + if( nCharExtra != 0 ) + { + // prepare the measurement by layouting and measuring the un-expanded/un-condensed text + if( !InitGIA() ) + return STRING_LEN; + + // TODO: use a better way than by testing each the char position + ATSUTextMeasurement nATSUSumWidth = 0; + const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nMaxWidth / nFactor ); + const ATSUTextMeasurement nATSUExtraWidth = Vcl2Fixed( nCharExtra ) / nFactor; + for( int i = 0; i < mnCharCount; ++i ) + { + nATSUSumWidth += mpCharWidths[i]; + if( nATSUSumWidth >= nATSUMaxWidth ) + return (mnMinCharPos + i); + nATSUSumWidth += nATSUExtraWidth; + if( nATSUSumWidth >= nATSUMaxWidth ) + if( i+1 < mnCharCount ) + return (mnMinCharPos + i); + } + + return STRING_LEN; + } + // get a quick overview on what could fit const long nPixelWidth = (nMaxWidth - (nCharExtra * mnCharCount)) / nFactor; @@ -720,10 +745,10 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons // initial measurement of text break position UniCharArrayOffset nBreakPos = mnMinCharPos; const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth ); - OSStatus nStatus = ATSUBreakLine( maATSULayout, mnMinCharPos, + OSStatus eStatus = ATSUBreakLine( maATSULayout, mnMinCharPos, nATSUMaxWidth, false, &nBreakPos ); - if( (nStatus != noErr) && (nStatus != kATSULineBreakInWord) ) + if( (eStatus != noErr) && (eStatus != kATSULineBreakInWord) ) return STRING_LEN; // the result from ATSUBreakLine() doesn't match the semantics expected by its @@ -734,26 +759,6 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons if( nBreakPos >= static_cast<UniCharArrayOffset>(mnEndCharPos) ) return STRING_LEN; - // for the nCharExtra!=0 case the resulting nBreakPos needs be involved - if( nCharExtra != 0 ) - { - // age-old nCharExtra!=0 semantic is quite incompatible with ATSUBreakLine() - // TODO: use a better way than by testing each the char position - InitGIA(); - ATSUTextMeasurement nATSUSumWidth = 0; - const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nMaxWidth / nFactor ); - const ATSUTextMeasurement nATSUExtraWidth = Vcl2Fixed( nCharExtra ) / nFactor; - for( int i = 0; i < mnCharCount; ++i) - { - nATSUSumWidth += mpCharWidths[i]; - if( nATSUSumWidth >= nATSUMaxWidth ) - return (mnMinCharPos + i); - nATSUSumWidth += nATSUExtraWidth; - } - - return STRING_LEN; - } - // GetTextBreak()'s callers expect it to return the "stupid visual line break". // Returning anything else result.s in subtle problems in the application layers. static const bool bInWord = true; // TODO: add as argument to GetTextBreak() method @@ -762,15 +767,15 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons // emulate stupid visual line breaking by line breaking for the remaining width ATSUTextMeasurement nLeft, nRight, nDummy; - nStatus = ATSUGetUnjustifiedBounds( maATSULayout, mnMinCharPos, nBreakPos-mnMinCharPos, + eStatus = ATSUGetUnjustifiedBounds( maATSULayout, mnMinCharPos, nBreakPos-mnMinCharPos, &nLeft, &nRight, &nDummy, &nDummy ); - if( nStatus != noErr ) + if( eStatus != noErr ) return nBreakPos; const ATSUTextMeasurement nATSURemWidth = nATSUMaxWidth - (nRight - nLeft); if( nATSURemWidth <= 0 ) return nBreakPos; UniCharArrayOffset nBreakPosInWord = nBreakPos; - nStatus = ATSUBreakLine( maATSULayout, nBreakPos, nATSURemWidth, false, &nBreakPosInWord ); + eStatus = ATSUBreakLine( maATSULayout, nBreakPos, nATSURemWidth, false, &nBreakPosInWord ); return nBreakPosInWord; } diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 6c8fe86bdaef..595b7d276a2a 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -46,17 +46,17 @@ // and SFNT fonts on Mac usually do not contain an OS/2 table. static void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttributes& rDFA ) { - // TODO: use a multi-string ignore-case matcher once it becomes available - String aPSName = rPSName; + ByteString aPSName( rPSName, RTL_TEXTENCODING_UTF8 ); aPSName.ToLowerAscii(); - if( (aPSName.SearchAscii("regular") != STRING_NOTFOUND) - || (aPSName.SearchAscii("normal") != STRING_NOTFOUND) - || (aPSName.SearchAscii("roman") != STRING_NOTFOUND) - || (aPSName.SearchAscii("medium") != STRING_NOTFOUND) - || (aPSName.SearchAscii("plain") != STRING_NOTFOUND) - || (aPSName.SearchAscii("standard") != STRING_NOTFOUND) - || (aPSName.SearchAscii("std") != STRING_NOTFOUND) ) + // TODO: use a multi-string ignore-case matcher once it becomes available + if( (aPSName.Search("regular") != STRING_NOTFOUND) + || (aPSName.Search("normal") != STRING_NOTFOUND) + || (aPSName.Search("roman") != STRING_NOTFOUND) + || (aPSName.Search("medium") != STRING_NOTFOUND) + || (aPSName.Search("plain") != STRING_NOTFOUND) + || (aPSName.Search("standard") != STRING_NOTFOUND) + || (aPSName.Search("std") != STRING_NOTFOUND) ) { rDFA.meWidthType = WIDTH_NORMAL; rDFA.meWeight = WEIGHT_NORMAL; @@ -64,110 +64,133 @@ static void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttrib } // heuristics for font weight - if (aPSName.SearchAscii("extrablack") != STRING_NOTFOUND) + if (aPSName.Search("extrablack") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_BLACK; - else if (aPSName.SearchAscii("black") != STRING_NOTFOUND) + else if (aPSName.Search("black") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_BLACK; - //else if (aPSName.SearchAscii("book") != STRING_NOTFOUND) + //else if (aPSName.Search("book") != STRING_NOTFOUND) // rDFA.meWeight = WEIGHT_SEMIBOLD; - else if( (aPSName.SearchAscii("semibold") != STRING_NOTFOUND) - || (aPSName.SearchAscii("smbd") != STRING_NOTFOUND)) + else if( (aPSName.Search("semibold") != STRING_NOTFOUND) + || (aPSName.Search("smbd") != STRING_NOTFOUND)) rDFA.meWeight = WEIGHT_SEMIBOLD; - else if (aPSName.SearchAscii("ultrabold") != STRING_NOTFOUND) + else if (aPSName.Search("ultrabold") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_ULTRABOLD; - else if (aPSName.SearchAscii("extrabold") != STRING_NOTFOUND) + else if (aPSName.Search("extrabold") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_BLACK; - else if( (aPSName.SearchAscii("bold") != STRING_NOTFOUND) - || (aPSName.SearchAscii("-bd") != STRING_NOTFOUND)) + else if( (aPSName.Search("bold") != STRING_NOTFOUND) + || (aPSName.Search("-bd") != STRING_NOTFOUND)) rDFA.meWeight = WEIGHT_BOLD; - else if (aPSName.SearchAscii("extralight") != STRING_NOTFOUND) + else if (aPSName.Search("extralight") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_ULTRALIGHT; - else if (aPSName.SearchAscii("ultralight") != STRING_NOTFOUND) + else if (aPSName.Search("ultralight") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_ULTRALIGHT; - else if (aPSName.SearchAscii("light") != STRING_NOTFOUND) + else if (aPSName.Search("light") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_LIGHT; - else if (aPSName.SearchAscii("thin") != STRING_NOTFOUND) + else if (aPSName.Search("thin") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_THIN; - else if (aPSName.SearchAscii("-w3") != STRING_NOTFOUND) + else if (aPSName.Search("-w3") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_LIGHT; - else if (aPSName.SearchAscii("-w4") != STRING_NOTFOUND) + else if (aPSName.Search("-w4") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_SEMILIGHT; - else if (aPSName.SearchAscii("-w5") != STRING_NOTFOUND) + else if (aPSName.Search("-w5") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_NORMAL; - else if (aPSName.SearchAscii("-w6") != STRING_NOTFOUND) + else if (aPSName.Search("-w6") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_SEMIBOLD; - else if (aPSName.SearchAscii("-w7") != STRING_NOTFOUND) + else if (aPSName.Search("-w7") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_BOLD; - else if (aPSName.SearchAscii("-w8") != STRING_NOTFOUND) + else if (aPSName.Search("-w8") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_ULTRABOLD; - else if (aPSName.SearchAscii("-w9") != STRING_NOTFOUND) + else if (aPSName.Search("-w9") != STRING_NOTFOUND) rDFA.meWeight = WEIGHT_BLACK; // heuristics for font slant - if( (aPSName.SearchAscii("italic") != STRING_NOTFOUND) - || (aPSName.SearchAscii(" ital") != STRING_NOTFOUND) - || (aPSName.SearchAscii("cursive") != STRING_NOTFOUND) - || (aPSName.SearchAscii("-it") != STRING_NOTFOUND) - || (aPSName.SearchAscii("lightit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("mediumit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("boldit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("cnit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("bdcn") != STRING_NOTFOUND) - || (aPSName.SearchAscii("bdit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("condit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("bookit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("blackit") != STRING_NOTFOUND) - || (aPSName.SearchAscii("libertineio") != STRING_NOTFOUND) ) + if( (aPSName.Search("italic") != STRING_NOTFOUND) + || (aPSName.Search(" ital") != STRING_NOTFOUND) + || (aPSName.Search("cursive") != STRING_NOTFOUND) + || (aPSName.Search("-it") != STRING_NOTFOUND) + || (aPSName.Search("lightit") != STRING_NOTFOUND) + || (aPSName.Search("mediumit") != STRING_NOTFOUND) + || (aPSName.Search("boldit") != STRING_NOTFOUND) + || (aPSName.Search("cnit") != STRING_NOTFOUND) + || (aPSName.Search("bdcn") != STRING_NOTFOUND) + || (aPSName.Search("bdit") != STRING_NOTFOUND) + || (aPSName.Search("condit") != STRING_NOTFOUND) + || (aPSName.Search("bookit") != STRING_NOTFOUND) + || (aPSName.Search("blackit") != STRING_NOTFOUND) ) rDFA.meItalic = ITALIC_NORMAL; - if( (aPSName.SearchAscii("oblique") != STRING_NOTFOUND) - || (aPSName.SearchAscii("inclined") != STRING_NOTFOUND) - || (aPSName.SearchAscii("slanted") != STRING_NOTFOUND) ) + if( (aPSName.Search("oblique") != STRING_NOTFOUND) + || (aPSName.Search("inclined") != STRING_NOTFOUND) + || (aPSName.Search("slanted") != STRING_NOTFOUND) ) rDFA.meItalic = ITALIC_OBLIQUE; // heuristics for font width - if( (aPSName.SearchAscii("condensed") != STRING_NOTFOUND) - || (aPSName.SearchAscii("-cond") != STRING_NOTFOUND) - || (aPSName.SearchAscii("boldcond") != STRING_NOTFOUND) - || (aPSName.SearchAscii("boldcn") != STRING_NOTFOUND) - || (aPSName.SearchAscii("cnit") != STRING_NOTFOUND) ) + if( (aPSName.Search("condensed") != STRING_NOTFOUND) + || (aPSName.Search("-cond") != STRING_NOTFOUND) + || (aPSName.Search("boldcond") != STRING_NOTFOUND) + || (aPSName.Search("boldcn") != STRING_NOTFOUND) + || (aPSName.Search("cnit") != STRING_NOTFOUND) ) rDFA.meWidthType = WIDTH_CONDENSED; - else if (aPSName.SearchAscii("narrow") != STRING_NOTFOUND) + else if (aPSName.Search("narrow") != STRING_NOTFOUND) rDFA.meWidthType = WIDTH_SEMI_CONDENSED; - else if (aPSName.SearchAscii("expanded") != STRING_NOTFOUND) + else if (aPSName.Search("expanded") != STRING_NOTFOUND) rDFA.meWidthType = WIDTH_EXPANDED; - else if (aPSName.SearchAscii("wide") != STRING_NOTFOUND) + else if (aPSName.Search("wide") != STRING_NOTFOUND) rDFA.meWidthType = WIDTH_EXPANDED; // heuristics for font pitch - if( (aPSName.SearchAscii("mono") != STRING_NOTFOUND) - || (aPSName.SearchAscii("courier") != STRING_NOTFOUND) - || (aPSName.SearchAscii("monaco") != STRING_NOTFOUND) - || (aPSName.SearchAscii("typewriter") != STRING_NOTFOUND) ) + if( (aPSName.Search("mono") != STRING_NOTFOUND) + || (aPSName.Search("courier") != STRING_NOTFOUND) + || (aPSName.Search("monaco") != STRING_NOTFOUND) + || (aPSName.Search("typewriter") != STRING_NOTFOUND) ) rDFA.mePitch = PITCH_FIXED; // heuristics for font family type - if( (aPSName.SearchAscii("script") != STRING_NOTFOUND) - || (aPSName.SearchAscii("chancery") != STRING_NOTFOUND) - || (aPSName.SearchAscii("zapfino") != STRING_NOTFOUND)) + if( (aPSName.Search("script") != STRING_NOTFOUND) + || (aPSName.Search("chancery") != STRING_NOTFOUND) + || (aPSName.Search("zapfino") != STRING_NOTFOUND)) rDFA.meFamily = FAMILY_SCRIPT; - else if( (aPSName.SearchAscii("comic") != STRING_NOTFOUND) - || (aPSName.SearchAscii("outline") != STRING_NOTFOUND) - || (aPSName.SearchAscii("pinpoint") != STRING_NOTFOUND) ) + else if( (aPSName.Search("comic") != STRING_NOTFOUND) + || (aPSName.Search("outline") != STRING_NOTFOUND) + || (aPSName.Search("pinpoint") != STRING_NOTFOUND) ) rDFA.meFamily = FAMILY_DECORATIVE; - else if( (aPSName.SearchAscii("sans") != STRING_NOTFOUND) - || (aPSName.SearchAscii("arial") != STRING_NOTFOUND) ) + else if( (aPSName.Search("sans") != STRING_NOTFOUND) + || (aPSName.Search("arial") != STRING_NOTFOUND) ) rDFA.meFamily = FAMILY_SWISS; - else if( (aPSName.SearchAscii("roman") != STRING_NOTFOUND) - || (aPSName.SearchAscii("times") != STRING_NOTFOUND) ) + else if( (aPSName.Search("roman") != STRING_NOTFOUND) + || (aPSName.Search("times") != STRING_NOTFOUND) ) rDFA.meFamily = FAMILY_ROMAN; // heuristics for codepoint semantic - if( (aPSName.SearchAscii("symbol") != STRING_NOTFOUND) - || (aPSName.SearchAscii("dings") != STRING_NOTFOUND) - || (aPSName.SearchAscii("dingbats") != STRING_NOTFOUND) - || (aPSName.SearchAscii("ornaments") != STRING_NOTFOUND) - || (aPSName.SearchAscii("embellishments") != STRING_NOTFOUND) ) + if( (aPSName.Search("symbol") != STRING_NOTFOUND) + || (aPSName.Search("dings") != STRING_NOTFOUND) + || (aPSName.Search("dingbats") != STRING_NOTFOUND) + || (aPSName.Search("ornaments") != STRING_NOTFOUND) + || (aPSName.Search("embellishments") != STRING_NOTFOUND) ) rDFA.mbSymbolFlag = true; + + // #i100020# special heuristic for names with single-char styles + // NOTE: we are checking name that hasn't been lower-cased + if( rPSName.Len() > 3 ) + { + int i = rPSName.Len(); + sal_Unicode c = rPSName.GetChar( --i ); + if( c == 'C' ) { // "capitals" + rDFA.meFamily = FAMILY_DECORATIVE; + c = rPSName.GetChar( --i ); + } + if( c == 'O' ) { // CFF-based OpenType + c = rPSName.GetChar( --i ); + } + if( c == 'I' ) { // "italic" + rDFA.meItalic = ITALIC_NORMAL; + c = rPSName.GetChar( --i ); + } + if( c == 'B' ) // "bold" + rDFA.meWeight = WEIGHT_BOLD; + if( c == 'C' ) // "capitals" + rDFA.meFamily = FAMILY_DECORATIVE; + // TODO: check that all single-char styles have been resolved? + } } // ----------------------------------------------------------------------- @@ -231,9 +254,9 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF continue; // heuristic to find the most common font name - // prefering default language names or even better the names matching to the UI language + // prefering default language names or even better the names matching to the UI language int nNameValue = (eFontNameLanguage==eUILangCode) ? 0 : ((eFontNameLanguage==0) ? -10 : -20); - rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE; + rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE; const int nPlatformEncoding = ((int)eFontNamePlatform << 8) + (int)eFontNameScript; switch( nPlatformEncoding ) { @@ -259,6 +282,8 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF // ignore name entries with no useful encoding if( nNameValue <= 0 ) continue; + if( nNameLength >= aNameBuffer.size() ) + continue; // get the encoded name aNameBuffer.reserve( nNameLength+1 ); // extra byte helps for debugging @@ -306,7 +331,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF case kFontStyleName: // get a style name matching to the family name if( nBestStyleValue < nNameValue ) - { + { nBestStyleValue = nNameValue; rDFA.maStyleName = aUtf16Name; } diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index c39dc26f370f..661eb64b83ce 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -36,8 +36,7 @@ #include "salbmp.h" #include "salframe.h" #include "salcolorutils.hxx" -#include "list.h" -#include "sft.h" +#include "sft.hxx" #include "salatsuifontutils.hxx" #include "vcl/impfont.hxx" @@ -58,6 +57,8 @@ #include "basegfx/polygon/b2dpolygontools.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +using namespace vcl; + typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included typedef std::vector<unsigned char> ByteVector; @@ -400,19 +401,8 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) DBG_ERROR( "no screen found" ); } - // equalize x- and y-resolution if they are close enough to prevent unneeded font stretching - if( (mnRealDPIX != mnRealDPIY) - && (10*mnRealDPIX < 13*mnRealDPIY) && (13*mnRealDPIX > 10*mnRealDPIY) ) - { - mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; - } - else // #i89650# workaround bogus device resolutions - { - if( mnRealDPIY < 72 ) - mnRealDPIY = 72; - if( mnRealDPIX < mnRealDPIY ) // e.g. for TripleHead2Go only mnRealDPIX is off - mnRealDPIX = mnRealDPIY; - } + // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) + mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; mfFakeDPIScale = 1.0; } diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index b491318bbb0d..e291dae911cf 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -922,7 +922,7 @@ private: // applications and vcl's edit fields ignore key events with ALT // however we're at a place where we know text should be inserted // so it seems we need to strip the Alt modifier here - if( (nLastModifiers & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) + if( (nLastModifiers & (NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) == NSAlternateKeyMask ) { nLastModifiers = 0; diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 9b4499cc1233..4fafbbdbb4cf 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -521,7 +521,7 @@ BOOL AquaSalMenu::VisibleMenuBar() static const char *pExperimental = getenv ("AQUA_NATIVE_MENUS"); - if ( GetSalData()->mbIsTestTool || (pExperimental && !strcasecmp(pExperimental, "FALSE")) ) + if ( ImplGetSVData()->mbIsTestTool || (pExperimental && !strcasecmp(pExperimental, "FALSE")) ) return FALSE; // End of experimental code enable/disable part diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx index abbea052c3d6..79da1b155cad 100644 --- a/vcl/aqua/source/window/salobj.cxx +++ b/vcl/aqua/source/window/salobj.cxx @@ -37,11 +37,6 @@ #include "salobj.h" #include "salframe.h" -// get QTMovieView -#include "premac.h" -#include <QTKit/QTMovieView.h> -#include "postmac.h" - // ======================================================================= AquaSalObject::AquaSalObject( AquaSalFrame* pFrame ) : @@ -66,7 +61,7 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame ) : [mpFrame->getView() addSubview: mpClipView]; [mpClipView setHidden: YES]; } - maSysData.pView = [[QTMovieView alloc] initWithFrame: aInitFrame]; + maSysData.pView = [[NSView alloc] initWithFrame: aInitFrame]; if( maSysData.pView ) { if( mpClipView ) diff --git a/vcl/inc/list.h b/vcl/inc/list.h index b86521a1f666..b801b43d77eb 100644 --- a/vcl/inc/list.h +++ b/vcl/inc/list.h @@ -51,6 +51,7 @@ extern "C" */ typedef struct _list *list; + typedef void (*list_destructor)(void *); /*- constructors and a destructor */ list listNewEmpty(void); @@ -58,7 +59,7 @@ extern "C" list listNewCopy(list); #endif void listDispose(list); - void listSetElementDtor(list, void (*f)(void *)); /*- this function will be executed when the element is removed via listRemove() or listClear() */ + void listSetElementDtor(list, list_destructor); /*- this function will be executed when the element is removed via listRemove() or listClear() */ /*- queries */ void * listCurrent(list); diff --git a/vcl/inc/sft.h b/vcl/inc/sft.hxx index efda0903afc5..5f22bc0a471f 100644 --- a/vcl/inc/sft.h +++ b/vcl/inc/sft.hxx @@ -46,7 +46,6 @@ * If NO_TYPE3 is defined CreateT3FromTTGlyphs() does not get compiled in. * If NO_TYPE42 is defined Type42-related code is excluded * If NO_TTCR is defined TrueType creation related code is excluded\ - * If NO_LIST is defined list.h and piblic functions that use it don't get compiled */ /* @@ -76,20 +75,10 @@ #include <sal/types.h> -#ifndef NO_LIST -#include "list.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif +#include <vector> -/*@{*/ -#ifndef __cplusplus -#define false 0 /**< standard false value */ -#define true 1 /**< standard true value */ -#endif -/*@}*/ +namespace vcl +{ /*@{*/ typedef sal_Int16 F2Dot14; /**< fixed: 2.14 */ @@ -349,7 +338,6 @@ extern "C" { */ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID); -#ifndef NO_LIST /** * For a specified glyph adds all component glyphs IDs to the list and * return their number. If the glyph is a single glyph it has one component @@ -365,8 +353,7 @@ extern "C" { * @ingroup sft * */ - int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, list glyphlist); -#endif + int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, std::vector< sal_uInt32 >& glyphlist); /** * Extracts all Name Records from the font and stores them in an allocated @@ -606,7 +593,7 @@ extern "C" { sal_uInt8 *cmap; int cmapType; sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32); /* character to glyphID translation function */ - void **tables; /* array of pointers to tables */ + sal_uInt8 **tables; /* array of pointers to raw subtables in SFNT file */ sal_uInt32 *tlens; /* array of table lengths */ int kerntype; /* Defined in the KernType enum */ sal_uInt32 nkern; /* number of kern subtables */ @@ -614,10 +601,6 @@ extern "C" { void *pGSubstitution; /* info provided by GSUB for UseGSUB() */ }; -#ifdef __cplusplus -} -#endif - /* indexes into _TrueTypeFont::tables[] and _TrueTypeFont::tlens[] */ #define O_maxp 0 /* 'maxp' */ #define O_glyf 1 /* 'glyf' */ @@ -638,4 +621,6 @@ extern "C" { #define O_gsub 16 /* 'GSUB' */ #define NUM_TAGS 17 +} // namespace vcl + #endif /* __SUBFONT_H */ diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index e3072a4bc250..bde902c3fbcd 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -338,6 +338,7 @@ struct ImplSVData UnoWrapperBase* mpUnoWrapper; Window* mpIntroWindow; // the splash screen DockingManager* mpDockingManager; + BOOL mbIsTestTool; vos::OThread::TThreadIdentifier mnMainThreadId; ::com::sun::star::uno::Reference< diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index 15034168269e..546f4bf2b7cd 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -74,15 +74,14 @@ #include <ft2lib.h> #endif -#ifndef __SUBFONT_H -#include <list.h> -#include <sft.h> -#endif +#include "sft.hxx" #ifdef GCP_KERN_HACK #include <algorithm> #endif +using namespace vcl; + // ----------- // - Inlines - // ----------- diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index ac93ae71bdd2..8a894cba2e55 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc NULL +vc vcl : apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 56ba933e3931..db30fd4ef3ab 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -117,6 +117,20 @@ void ImplInitSVData() pImplSVData->maHelpData.mbAutoHelpId = sal_True; pImplSVData->maHelpData.mbAutoHelpId = sal_True; pImplSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); + + // find out whether we are running in the testtool + // in this case we need some special workarounds + sal_uInt32 nArgs = osl_getCommandArgCount(); + for( sal_uInt32 i = 0; i < nArgs; i++ ) + { + rtl::OUString aArg; + osl_getCommandArg( i, &aArg.pData ); + if( aArg.equalsAscii( "-enableautomation" ) ) + { + pImplSVData->mbIsTestTool = true; + break; + } + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/fontsubset/crc32.c b/vcl/source/fontsubset/crc32.c deleted file mode 100644 index 386b873a011c..000000000000 --- a/vcl/source/fontsubset/crc32.c +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: crc32.c,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* $Id: crc32.c,v 1.3 2008-04-11 10:13:50 rt Exp $ */ - -/** - * - * @file crc32.c - * @brief CRC-32 calculation function - * @author Alexander Gelfenbain - */ - -#include "sft.h" -#include "crc32.h" - -static uint32 crcTable[256] = { - 0x00000000UL, 0x77073096UL, 0xEE0E612CUL, 0x990951BAUL, 0x076DC419UL, 0x706AF48FUL, 0xE963A535UL, 0x9E6495A3UL, - 0x0EDB8832UL, 0x79DCB8A4UL, 0xE0D5E91EUL, 0x97D2D988UL, 0x09B64C2BUL, 0x7EB17CBDUL, 0xE7B82D07UL, 0x90BF1D91UL, - 0x1DB71064UL, 0x6AB020F2UL, 0xF3B97148UL, 0x84BE41DEUL, 0x1ADAD47DUL, 0x6DDDE4EBUL, 0xF4D4B551UL, 0x83D385C7UL, - 0x136C9856UL, 0x646BA8C0UL, 0xFD62F97AUL, 0x8A65C9ECUL, 0x14015C4FUL, 0x63066CD9UL, 0xFA0F3D63UL, 0x8D080DF5UL, - 0x3B6E20C8UL, 0x4C69105EUL, 0xD56041E4UL, 0xA2677172UL, 0x3C03E4D1UL, 0x4B04D447UL, 0xD20D85FDUL, 0xA50AB56BUL, - 0x35B5A8FAUL, 0x42B2986CUL, 0xDBBBC9D6UL, 0xACBCF940UL, 0x32D86CE3UL, 0x45DF5C75UL, 0xDCD60DCFUL, 0xABD13D59UL, - 0x26D930ACUL, 0x51DE003AUL, 0xC8D75180UL, 0xBFD06116UL, 0x21B4F4B5UL, 0x56B3C423UL, 0xCFBA9599UL, 0xB8BDA50FUL, - 0x2802B89EUL, 0x5F058808UL, 0xC60CD9B2UL, 0xB10BE924UL, 0x2F6F7C87UL, 0x58684C11UL, 0xC1611DABUL, 0xB6662D3DUL, - 0x76DC4190UL, 0x01DB7106UL, 0x98D220BCUL, 0xEFD5102AUL, 0x71B18589UL, 0x06B6B51FUL, 0x9FBFE4A5UL, 0xE8B8D433UL, - 0x7807C9A2UL, 0x0F00F934UL, 0x9609A88EUL, 0xE10E9818UL, 0x7F6A0DBBUL, 0x086D3D2DUL, 0x91646C97UL, 0xE6635C01UL, - 0x6B6B51F4UL, 0x1C6C6162UL, 0x856530D8UL, 0xF262004EUL, 0x6C0695EDUL, 0x1B01A57BUL, 0x8208F4C1UL, 0xF50FC457UL, - 0x65B0D9C6UL, 0x12B7E950UL, 0x8BBEB8EAUL, 0xFCB9887CUL, 0x62DD1DDFUL, 0x15DA2D49UL, 0x8CD37CF3UL, 0xFBD44C65UL, - 0x4DB26158UL, 0x3AB551CEUL, 0xA3BC0074UL, 0xD4BB30E2UL, 0x4ADFA541UL, 0x3DD895D7UL, 0xA4D1C46DUL, 0xD3D6F4FBUL, - 0x4369E96AUL, 0x346ED9FCUL, 0xAD678846UL, 0xDA60B8D0UL, 0x44042D73UL, 0x33031DE5UL, 0xAA0A4C5FUL, 0xDD0D7CC9UL, - 0x5005713CUL, 0x270241AAUL, 0xBE0B1010UL, 0xC90C2086UL, 0x5768B525UL, 0x206F85B3UL, 0xB966D409UL, 0xCE61E49FUL, - 0x5EDEF90EUL, 0x29D9C998UL, 0xB0D09822UL, 0xC7D7A8B4UL, 0x59B33D17UL, 0x2EB40D81UL, 0xB7BD5C3BUL, 0xC0BA6CADUL, - 0xEDB88320UL, 0x9ABFB3B6UL, 0x03B6E20CUL, 0x74B1D29AUL, 0xEAD54739UL, 0x9DD277AFUL, 0x04DB2615UL, 0x73DC1683UL, - 0xE3630B12UL, 0x94643B84UL, 0x0D6D6A3EUL, 0x7A6A5AA8UL, 0xE40ECF0BUL, 0x9309FF9DUL, 0x0A00AE27UL, 0x7D079EB1UL, - 0xF00F9344UL, 0x8708A3D2UL, 0x1E01F268UL, 0x6906C2FEUL, 0xF762575DUL, 0x806567CBUL, 0x196C3671UL, 0x6E6B06E7UL, - 0xFED41B76UL, 0x89D32BE0UL, 0x10DA7A5AUL, 0x67DD4ACCUL, 0xF9B9DF6FUL, 0x8EBEEFF9UL, 0x17B7BE43UL, 0x60B08ED5UL, - 0xD6D6A3E8UL, 0xA1D1937EUL, 0x38D8C2C4UL, 0x4FDFF252UL, 0xD1BB67F1UL, 0xA6BC5767UL, 0x3FB506DDUL, 0x48B2364BUL, - 0xD80D2BDAUL, 0xAF0A1B4CUL, 0x36034AF6UL, 0x41047A60UL, 0xDF60EFC3UL, 0xA867DF55UL, 0x316E8EEFUL, 0x4669BE79UL, - 0xCB61B38CUL, 0xBC66831AUL, 0x256FD2A0UL, 0x5268E236UL, 0xCC0C7795UL, 0xBB0B4703UL, 0x220216B9UL, 0x5505262FUL, - 0xC5BA3BBEUL, 0xB2BD0B28UL, 0x2BB45A92UL, 0x5CB36A04UL, 0xC2D7FFA7UL, 0xB5D0CF31UL, 0x2CD99E8BUL, 0x5BDEAE1DUL, - 0x9B64C2B0UL, 0xEC63F226UL, 0x756AA39CUL, 0x026D930AUL, 0x9C0906A9UL, 0xEB0E363FUL, 0x72076785UL, 0x05005713UL, - 0x95BF4A82UL, 0xE2B87A14UL, 0x7BB12BAEUL, 0x0CB61B38UL, 0x92D28E9BUL, 0xE5D5BE0DUL, 0x7CDCEFB7UL, 0x0BDBDF21UL, - 0x86D3D2D4UL, 0xF1D4E242UL, 0x68DDB3F8UL, 0x1FDA836EUL, 0x81BE16CDUL, 0xF6B9265BUL, 0x6FB077E1UL, 0x18B74777UL, - 0x88085AE6UL, 0xFF0F6A70UL, 0x66063BCAUL, 0x11010B5CUL, 0x8F659EFFUL, 0xF862AE69UL, 0x616BFFD3UL, 0x166CCF45UL, - 0xA00AE278UL, 0xD70DD2EEUL, 0x4E048354UL, 0x3903B3C2UL, 0xA7672661UL, 0xD06016F7UL, 0x4969474DUL, 0x3E6E77DBUL, - 0xAED16A4AUL, 0xD9D65ADCUL, 0x40DF0B66UL, 0x37D83BF0UL, 0xA9BCAE53UL, 0xDEBB9EC5UL, 0x47B2CF7FUL, 0x30B5FFE9UL, - 0xBDBDF21CUL, 0xCABAC28AUL, 0x53B39330UL, 0x24B4A3A6UL, 0xBAD03605UL, 0xCDD70693UL, 0x54DE5729UL, 0x23D967BFUL, - 0xB3667A2EUL, 0xC4614AB8UL, 0x5D681B02UL, 0x2A6F2B94UL, 0xB40BBE37UL, 0xC30C8EA1UL, 0x5A05DF1BUL, 0x2D02EF8DUL -}; - -uint32 crc32(const void *ptr, size_t len) -{ - uint32 crc = 0xFFFFFFFF; - const byte *bp = (const byte *) ptr; - size_t i; - - for (i=0; i<len; i++) { - crc = crcTable[(crc ^ bp[i]) & 0xFF] ^ (crc >> 8); - } - - return crc ^ 0xFFFFFFFF; -} diff --git a/vcl/source/fontsubset/crc32.h b/vcl/source/fontsubset/crc32.h deleted file mode 100644 index fa9ef71a1432..000000000000 --- a/vcl/source/fontsubset/crc32.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: crc32.h,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* $Id: crc32.h,v 1.4 2008-04-11 10:14:08 rt Exp $ */ - -/** - * - * @file crc32.h - * @brief CRC-32 calculation function - * @author Alexander Gelfenbain - */ - -#ifdef __cplusplus -extern "C"{ -#endif - sal_Int32 crc32(const void *ptr, sal_Int32 len); -#ifdef __cplusplus -} -#endif diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index e73ccccc12a4..9715e7fc8585 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gsub.cxx,v $ - * $Revision: 1.12.18.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,9 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include "sft.h" -#undef true -#undef false +#include "sft.hxx" #include "gsub.h" @@ -41,6 +36,9 @@ #include <map> #include <algorithm> +namespace vcl +{ + typedef sal_uInt32 ULONG; typedef sal_uInt16 USHORT; typedef sal_uInt8 FT_Byte; @@ -355,3 +353,5 @@ int HasVerticalGSUB( struct _TrueTypeFont* pTTFile ) GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; return pGlyphSubstitution ? +1 : 0; } + +} diff --git a/vcl/source/fontsubset/gsub.h b/vcl/source/fontsubset/gsub.h index c64b2abb7e00..58b5b69c3e25 100644 --- a/vcl/source/fontsubset/gsub.h +++ b/vcl/source/fontsubset/gsub.h @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gsub.h,v $ - * $Revision: 1.6.18.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,20 +28,17 @@ #ifndef _PSP_GSUB_H #define _PSP_GSUB_H -#ifdef __cplusplus -extern "C" { -#endif +namespace vcl +{ -int HasVerticalGSUB( struct _TrueTypeFont* pTTFile ); +int HasVerticalGSUB( struct vcl::_TrueTypeFont* pTTFile ); -int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph, int wmode ); +int UseGSUB( struct vcl::_TrueTypeFont* pTTFile, int nGlyph, int wmode ); -int ReadGSUB( struct _TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ); +int ReadGSUB( struct vcl::_TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ); -void ReleaseGSUB( struct _TrueTypeFont* pTTFile ); +void ReleaseGSUB( struct vcl::_TrueTypeFont* pTTFile ); -#ifdef __cplusplus } -#endif #endif /* _PSP_GSUB_H */ diff --git a/vcl/source/fontsubset/list.c b/vcl/source/fontsubset/list.c index 83ebe8595a46..86864650db85 100644 --- a/vcl/source/fontsubset/list.c +++ b/vcl/source/fontsubset/list.c @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: list.c,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,8 +25,6 @@ * ************************************************************************/ -/* $Id: list.c,v 1.8 2008-06-25 14:19:44 kz Exp $ */ - /*[]---------------------------------------------------[]*/ /*| |*/ /*| list.c - bidirectional list class |*/ @@ -67,7 +62,7 @@ typedef struct _lnode { struct _list { lnode *head, *tail, *cptr; size_t aCount; - void (*eDtor)(void *); + list_destructor eDtor; }; /*- private methods */ @@ -177,7 +172,7 @@ void listDispose(list this) /*- dtor */ free(this); } -void listSetElementDtor(list this, void (*f)(void *)) +void listSetElementDtor(list this, list_destructor f) { assert(this != 0); this->eDtor = f; diff --git a/vcl/source/fontsubset/makefile.mk b/vcl/source/fontsubset/makefile.mk index b1d2552752a8..b7d719f3c912 100644 --- a/vcl/source/fontsubset/makefile.mk +++ b/vcl/source/fontsubset/makefile.mk @@ -6,10 +6,6 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/vcl/source/fontsubset/sft.c b/vcl/source/fontsubset/sft.cxx index be54a872fd7f..10d4cf774b04 100644 --- a/vcl/source/fontsubset/sft.c +++ b/vcl/source/fontsubset/sft.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sft.c,v $ - * $Revision: 1.47.4.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,32 +46,33 @@ #include <sys/mman.h> #include <sys/stat.h> #endif -#include "sft.h" +#include "sft.hxx" #include "gsub.h" #if ! (defined(NO_TTCR) && defined(NO_TYPE42)) -#include "ttcr.h" -#endif -#ifdef NO_LIST -#include "list.h" /* list.h does not get included in the sft.h */ +#include "ttcr.hxx" #endif #ifndef NO_MAPPERS /* include MapChar() and MapString() */ -#include "xlat.h" +#include "xlat.hxx" #endif #ifndef NO_TYPE3 /* include CreateT3FromTTGlyphs() */ #include <rtl/crc.h> #endif #include <osl/endian.h> +#include <algorithm> #ifdef TEST7 #include <ctype.h> #endif +namespace vcl +{ + /*- module identification */ -const char *modname = "SunTypeTools-TT"; -const char *modver = "1.0"; -const char *modextra = "gelf"; +static const char *modname = "SunTypeTools-TT"; +static const char *modver = "1.0"; +static const char *modextra = "gelf"; /*- private functions, constants and data types */ /*FOLD00*/ @@ -86,12 +84,20 @@ enum PathSegmentType { PS_CLOSEPATH = 4 }; -typedef struct { - int type; +struct PSPathElement +{ + PathSegmentType type; int x1, y1; int x2, y2; int x3, y3; -} PSPathElement; + + PSPathElement( PathSegmentType i_eType ) : type( i_eType ), + x1( 0 ), y1( 0 ), + x2( 0 ), y2( 0 ), + x3( 0 ), y3( 0 ) + { + } +}; /*- In horisontal writing mode right sidebearing is calculated using this formula *- rsb = aw - (lsb + xMax - xMin) -*/ @@ -412,7 +418,7 @@ _inline const char *UnicodeRangeName(sal_uInt16 bit) _inline sal_uInt8 *getTable(TrueTypeFont *ttf, sal_uInt32 ord) { - return ttf->tables[ord]; + return (sal_uInt8*)ttf->tables[ord]; } _inline sal_uInt32 getTableSize(TrueTypeFont *ttf, sal_uInt32 ord) @@ -426,7 +432,7 @@ static char HexChars[] = "0123456789ABCDEF"; static HexFmt *HexFmtNew(FILE *outf) { - HexFmt *res = smalloc(sizeof(HexFmt)); + HexFmt* res = (HexFmt*)smalloc(sizeof(HexFmt)); res->bufpos = res->total = 0; res->o = outf; return res; @@ -515,7 +521,7 @@ static void GetMetrics(TrueTypeFont *ttf, sal_uInt32 glyphID, TTGlyphMetrics *me } } -static int GetTTGlyphOutline(TrueTypeFont *, sal_uInt32 , ControlPoint **, TTGlyphMetrics *, list ); +static int GetTTGlyphOutline(TrueTypeFont *, sal_uInt32 , ControlPoint **, TTGlyphMetrics *, std::vector< sal_uInt32 >* ); /* returns the number of control points, allocates the pointArray */ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics) /*FOLD02*/ @@ -525,7 +531,6 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin sal_Int16 numberOfContours; sal_uInt16 t, instLen, lastPoint=0; int i, j, z; - ControlPoint* pa; *pointArray = 0; @@ -551,7 +556,7 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin instLen = GetUInt16(ptr, 10 + numberOfContours*2, 1); p = ptr + 10 + 2 * numberOfContours + 2 + instLen; - pa = calloc(lastPoint+1, sizeof(ControlPoint)); + ControlPoint* pa = (ControlPoint*)calloc(lastPoint+1, sizeof(ControlPoint)); i = 0; while (i <= lastPoint) { @@ -608,13 +613,13 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin return lastPoint + 1; } -static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics, list glyphlist) /*FOLD02*/ +static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics, std::vector< sal_uInt32 >& glyphlist) /*FOLD02*/ { sal_uInt16 flags, index; sal_Int16 e, f, numberOfContours; sal_uInt8 *table = getTable(ttf, O_glyf); sal_uInt8 *ptr; - list myPoints; + std::vector<ControlPoint> myPoints; ControlPoint *nextComponent, *pa; int i, np; F16Dot16 a = 0x10000, b = 0, c = 0, d = 0x10000, m, n, abs1, abs2, abs3; @@ -630,9 +635,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo return 0; } - myPoints = listNewEmpty(); - listSetElementDtor(myPoints, free); - if (metrics) { metrics->xMin = GetInt16(ptr, 2, 1); metrics->yMin = GetInt16(ptr, 4, 1); @@ -649,27 +651,30 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo index = GetUInt16(ptr, 2, 1); ptr += 4; - if (listFind(glyphlist, (void *) (sal_IntPtr) index)) { + if( std::find( glyphlist.begin(), glyphlist.end(), index ) != glyphlist.end() ) + { #if OSL_DEBUG_LEVEL > 1 fprintf(stderr, "Endless loop found in a compound glyph.\n"); fprintf(stderr, "%d -> ", index); - listToFirst(glyphlist); fprintf(stderr," ["); - do { - fprintf(stderr,"%d ", (int) listCurrent(glyphlist)); - } while (listNext(glyphlist)); + for( std::vector< sal_uInt32 >::const_iterator it = glyphlist.begin(); + it != glyphlist.end(); ++it ) + { + fprintf( stderr,"%d ", (int) *it ); + } fprintf(stderr,"]\n"); /**/ #endif } - listAppend(glyphlist, (void *) (sal_IntPtr) index); + glyphlist.push_back( index ); #ifdef DEBUG2 fprintf(stderr,"glyphlist: += %d\n", index); #endif - if ((np = GetTTGlyphOutline(ttf, index, &nextComponent, 0, glyphlist)) == 0) { + if ((np = GetTTGlyphOutline(ttf, index, &nextComponent, 0, &glyphlist)) == 0) + { /* XXX that probably indicates a corrupted font */ #if OSL_DEBUG_LEVEL > 1 fprintf(stderr, "An empty compound!\n"); @@ -677,20 +682,20 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo #endif } - listToLast(glyphlist); #ifdef DEBUG2 - listToFirst(glyphlist); - fprintf(stderr,"%d [", listCount(glyphlist)); - if (!listIsEmpty(glyphlist)) { - do { - fprintf(stderr,"%d ", (int) listCurrent(glyphlist)); - } while (listNext(glyphlist)); + fprintf(stderr,"%d [", (int)glyphlist.size() ); + for( std::vector< sal_uInt32 >::const_iterator it = glyphlist.begin(); + it != glyphlist.end(); ++it ) + { + fprintf( stderr,"%d ", (int) *it ); } fprintf(stderr, "]\n"); - fprintf(stderr, "glyphlist: -= %d\n", (int) listCurrent(glyphlist)); + if( ! glyphlist.empty() ) + fprintf(stderr, "glyphlist: -= %d\n", (int) glyphlist.back()); #endif - listRemove(glyphlist); + if( ! glyphlist.empty() ) + glyphlist.pop_back(); if (flags & USE_MY_METRICS) { if (metrics) GetMetrics(ttf, index, metrics); @@ -774,18 +779,18 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo for (i=0; i<np; i++) { F16Dot16 t; - ControlPoint *cp = malloc(sizeof(ControlPoint)); - cp->flags = nextComponent[i].flags; + ControlPoint cp; + cp.flags = nextComponent[i].flags; t = fixedMulDiv(a, nextComponent[i].x << 16, m) + fixedMulDiv(c, nextComponent[i].y << 16, m) + (e << 16); - cp->x = (sal_Int16)(fixedMul(t, m) >> 16); + cp.x = (sal_Int16)(fixedMul(t, m) >> 16); t = fixedMulDiv(b, nextComponent[i].x << 16, n) + fixedMulDiv(d, nextComponent[i].y << 16, n) + (f << 16); - cp->y = (sal_Int16)(fixedMul(t, n) >> 16); + cp.y = (sal_Int16)(fixedMul(t, n) >> 16); #ifdef DEBUG2 - fprintf(stderr, "( %d %d ) -> ( %d %d )\n", nextComponent[i].x, nextComponent[i].y, cp->x, cp->y); + fprintf(stderr, "( %d %d ) -> ( %d %d )\n", nextComponent[i].x, nextComponent[i].y, cp.x, cp.y); #endif - listAppend(myPoints, cp); + myPoints.push_back( cp ); } free(nextComponent); @@ -794,16 +799,12 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo - np = listCount(myPoints); + np = myPoints.size(); - pa = calloc(np, sizeof(ControlPoint)); + pa = (ControlPoint*)calloc(np, sizeof(ControlPoint)); assert(pa != 0); - listToFirst(myPoints); - for (i=0; i<np; i++) { - memcpy(pa+i, listCurrent(myPoints), sizeof(ControlPoint)); - listNext(myPoints); - } - listDispose(myPoints); + + memcpy( pa, &myPoints[0], np*sizeof(ControlPoint) ); *pointArray = pa; return np; @@ -816,7 +817,7 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo * a composite glyph. This is a safequard against endless recursion * in corrupted fonts. */ -static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics, list glyphlist) +static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics, std::vector< sal_uInt32 >* glyphlist) { sal_uInt8 *ptr, *table = getTable(ttf, O_glyf); sal_Int16 numberOfContours; @@ -840,21 +841,15 @@ static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint numberOfContours = GetInt16(ptr, 0, 1); - if (numberOfContours >= 0) { + if (numberOfContours >= 0) + { res=GetSimpleTTOutline(ttf, glyphID, pointArray, metrics); - } else { - int glyphlistFlag = 0; - if (!glyphlist) { - glyphlistFlag = 1; - glyphlist = listNewEmpty(); - listAppend(glyphlist, (void *) (sal_IntPtr) glyphID); - } - res = GetCompoundTTOutline(ttf, glyphID, pointArray, metrics, glyphlist); - if (glyphlistFlag) { - glyphlistFlag = 0; - listDispose(glyphlist); - glyphlist = 0; - } + } + else + { + std::vector< sal_uInt32 > aPrivList; + aPrivList.push_back( glyphID ); + res = GetCompoundTTOutline(ttf, glyphID, pointArray, metrics, glyphlist ? *glyphlist : aPrivList ); } #ifdef DEBUG3 @@ -877,22 +872,13 @@ static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint #ifndef NO_TYPE3 -static PSPathElement *newPSPathElement(int t) -{ - PSPathElement *p = malloc(sizeof(PSPathElement)); - assert(p != 0); - - p->type = t; - return p; -} - /*- returns the number of items in the path -*/ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **path) { - list pList = listNewEmpty(); - int i = 0, pCount = 0; - PSPathElement *p; + std::vector< PSPathElement > aPathList; + int nPathCount = 0; + PSPathElement p( PS_NOOP ); int x0 = 0, y0 = 0, x1 = 0, y1 = 0, x2, y2, curx, cury; int lastOff = 0; /*- last point was off-contour */ @@ -901,7 +887,6 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat int cp = 0; /*- current point */ int StartContour = 0, EndContour = 1; - listSetElementDtor(pList, free); *path = 0; /* if (srcCount > 0) for(;;) */ @@ -919,21 +904,21 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat break; } } - p = newPSPathElement(PS_MOVETO); + p = PSPathElement(PS_MOVETO); if (!(srcA[cp].flags & 1)) { if (!(srcA[EndContour].flags & 1)) { - p->x1 = x0 = (srcA[cp].x + srcA[EndContour].x + 1) / 2; - p->y1 = y0 = (srcA[cp].y + srcA[EndContour].y + 1) / 2; + p.x1 = x0 = (srcA[cp].x + srcA[EndContour].x + 1) / 2; + p.y1 = y0 = (srcA[cp].y + srcA[EndContour].y + 1) / 2; } else { - p->x1 = x0 = srcA[EndContour].x; - p->y1 = y0 = srcA[EndContour].y; + p.x1 = x0 = srcA[EndContour].x; + p.y1 = y0 = srcA[EndContour].y; } } else { - p->x1 = x0 = srcA[cp].x; - p->y1 = y0 = srcA[cp].y; + p.x1 = x0 = srcA[cp].x; + p.y1 = y0 = srcA[cp].y; cp++; } - listAppend(pList, p); + aPathList.push_back( p ); lastOff = 0; scflag = 0; } @@ -941,38 +926,45 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat curx = srcA[cp].x; cury = srcA[cp].y; - if (srcA[cp].flags & 1) { - if (lastOff) { - p = newPSPathElement(PS_CURVETO); - p->x1 = x0 + (2 * (x1 - x0) + 1) / 3; - p->y1 = y0 + (2 * (y1 - y0) + 1) / 3; - p->x2 = x1 + (curx - x1 + 1) / 3; - p->y2 = y1 + (cury - y1 + 1) / 3; - p->x3 = curx; - p->y3 = cury; - listAppend(pList, p); - } else { - if (!(x0 == curx && y0 == cury)) { /* eliminate empty lines */ - p = newPSPathElement(PS_LINETO); - p->x1 = curx; - p->y1 = cury; - listAppend(pList, p); + if (srcA[cp].flags & 1) + { + if (lastOff) + { + p = PSPathElement(PS_CURVETO); + p.x1 = x0 + (2 * (x1 - x0) + 1) / 3; + p.y1 = y0 + (2 * (y1 - y0) + 1) / 3; + p.x2 = x1 + (curx - x1 + 1) / 3; + p.y2 = y1 + (cury - y1 + 1) / 3; + p.x3 = curx; + p.y3 = cury; + aPathList.push_back( p ); + } + else + { + if (!(x0 == curx && y0 == cury)) + { /* eliminate empty lines */ + p = PSPathElement(PS_LINETO); + p.x1 = curx; + p.y1 = cury; + aPathList.push_back( p ); } } - x0 = curx; y0 = cury; lastOff = 0; - } else { - if (lastOff) { + } + else + { + if (lastOff) + { x2 = (x1 + curx + 1) / 2; y2 = (y1 + cury + 1) / 2; - p = newPSPathElement(PS_CURVETO); - p->x1 = x0 + (2 * (x1 - x0) + 1) / 3; - p->y1 = y0 + (2 * (y1 - y0) + 1) / 3; - p->x2 = x1 + (x2 - x1 + 1) / 3; - p->y2 = y1 + (y2 - y1 + 1) / 3; - p->x3 = x2; - p->y3 = y2; - listAppend(pList, p); + p = PSPathElement(PS_CURVETO); + p.x1 = x0 + (2 * (x1 - x0) + 1) / 3; + p.y1 = y0 + (2 * (y1 - y0) + 1) / 3; + p.x2 = x1 + (x2 - x1 + 1) / 3; + p.y2 = y1 + (y2 - y1 + 1) / 3; + p.x3 = x2; + p.y3 = y2; + aPathList.push_back( p ); x0 = x2; y0 = y2; x1 = curx; y1 = cury; } else { @@ -982,7 +974,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat } if (ecflag) { - listAppend(pList, newPSPathElement(PS_CLOSEPATH)); + aPathList.push_back( PSPathElement(PS_CLOSEPATH) ); scflag = 1; ecflag = 0; cp = EndContour + 1; @@ -999,19 +991,14 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat } } - if ((pCount = listCount(pList)) > 0) { - p = calloc(pCount, sizeof(PSPathElement)); - assert(p != 0); - listToFirst(pList); - for (i=0; i<pCount; i++) { - memcpy(p + i, listCurrent(pList), sizeof(PSPathElement)); - listNext(pList); - } - *path = p; + if( (nPathCount = (int)aPathList.size()) > 0) + { + *path = (PSPathElement*)calloc(nPathCount, sizeof(PSPathElement)); + assert(*path != 0); + memcpy( *path, &aPathList[0], nPathCount * sizeof(PSPathElement) ); } - listDispose(pList); - return pCount; + return nPathCount; } #endif @@ -1036,18 +1023,18 @@ static char *nameExtract(sal_uInt8 *name, int nTableSize, int n, int dbFlag, sal if( ucs2result ) *ucs2result = NULL; if (dbFlag) { - res = malloc(1 + len/2); + res = (char*)malloc(1 + len/2); assert(res != 0); for (i = 0; i < len/2; i++) res[i] = *(ptr + i * 2 + 1); res[len/2] = 0; if( ucs2result ) { - *ucs2result = malloc( len+2 ); + *ucs2result = (sal_uInt16*)malloc( len+2 ); for (i = 0; i < len/2; i++ ) (*ucs2result)[i] = GetUInt16( ptr, 2*i, 1 ); (*ucs2result)[len/2] = 0; } } else { - res = malloc(1 + len); + res = (char*)malloc(1 + len); assert(res != 0); memcpy(res, ptr, len); res[len] = 0; @@ -1493,7 +1480,7 @@ static void GetKern(TrueTypeFont *ttf) if (GetUInt16(table, 0, 1) == 0) { /* Traditional Microsoft style table with USHORT version and nTables fields */ ttf->nkern = GetUInt16(table, 2, 1); - ttf->kerntables = calloc(ttf->nkern, sizeof(sal_uInt8 *)); + ttf->kerntables = (sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *)); assert(ttf->kerntables != 0); memset(ttf->kerntables, 0, ttf->nkern * sizeof(sal_uInt8 *)); ttf->kerntype = KT_MICROSOFT; @@ -1513,7 +1500,7 @@ static void GetKern(TrueTypeFont *ttf) if (GetUInt32(table, 0, 1) == 0x00010000) { /* MacOS style kern tables: fixed32 version and sal_uInt32 nTables fields */ ttf->nkern = GetUInt32(table, 4, 1); - ttf->kerntables = calloc(ttf->nkern, sizeof(sal_uInt8 *)); + ttf->kerntables = (sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8*)); assert(ttf->kerntables != 0); memset(ttf->kerntables, 0, ttf->nkern * sizeof(sal_uInt8 *)); ttf->kerntype = KT_APPLE_NEW; @@ -1630,7 +1617,7 @@ int CountTTCFonts(const char* fname) static void allocTrueTypeFont( TrueTypeFont** ttf ) { - *ttf = calloc(1,sizeof(TrueTypeFont)); + *ttf = (TrueTypeFont*)calloc(1,sizeof(TrueTypeFont)); if( *ttf != NULL ) { (*ttf)->tag = 0; @@ -1714,7 +1701,7 @@ int OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTyp (*ttf)->fname = NULL; (*ttf)->fsize = nLen; - (*ttf)->ptr = pBuffer; + (*ttf)->ptr = (sal_uInt8*)pBuffer; return doOpenTTFont( facenum, *ttf ); } @@ -1722,13 +1709,11 @@ int OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTyp static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) { int i; - sal_uInt32 version; - sal_uInt8 *table, *offset; sal_uInt32 length, tag; sal_uInt32 tdoffset = 0; /* offset to TableDirectory in a TTC file. For TTF files is 0 */ int indexfmt, k; - version = GetInt32(t->ptr, 0, 1); + sal_uInt32 version = GetInt32(t->ptr, 0, 1); if ((version == 0x00010000) || (version == T_true)) { tdoffset = 0; @@ -1758,9 +1743,9 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) if( t->ntables >= 128 ) return SF_TTFORMAT; - t->tables = calloc(NUM_TAGS, sizeof(void *)); + t->tables = (sal_uInt8**)calloc(NUM_TAGS, sizeof(sal_uInt8*)); assert(t->tables != 0); - t->tlens = calloc(NUM_TAGS, sizeof(sal_uInt32)); + t->tlens = (sal_uInt32*)calloc(NUM_TAGS, sizeof(sal_uInt32)); assert(t->tlens != 0); memset(t->tables, 0, NUM_TAGS * sizeof(void *)); @@ -1791,22 +1776,23 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) default: nIndex = -1; break; } if( nIndex >= 0 ) { - offset = t->ptr + GetUInt32(t->ptr + tdoffset + 12, 16 * i + 8, 1); + sal_uInt32 nTableOffset = GetUInt32(t->ptr + tdoffset + 12, 16 * i + 8, 1); length = GetUInt32(t->ptr + tdoffset + 12, 16 * i + 12, 1); - t->tables[nIndex] = offset; + t->tables[nIndex] = t->ptr + nTableOffset; t->tlens[nIndex] = length; } } /* Fixup offsets when only a TTC extract was provided */ if( facenum == (sal_uInt32)~0 ) { - sal_uInt8 *pHead = t->tables[O_head], *p = NULL; + sal_uInt8* pHead = (sal_uInt8*)t->tables[O_head]; if( !pHead ) return SF_TTFORMAT; /* limit Head candidate to TTC extract's limits */ if( pHead > t->ptr + (t->fsize - 54) ) pHead = t->ptr + (t->fsize - 54); /* TODO: find better method than searching head table's magic */ + sal_uInt8* p = NULL; for( p = pHead + 12; p > t->ptr; --p ) { if( p[0]==0x5F && p[1]==0x0F && p[2]==0x3C && p[3]==0xF5 ) { int nDelta = (pHead + 12) - p, j; @@ -1861,7 +1847,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) return SF_TTFORMAT; } - table = getTable(t, O_maxp); + sal_uInt8* table = getTable(t, O_maxp); t->nglyphs = GetUInt16(table, 4, 1); table = getTable(t, O_head); @@ -1931,10 +1917,7 @@ int GetTTGlyphPoints(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **point return GetTTGlyphOutline(ttf, glyphID, pointArray, 0, 0); } -#ifdef NO_LIST -static -#endif -int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, list glyphlist) +int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, std::vector< sal_uInt32 >& glyphlist) { sal_uInt8 *ptr, *glyf = getTable(ttf, O_glyf); int n = 1; @@ -1942,7 +1925,7 @@ int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, list glyphlist) if (glyphID >= ttf->nglyphs) return 0; ptr = glyf + ttf->goffsets[glyphID]; - listAppend(glyphlist, (void *) (sal_IntPtr) glyphID); + glyphlist.push_back( glyphID ); if (GetInt16(ptr, 0, 1) == -1) { sal_uInt16 flags, index; @@ -2089,8 +2072,10 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO XUnits(UPEm, metrics.xMax), XUnits(UPEm, metrics.yMax)); - for (j = 0; j < n; j++) { - switch (path[j].type) { + for (j = 0; j < n; j++) + { + switch (path[j].type) + { case PS_MOVETO: fprintf(outf, "\t%d %d moveto\n", XUnits(UPEm, path[j].x1), XUnits(UPEm, path[j].y1)); break; @@ -2106,6 +2091,8 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO case PS_CLOSEPATH: fprintf(outf, "\tclosepath\n"); break; + case PS_NOOP: + break; } } if (n > 0) fprintf(outf, "\tfill\n"); /* if glyph is not a whitespace character */ @@ -2139,7 +2126,6 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, sal_uInt8 *p; int i; int res; - sal_uInt32 *gID; TrueTypeCreatorNewEmpty(T_true, &ttcr); @@ -2210,7 +2196,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, /** glyf **/ glyf = TrueTypeTableNew_glyf(); - gID = scalloc(nGlyphs, sizeof(sal_uInt32)); + sal_uInt32* gID = (sal_uInt32*)scalloc(nGlyphs, sizeof(sal_uInt32)); for (i = 0; i < nGlyphs; i++) { gID[i] = glyfAdd(glyf, GetTTRawGlyphData(ttf, glyphArray[i]), ttf); @@ -2277,7 +2263,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, #ifndef NO_TYPE42 static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP) { - GlyphOffsets *res = smalloc(sizeof(GlyphOffsets)); + GlyphOffsets* res = (GlyphOffsets*)smalloc(sizeof(GlyphOffsets)); sal_uInt8 *loca = NULL; sal_uInt16 i, numTables = GetUInt16(sfntP, 4, 1); sal_uInt32 locaLen = 0; @@ -2298,7 +2284,7 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP) res->nGlyphs = locaLen / ((indexToLocFormat == 1) ? 4 : 2); assert(res->nGlyphs != 0); - res->offs = scalloc(res->nGlyphs, sizeof(sal_uInt32)); + res->offs = (sal_uInt32*)scalloc(res->nGlyphs, sizeof(sal_uInt32)); for (i = 0; i < res->nGlyphs; i++) { if (indexToLocFormat == 1) { @@ -2322,14 +2308,13 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP) { HexFmt *h = HexFmtNew(outf); sal_uInt16 i, numTables = GetUInt16(sfntP, 4, 1); - sal_uInt32 j, *offs, *len; GlyphOffsets *go = GlyphOffsetsNew(sfntP); sal_uInt8 pad[] = {0,0,0,0}; /* zeroes */ assert(numTables <= 9); /* Type42 has 9 required tables */ - offs = scalloc(numTables, sizeof(sal_uInt32)); - len = scalloc(numTables, sizeof(sal_uInt32)); + sal_uInt32* offs = (sal_uInt32*)scalloc(numTables, sizeof(sal_uInt32)); +// sal_uInt32* lens = (sal_uInt32*)scalloc(numTables, sizeof(sal_uInt32)); fputs("/sfnts [", outf); HexFmtOpenString(h); @@ -2345,7 +2330,7 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP) HexFmtBlockWrite(h, sfntP + off, len); } else { sal_uInt8 *glyf = sfntP + off; - sal_uInt32 o, l; + sal_uInt32 o, l, j; for (j = 0; j < go->nGlyphs - 1; j++) { o = go->offs[j]; l = go->offs[j + 1] - o; @@ -2359,7 +2344,7 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP) GlyphOffsetsDispose(go); HexFmtDispose(h); free(offs); - free(len); +// free(lens); } int CreateT42FromTTGlyphs(TrueTypeFont *ttf, @@ -2382,8 +2367,6 @@ int CreateT42FromTTGlyphs(TrueTypeFont *ttf, sal_uInt32 sfntLen; int UPEm = ttf->unitsPerEm; - sal_uInt16 *gID; - if (nGlyphs >= 256) return SF_GLYPHNUM; assert(psname != 0); @@ -2425,7 +2408,7 @@ int CreateT42FromTTGlyphs(TrueTypeFont *ttf, /** glyf **/ glyf = TrueTypeTableNew_glyf(); - gID = scalloc(nGlyphs, sizeof(sal_uInt32)); + sal_uInt16* gID = (sal_uInt16*)scalloc(nGlyphs, sizeof(sal_uInt32)); for (i = 0; i < nGlyphs; i++) { gID[i] = (sal_uInt16)glyfAdd(glyf, GetTTRawGlyphData(ttf, glyphArray[i]), ttf); @@ -2571,7 +2554,6 @@ int GetTTGlyphCount( TrueTypeFont* ttf ) TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *glyphArray, int nGlyphs, int mode) { sal_uInt8* pTable; - TTSimpleGlyphMetrics *res; int i; sal_uInt16 glyphID; sal_uInt32 n; @@ -2591,7 +2573,7 @@ TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *gly if (!nGlyphs || !glyphArray) return 0; /* invalid parameters */ if (!n || !pTable) return 0; /* the font does not contain the requested metrics */ - res = calloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); + TTSimpleGlyphMetrics* res = (TTSimpleGlyphMetrics*)calloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); assert(res != 0); for (i=0; i<nGlyphs; i++) { @@ -2612,15 +2594,13 @@ TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *gly if( nAdvOffset >= nTableSize) res[i].adv = 0; /* better than a crash for buggy fonts */ else - res[i].adv = SAL_INT_CAST( - sal_uInt16, + res[i].adv = static_cast<sal_uInt16>( XUnits( UPEm, GetUInt16( pTable, nAdvOffset, 1) ) ); if( nLsbOffset >= nTableSize) res[i].sb = 0; /* better than a crash for buggy fonts */ else - res[i].sb = SAL_INT_CAST( - sal_Int16, + res[i].sb = static_cast<sal_Int16>( XUnits( UPEm, GetInt16( pTable, nLsbOffset, 1) ) ); } @@ -2631,10 +2611,9 @@ TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *gly TTSimpleGlyphMetrics *GetTTSimpleCharMetrics(TrueTypeFont * ttf, sal_uInt16 firstChar, int nChars, int mode) { TTSimpleGlyphMetrics *res = 0; - sal_uInt16 *str; int i, n; - str = malloc(nChars * 2); + sal_uInt16* str = (sal_uInt16*)malloc(nChars * 2); assert(str != 0); for (i=0; i<nChars; i++) str[i] = (sal_uInt16)(firstChar + i); @@ -2742,7 +2721,6 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID) sal_uInt8 *glyf = getTable(ttf, O_glyf); sal_uInt8 *hmtx = getTable(ttf, O_hmtx); sal_uInt32 length; - GlyphData *d; ControlPoint *cp; int i, n, m; @@ -2756,11 +2734,11 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID) length = ttf->goffsets[glyphID+1] - ttf->goffsets[glyphID]; - d = malloc(sizeof(GlyphData)); assert(d != 0); + GlyphData* d = (GlyphData*)malloc(sizeof(GlyphData)); assert(d != 0); if (length > 0) { sal_uInt8 *srcptr = glyf + ttf->goffsets[glyphID]; - d->ptr = malloc((length + 1) & ~1); assert(d->ptr != 0); + d->ptr = (sal_uInt8*)malloc((length + 1) & ~1); assert(d->ptr != 0); memcpy( d->ptr, srcptr, length ); d->compflag = (GetInt16( srcptr, 0, 1 ) < 0); } else { @@ -2811,7 +2789,7 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr) *nr = 0; if (n == 0) return 0; - rec = calloc(n, sizeof(NameRecord)); + rec = (NameRecord*)calloc(n, sizeof(NameRecord)); for (i = 0; i < n; i++) { int nStrOffset = GetUInt16(table + 6, 10 + 12 * i, 1); @@ -2864,7 +2842,7 @@ void DisposeNameRecords(NameRecord* nr, int n) free(nr); } - +} // namespace vcl #ifdef TEST1 diff --git a/vcl/source/fontsubset/ttcr.c b/vcl/source/fontsubset/ttcr.cxx index e8c9d8cf74e0..7f9ae796142b 100644 --- a/vcl/source/fontsubset/ttcr.c +++ b/vcl/source/fontsubset/ttcr.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ttcr.c,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,8 +25,6 @@ * ************************************************************************/ -/* $Id: ttcr.c,v 1.11 2008-04-11 10:16:51 rt Exp $ */ - /* * TrueTypeCreator method implementation * @@ -48,7 +43,22 @@ #endif #include <assert.h> -#include "ttcr.h" +#include "ttcr.hxx" +#include "list.h" + + + +namespace vcl +{ + +/* + * Private Data Types + */ + + struct _TrueTypeCreator { + sal_uInt32 tag; /**< TrueType file tag */ + list tables; /**< List of table tags and pointers */ + }; /* These must be #defined so that they can be used in initializers */ #define T_maxp 0x6D617870 @@ -159,7 +169,6 @@ _inline void PutInt16(sal_Int16 val, sal_uInt8 *ptr, sal_uInt32 offset, int bige ptr[offset+1] = (sal_uInt8)((val >> 8) & 0xFF); ptr[offset] = (sal_uInt8)(val & 0xFF); } - } _inline void PutUInt16(sal_uInt16 val, sal_uInt8 *ptr, sal_uInt32 offset, int bigendian) @@ -173,10 +182,8 @@ _inline void PutUInt16(sal_uInt16 val, sal_uInt8 *ptr, sal_uInt32 offset, int bi ptr[offset+1] = (sal_uInt8)((val >> 8) & 0xFF); ptr[offset] = (sal_uInt8)(val & 0xFF); } - } - _inline void PutUInt32(sal_uInt32 val, sal_uInt8 *ptr, sal_uInt32 offset, int bigendian) { assert(ptr != 0); @@ -267,22 +274,16 @@ _inline void *scalloc(sal_uInt32 n, sal_uInt32 size) void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this) { - TrueTypeCreator *ptr = smalloc(sizeof(TrueTypeCreator)); + TrueTypeCreator* ptr = (TrueTypeCreator*)smalloc(sizeof(TrueTypeCreator)); ptr->tables = listNewEmpty(); - listSetElementDtor(ptr->tables, (void(*)(void*))TrueTypeTableDispose); + listSetElementDtor(ptr->tables, (list_destructor)TrueTypeTableDispose); ptr->tag = tag; *_this = ptr; } -void TrueTypeCreatorDispose(TrueTypeCreator *_this) -{ - listDispose(_this->tables); - free(_this); -} - int AddTable(TrueTypeCreator *_this, TrueTypeTable *table) { if (table != 0) { @@ -316,9 +317,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) sal_uInt16 numTables, searchRange=1, entrySelector=0, rangeShift; sal_uInt32 s, offset, checkSumAdjustment = 0; sal_uInt32 *p; - sal_uInt8 *ttf; int i=0, n; - TableEntry *te; sal_uInt8 *head = NULL; /* saved pointer to the head table data for checkSumAdjustment calculation */ if ((n = listCount(_this->tables)) == 0) return SF_TTFORMAT; @@ -331,7 +330,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) numTables = (sal_uInt16) n; - te = scalloc(n, sizeof(TableEntry)); + TableEntry* te = (TableEntry*)scalloc(n, sizeof(TableEntry)); listToFirst(_this->tables); for (i = 0; i < n; i++) { @@ -357,7 +356,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length) /* if ((te[i].length & 3) != 0) s += (4 - (te[i].length & 3)) & 3; */ } - ttf = smalloc(s); + sal_uInt8* ttf = (sal_uInt8*)smalloc(s); /* Offset Table */ PutUInt32(_this->tag, ttf, 0, 1); @@ -486,10 +485,9 @@ typedef struct { static sal_uInt8 *ttmalloc(sal_uInt32 nbytes) { sal_uInt32 n; - sal_uInt8 *res; n = (nbytes + 3) & (sal_uInt32) ~3; - res = malloc(n); + sal_uInt8* res = (sal_uInt8*)malloc(n); assert(res != 0); memset(res, 0, n); @@ -722,7 +720,7 @@ static int GetRawData_glyf(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le /* cmap packers */ static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length) { - sal_uInt8 *ptr = smalloc(262); + sal_uInt8* ptr = (sal_uInt8*)smalloc(262); sal_uInt8 *p = ptr + 6; sal_uInt32 i, j; sal_uInt16 g; @@ -746,7 +744,7 @@ static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length) static sal_uInt8 *PackCmapType6(CmapSubTable *s, sal_uInt32 *length) { - sal_uInt8 *ptr = smalloc(s->n*2 + 10); + sal_uInt8* ptr = (sal_uInt8*)smalloc(s->n*2 + 10); sal_uInt8 *p = ptr + 10; sal_uInt32 i, j; sal_uInt16 g; @@ -784,8 +782,6 @@ static sal_uInt8 *PackCmap(CmapSubTable *s, sal_uInt32 *length) static int GetRawData_cmap(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { table_cmap *t; - sal_uInt8 **subtables; - sal_uInt32 *sizes; /* of subtables */ sal_uInt32 i; sal_uInt32 tlen = 0; sal_uInt32 l; @@ -798,8 +794,8 @@ static int GetRawData_cmap(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le assert(t != 0); assert(t->n != 0); - subtables = scalloc(t->n, sizeof(sal_uInt8 *)); - sizes = scalloc(t->n, sizeof(sal_uInt32)); + sal_uInt8** subtables = (sal_uInt8**)scalloc(t->n, sizeof(sal_uInt8 *)); + sal_uInt32* sizes = (sal_uInt32*)scalloc(t->n, sizeof(sal_uInt32)); for (i = 0; i < t->n; i++) { subtables[i] = PackCmap(t->s+i, &l); @@ -837,10 +833,7 @@ static int GetRawData_cmap(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { list l; - NameRecord *nr; sal_Int16 i=0, n; /* number of Name Records */ - sal_uInt8 *name; - sal_uInt16 nameLen; int stringLen = 0; sal_uInt8 *p1, *p2; @@ -854,7 +847,7 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le if ((n = (sal_Int16)listCount(l)) == 0) return TTCR_NONAMES; - nr = scalloc(n, sizeof(NameRecord)); + NameRecord* nr = (NameRecord*)scalloc(n, sizeof(NameRecord)); listToFirst(l); @@ -871,8 +864,8 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le qsort(nr, n, sizeof(NameRecord), NameRecordCompareF); - nameLen = (sal_uInt16)(stringLen + 12 * n + 6); - name = ttmalloc(nameLen); + int nameLen = stringLen + 12 * n + 6; + sal_uInt8* name = (sal_uInt8*)ttmalloc(nameLen); PutUInt16(0, name, 0, 1); PutUInt16(n, name, 2, 1); @@ -898,7 +891,7 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le _this->rawdata = name; *ptr = name; - *len = nameLen; + *len = (sal_uInt16)nameLen; *tag = T_name; /*{int j; for(j=0; j<nameLen; j++) printf("%c", name[j]); }; */ @@ -977,11 +970,8 @@ TrueTypeTable *TrueTypeTableNew(sal_uInt32 tag, sal_uInt32 nbytes, sal_uInt8 *ptr) { - TrueTypeTable *table; - tdata_generic *pdata; - - table = smalloc(sizeof(TrueTypeTable)); - pdata = (tdata_generic *) smalloc(sizeof(tdata_generic)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + tdata_generic* pdata = (tdata_generic*)smalloc(sizeof(tdata_generic)); pdata->nbytes = nbytes; pdata->tag = tag; if (nbytes) { @@ -1006,13 +996,10 @@ TrueTypeTable *TrueTypeTableNew_head(sal_uInt32 fontRevision, sal_uInt16 lowestRecPPEM, sal_Int16 fontDirectionHint) { - TrueTypeTable *table; - sal_uInt8 *ptr; - assert(created != 0); - table = smalloc(sizeof(TrueTypeTable)); - ptr = ttmalloc(TABLESIZE_head); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + sal_uInt8* ptr = (sal_uInt8*)ttmalloc(TABLESIZE_head); PutUInt32(0x00010000, ptr, 0, 1); /* version */ @@ -1040,11 +1027,8 @@ TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender, sal_Int16 caretSlopeRise, sal_Int16 caretSlopeRun) { - TrueTypeTable *table; - sal_uInt8 *ptr; - - table = smalloc(sizeof(TrueTypeTable)); - ptr = ttmalloc(TABLESIZE_hhea); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + sal_uInt8* ptr = (sal_uInt8*)ttmalloc(TABLESIZE_hhea); PutUInt32(0x00010000, ptr, 0, 1); /* version */ PutUInt16(ascender, ptr, 4, 1); @@ -1068,7 +1052,7 @@ TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender, TrueTypeTable *TrueTypeTableNew_loca(void) { - TrueTypeTable *table = smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); table->data = smalloc(sizeof(tdata_loca)); ((tdata_loca *)table->data)->nbytes = 0; @@ -1082,7 +1066,7 @@ TrueTypeTable *TrueTypeTableNew_loca(void) TrueTypeTable *TrueTypeTableNew_maxp(sal_uInt8 *maxp, int size) { - TrueTypeTable *table = smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); table->data = ttmalloc(TABLESIZE_maxp); if (maxp && size == TABLESIZE_maxp) { @@ -1097,12 +1081,12 @@ TrueTypeTable *TrueTypeTableNew_maxp(sal_uInt8 *maxp, int size) TrueTypeTable *TrueTypeTableNew_glyf(void) { - TrueTypeTable *table = smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); list l = listNewEmpty(); assert(l != 0); - listSetElementDtor(l, FreeGlyphData); + listSetElementDtor(l, (list_destructor)FreeGlyphData); table->data = l; table->rawdata = 0; @@ -1113,8 +1097,8 @@ TrueTypeTable *TrueTypeTableNew_glyf(void) TrueTypeTable *TrueTypeTableNew_cmap(void) { - TrueTypeTable *table = smalloc(sizeof(TrueTypeTable)); - table_cmap *cmap = smalloc(sizeof(table_cmap)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + table_cmap* cmap = (table_cmap*)smalloc(sizeof(table_cmap)); cmap->n = 0; cmap->m = CMAP_SUBTABLE_INIT; @@ -1140,12 +1124,12 @@ static void DisposeNameRecord(void *ptr) static NameRecord* NameRecordNewCopy(NameRecord *nr) { - NameRecord *p = smalloc(sizeof(NameRecord)); + NameRecord* p = (NameRecord*)smalloc(sizeof(NameRecord)); memcpy(p, nr, sizeof(NameRecord)); if (p->slen) { - p->sptr = smalloc(p->slen); + p->sptr = (sal_uInt8*)smalloc(p->slen); memcpy(p->sptr, nr->sptr, p->slen); } @@ -1154,12 +1138,12 @@ static NameRecord* NameRecordNewCopy(NameRecord *nr) TrueTypeTable *TrueTypeTableNew_name(int n, NameRecord *nr) { - TrueTypeTable *table = smalloc(sizeof(TrueTypeTable)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); list l = listNewEmpty(); assert(l != 0); - listSetElementDtor(l, DisposeNameRecord); + listSetElementDtor(l, (list_destructor)DisposeNameRecord); if (n != 0) { int i; @@ -1181,12 +1165,9 @@ TrueTypeTable *TrueTypeTableNew_post(sal_uInt32 format, sal_Int16 underlineThickness, sal_uInt32 isFixedPitch) { - TrueTypeTable *table; - tdata_post *post; - assert(format == 0x00030000); /* Only format 3.0 is supported at this time */ - table = smalloc(sizeof(TrueTypeTable)); - post = smalloc(sizeof(tdata_post)); + TrueTypeTable* table = (TrueTypeTable*)smalloc(sizeof(TrueTypeTable)); + tdata_post* post = (tdata_post*)smalloc(sizeof(tdata_post)); post->format = format; post->italicAngle = italicAngle; @@ -1202,26 +1183,6 @@ TrueTypeTable *TrueTypeTableNew_post(sal_uInt32 format, return table; } - - -void TrueTypeTableDispose(TrueTypeTable *_this) -{ - /* XXX do a binary search */ - unsigned int i; - - assert(_this != 0); - - if (_this->rawdata) free(_this->rawdata); - - for(i=0; i < sizeof(vtable1)/sizeof(*vtable1); i++) { - if (_this->tag == vtable1[i].tag) { - vtable1[i].f(_this); - return; - } - } - assert(!"Unknown TrueType table.\n"); -} - int GetRawData(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) { /* XXX do a binary search */ @@ -1271,8 +1232,7 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g) if (!found) { if (t->n == t->m) { - CmapSubTable *tmp; - tmp = scalloc(t->m + CMAP_SUBTABLE_INCR, sizeof(CmapSubTable)); + CmapSubTable* tmp = (CmapSubTable*)scalloc(t->m + CMAP_SUBTABLE_INCR, sizeof(CmapSubTable)); memset(tmp, 0, t->m + CMAP_SUBTABLE_INCR * sizeof(CmapSubTable)); memcpy(tmp, s, sizeof(CmapSubTable) * t->m); t->m += CMAP_SUBTABLE_INCR; @@ -1294,13 +1254,13 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g) s[i].id = id; s[i].n = 0; s[i].m = CMAP_PAIR_INIT; - s[i].xc = scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); - s[i].xg = scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); + s[i].xc = (sal_uInt32*)scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); + s[i].xg = (sal_uInt32*)scalloc(CMAP_PAIR_INIT, sizeof(sal_uInt32)); } if (s[i].n == s[i].m) { - sal_uInt32 *tmp1 = scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); - sal_uInt32 *tmp2 = scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); + sal_uInt32* tmp1 = (sal_uInt32*)scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); + sal_uInt32* tmp2 = (sal_uInt32*)scalloc(s[i].m + CMAP_PAIR_INCR, sizeof(sal_uInt32)); assert(tmp1 != 0); assert(tmp2 != 0); memcpy(tmp1, s[i].xc, sizeof(sal_uInt32) * s[i].m); @@ -1322,7 +1282,6 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt list l; sal_uInt32 currentID; int ret, n, ncomponents; - list glyphlist; GlyphData *gd; assert(table != 0); @@ -1330,7 +1289,7 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt if (!glyphdata) return (sal_uInt32)~0; - glyphlist = listNewEmpty(); + std::vector< sal_uInt32 > glyphlist; ncomponents = GetTTGlyphComponents(fnt, glyphdata->glyphID, glyphlist); @@ -1344,11 +1303,15 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt glyphdata->newID = n++; listAppend(l, glyphdata); - if (ncomponents > 1) { - listPositionAt(glyphlist, 1); /* glyphData->glyphID is always the first glyph on the list */ - do { + if (ncomponents > 1 && glyphlist.size() > 1 ) + { + std::vector< sal_uInt32 >::const_iterator it = glyphlist.begin(); + ++it; + /* glyphData->glyphID is always the first glyph on the list */ + do + { int found = 0; - currentID = (sal_uIntPtr) listCurrent(glyphlist); + currentID = *it; /* XXX expensive! should be rewritten with sorted arrays! */ listToFirst(l); do { @@ -1363,10 +1326,9 @@ sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt gd->newID = n++; listAppend(l, gd); } - } while (listNext(glyphlist)); + } while( ++it != glyphlist.end() ); } - listDispose(glyphlist); return ret; } @@ -1398,7 +1360,7 @@ static TrueTypeTable *FindTable(TrueTypeCreator *tt, sal_uInt32 tag) do { if (((TrueTypeTable *) listCurrent(tt->tables))->tag == tag) { - return listCurrent(tt->tables); + return (TrueTypeTable*)listCurrent(tt->tables); } } while (listNext(tt->tables)); @@ -1428,11 +1390,10 @@ static void ProcessTables(TrueTypeCreator *tt) sal_Int16 xMin = 0, yMin = 0, xMax = 0, yMax = 0; sal_uInt32 i = 0; sal_Int16 indexToLocFormat; - sal_uInt8 *glyfPtr, *locaPtr, *hmtxPtr, *hheaPtr; + sal_uInt8 *hmtxPtr, *hheaPtr; sal_uInt32 hmtxSize; sal_uInt8 *p1, *p2; sal_uInt16 maxPoints = 0, maxContours = 0, maxCompositePoints = 0, maxCompositeContours = 0; - TTSimpleGlyphMetrics *met; int nlsb = 0; sal_uInt32 *gid; /* array of old glyphIDs */ @@ -1440,7 +1401,7 @@ static void ProcessTables(TrueTypeCreator *tt) glyphlist = (list) glyf->data; nGlyphs = listCount(glyphlist); assert(nGlyphs != 0); - gid = scalloc(nGlyphs, sizeof(sal_uInt32)); + gid = (sal_uInt32*)scalloc(nGlyphs, sizeof(sal_uInt32)); RemoveTable(tt, T_loca); RemoveTable(tt, T_hmtx); @@ -1488,9 +1449,9 @@ static void ProcessTables(TrueTypeCreator *tt) indexToLocFormat = (glyfLen / 2 > 0xFFFF) ? 1 : 0; locaLen = indexToLocFormat ? (nGlyphs + 1) << 2 : (nGlyphs + 1) << 1; - glyfPtr = ttmalloc(glyfLen); - locaPtr = ttmalloc(locaLen); - met = scalloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); + sal_uInt8* glyfPtr = ttmalloc(glyfLen); + sal_uInt8* locaPtr = ttmalloc(locaLen); + TTSimpleGlyphMetrics* met = (TTSimpleGlyphMetrics*)scalloc(nGlyphs, sizeof(TTSimpleGlyphMetrics)); i = 0; listToFirst(glyphlist); @@ -1569,19 +1530,21 @@ static void ProcessTables(TrueTypeCreator *tt) AddTable(tt, loca); head = FindTable(tt, T_head); - PutInt16(xMin, head->data, 36, 1); - PutInt16(yMin, head->data, 38, 1); - PutInt16(xMax, head->data, 40, 1); - PutInt16(yMax, head->data, 42, 1); - PutInt16(indexToLocFormat, head->data, 50, 1); + sal_uInt8* const pHeadData = (sal_uInt8*)head->data; + PutInt16(xMin, pHeadData, 36, 1); + PutInt16(yMin, pHeadData, 38, 1); + PutInt16(xMax, pHeadData, 40, 1); + PutInt16(yMax, pHeadData, 42, 1); + PutInt16(indexToLocFormat, pHeadData, 50, 1); maxp = FindTable(tt, T_maxp); - PutUInt16((sal_uInt16)nGlyphs, maxp->data, 4, 1); - PutUInt16(maxPoints, maxp->data, 6, 1); - PutUInt16(maxContours, maxp->data, 8, 1); - PutUInt16(maxCompositePoints, maxp->data, 10, 1); - PutUInt16(maxCompositeContours, maxp->data, 12, 1); + sal_uInt8* const pMaxpData = (sal_uInt8*)maxp->data; + PutUInt16((sal_uInt16)nGlyphs, pMaxpData, 4, 1); + PutUInt16(maxPoints, pMaxpData, 6, 1); + PutUInt16(maxContours, pMaxpData, 8, 1); + PutUInt16(maxCompositePoints, pMaxpData, 10, 1); + PutUInt16(maxCompositeContours, pMaxpData, 12, 1); #if 0 /* XXX do not overwrite the existing data. Fix: re-calculate these numbers here */ @@ -1628,6 +1591,43 @@ static void ProcessTables(TrueTypeCreator *tt) free(met); } +} // namespace vcl + +extern "C" +{ + /** + * TrueTypeCreator destructor. It calls destructors for all TrueTypeTables added to it. + */ + void TrueTypeCreatorDispose(vcl::TrueTypeCreator *_this) + { + listDispose(_this->tables); + free(_this); + } + + + /** + * Destructor for the TrueTypeTable object. + */ + void TrueTypeTableDispose(vcl::TrueTypeTable *_this) + { + /* XXX do a binary search */ + unsigned int i; + + assert(_this != 0); + + if (_this->rawdata) free(_this->rawdata); + + for(i=0; i < sizeof(vcl::vtable1)/sizeof(*vcl::vtable1); i++) { + if (_this->tag == vcl::vtable1[i].tag) { + vcl::vtable1[i].f(_this); + return; + } + } + assert(!"Unknown TrueType table.\n"); + } +} + + #ifdef TEST_TTCR int main(void) { diff --git a/vcl/source/fontsubset/ttcr.h b/vcl/source/fontsubset/ttcr.hxx index 95aa1a6c9e99..5b47f09d552a 100644 --- a/vcl/source/fontsubset/ttcr.h +++ b/vcl/source/fontsubset/ttcr.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ttcr.h,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,8 +25,6 @@ * ************************************************************************/ -/* $Id: ttcr.h,v 1.4 2008-04-11 10:17:09 rt Exp $ */ - /** * * @file ttcr.h @@ -40,14 +35,10 @@ #ifndef __TTCR_H #define __TTCR_H -#include "sft.h" -#include "list.h" +#include "sft.hxx" -#ifdef __cplusplus -extern "C" +namespace vcl { -#endif - typedef struct _TrueTypeCreator TrueTypeCreator; /* TrueType data types */ @@ -57,11 +48,11 @@ extern "C" } longHorMetrics; /* A generic base class for all TrueType tables */ - typedef struct { + struct TrueTypeTable { sal_uInt32 tag; /* table tag */ sal_uInt8 *rawdata; /* raw data allocated by GetRawData_*() */ void *data; /* table specific data */ - } TrueTypeTable; + }; /** Error codes for most functions */ enum TTCRErrCodes { @@ -87,11 +78,6 @@ extern "C" void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this); /** - * TrueTypeCreator destructor. It calls destructors for all TrueTypeTables added to it. - */ - void TrueTypeCreatorDispose(TrueTypeCreator *_this); - -/** * Adds a TrueType table to the TrueType creator. * SF_TABLEFORMAT value. * @return value of SFErrCodes type @@ -130,10 +116,6 @@ extern "C" * * ============================================================================ */ -/** - * Destructor for the TrueTypeTable object. - */ - void TrueTypeTableDispose(TrueTypeTable *); /** * This function converts the data of a TrueType table to a raw array of bytes. @@ -260,21 +242,20 @@ extern "C" */ void nameAdd(TrueTypeTable *, NameRecord *nr); +} // namespace -/* - * Private Data Types +extern "C" +{ +/** + * Destructor for the TrueTypeTable object. */ + void TrueTypeTableDispose(vcl::TrueTypeTable *); - struct _TrueTypeCreator { - sal_uInt32 tag; /**< TrueType file tag */ - list tables; /**< List of table tags and pointers */ - }; - - - -#ifdef __cplusplus +/** + * TrueTypeCreator destructor. It calls destructors for all TrueTypeTables added to it. + */ + void TrueTypeCreatorDispose(vcl::TrueTypeCreator *_this); } -#endif #endif /* __TTCR_H */ diff --git a/vcl/source/fontsubset/u2big5.inc b/vcl/source/fontsubset/u2big5.inc index 2883e9d99094..951b65cffc25 100644 --- a/vcl/source/fontsubset/u2big5.inc +++ b/vcl/source/fontsubset/u2big5.inc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: u2big5.inc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,6 +25,8 @@ * ************************************************************************/ +// TODO: use generic RTL_TEXTENCODING_BIG5 to get rid of this file + sal_uInt16pair xlat_1_3[13798] = { {0x0020, 0x0020},{0x0021, 0x0021},{0x0022, 0x0022},{0x0023, 0x0023},{0x0024, 0x0024},{0x0025, 0x0025},{0x0026, 0x0026},{0x0027, 0x0027}, {0x0028, 0x0028},{0x0029, 0x0029},{0x002A, 0x002A},{0x002B, 0x002B},{0x002C, 0x002C},{0x002D, 0x002D},{0x002E, 0x002E},{0x002F, 0x002F}, diff --git a/vcl/source/fontsubset/u2johab.inc b/vcl/source/fontsubset/u2johab.inc index ae07cc571fb8..f7a75afaf503 100644 --- a/vcl/source/fontsubset/u2johab.inc +++ b/vcl/source/fontsubset/u2johab.inc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: u2johab.inc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,6 +25,8 @@ * ************************************************************************/ +// use generic RTL_TEXTENCODING_JOHAB to get rid of this file + sal_uInt16pair xlat_1_6[17141] = { {0x0020, 0x0020},{0x0021, 0x0021},{0x0022, 0x0022},{0x0023, 0x0023},{0x0024, 0x0024},{0x0025, 0x0025},{0x0026, 0x0026},{0x0027, 0x0027}, {0x0028, 0x0028},{0x0029, 0x0029},{0x002A, 0x002A},{0x002B, 0x002B},{0x002C, 0x002C},{0x002D, 0x002D},{0x002E, 0x002E},{0x002F, 0x002F}, diff --git a/vcl/source/fontsubset/u2prc.inc b/vcl/source/fontsubset/u2prc.inc index 2479d23ebe6f..445461b59653 100644 --- a/vcl/source/fontsubset/u2prc.inc +++ b/vcl/source/fontsubset/u2prc.inc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: u2prc.inc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,6 +25,8 @@ * ************************************************************************/ +// use generic RTL_TEXTENCODING_ to get rid of this file + sal_uInt16pair xlat_1_4[24035] = { {0x0020, 0x0020},{0x0021, 0x0021},{0x0022, 0x0022},{0x0023, 0x0023},{0x0024, 0x0024},{0x0025, 0x0025},{0x0026, 0x0026},{0x0027, 0x0027}, {0x0028, 0x0028},{0x0029, 0x0029},{0x002A, 0x002A},{0x002B, 0x002B},{0x002C, 0x002C},{0x002D, 0x002D},{0x002E, 0x002E},{0x002F, 0x002F}, diff --git a/vcl/source/fontsubset/u2shiftjis.inc b/vcl/source/fontsubset/u2shiftjis.inc index fb130feaebe2..ebc6f1676784 100644 --- a/vcl/source/fontsubset/u2shiftjis.inc +++ b/vcl/source/fontsubset/u2shiftjis.inc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: u2shiftjis.inc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,6 +25,8 @@ * ************************************************************************/ +// TODO: use generic RTL_TEXTENCODING_SHIFTJIS to get rid of this file + sal_uInt16pair xlat_1_2[7484] = { {0x0020, 0x0020},{0x0021, 0x0021},{0x0022, 0x0022},{0x0023, 0x0023},{0x0024, 0x0024},{0x0025, 0x0025},{0x0026, 0x0026},{0x0027, 0x0027}, {0x0028, 0x0028},{0x0029, 0x0029},{0x002A, 0x002A},{0x002B, 0x002B},{0x002C, 0x002C},{0x002D, 0x002D},{0x002E, 0x002E},{0x002F, 0x002F}, diff --git a/vcl/source/fontsubset/u2wansung.inc b/vcl/source/fontsubset/u2wansung.inc index 0cb8867f1c2a..b321c9e58bfa 100644 --- a/vcl/source/fontsubset/u2wansung.inc +++ b/vcl/source/fontsubset/u2wansung.inc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: u2wansung.inc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,6 +25,8 @@ * ************************************************************************/ +// TODO: use generic RTL_TEXTENCODING_WANSUNG to get rid of this file + sal_uInt16pair xlat_1_5[8319] = { {0x0020, 0x0020},{0x0021, 0x0021},{0x0022, 0x0022},{0x0023, 0x0023},{0x0024, 0x0024},{0x0025, 0x0025},{0x0026, 0x0026},{0x0027, 0x0027}, {0x0028, 0x0028},{0x0029, 0x0029},{0x002A, 0x002A},{0x002B, 0x002B},{0x002C, 0x002C},{0x002D, 0x002D},{0x002E, 0x002E},{0x002F, 0x002F}, diff --git a/vcl/source/fontsubset/xlat.c b/vcl/source/fontsubset/xlat.cxx index 840850a020da..27b2f517f4a1 100644 --- a/vcl/source/fontsubset/xlat.c +++ b/vcl/source/fontsubset/xlat.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xlat.c,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,7 +25,7 @@ * ************************************************************************/ -/* $Id: xlat.c,v 1.4 2008-04-11 10:19:41 rt Exp $ +/* * * Data translation from Unicode to MS encodings * If the host system provides this functionality @@ -39,8 +36,12 @@ * */ -#include "xlat.h" +#include "xlat.hxx" + +namespace vcl +{ +// TODO: use generic encoding converters and get rid of the include files below #include "u2big5.inc" #include "u2johab.inc" #include "u2prc.inc" @@ -183,5 +184,5 @@ void TranslateString16(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n) } } - +} // namespace vcl diff --git a/vcl/source/fontsubset/xlat.h b/vcl/source/fontsubset/xlat.hxx index 86eca1691574..c3bd076f6fbd 100644 --- a/vcl/source/fontsubset/xlat.h +++ b/vcl/source/fontsubset/xlat.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xlat.h,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,25 +25,17 @@ * ************************************************************************/ -/* $Id: xlat.h,v 1.4 2008-04-11 10:19:58 rt Exp $ */ - -/*[]---------------------------------------------------[]*/ -/*| |*/ -/*| xlat.h |*/ -/*| |*/ /*| Author: Alexander Gelfenbain |*/ -/*[]---------------------------------------------------[]*/ #ifndef __XLAT_H #define __XLAT_H -#ifdef __cplusplus -extern "C" { -#endif - +#include "sft.hxx" -#include "sft.h" +namespace vcl +{ +// TODO: sal_UCS4 sal_uInt16 TranslateChar12(sal_uInt16); sal_uInt16 TranslateChar13(sal_uInt16); @@ -59,10 +48,7 @@ extern "C" { void TranslateString14(sal_uInt16 *, sal_uInt16 *, sal_uInt32); void TranslateString15(sal_uInt16 *, sal_uInt16 *, sal_uInt32); void TranslateString16(sal_uInt16 *, sal_uInt16 *, sal_uInt32); - -#ifdef __cplusplus } -#endif - #endif /* __XLAT_H */ + diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 820b053a4211..3bbdba5dad5f 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include "sft.h" +#include "sft.hxx" #include "tools/stream.hxx" #include "tools/vcompat.hxx" @@ -43,6 +43,8 @@ #include <algorithm> +using namespace vcl; + // ======================================================================= DBG_NAME( Font ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 0754f5c5b3dc..05067ee2d024 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6680,6 +6680,7 @@ void PDFWriterImpl::drawHorizontalGlyphs( appendHex( rGlyphs[nPos].m_nMappedGlyphId, aUnkernedLine ); // check for adjustment double fTheoreticalGlyphWidth = rGlyphs[nPos].m_aPos.X() - rGlyphs[nPos-1].m_aPos.X(); + fTheoreticalGlyphWidth = fabs( fTheoreticalGlyphWidth ); // #i100522# workaround until #i87686# gets fixed fTheoreticalGlyphWidth = 1000.0 * fTheoreticalGlyphWidth / fXScale / double(nPixelFontHeight); sal_Int32 nAdjustment = rGlyphs[nPos-1].m_nNativeWidth - sal_Int32(fTheoreticalGlyphWidth+0.5); if( nAdjustment != 0 ) @@ -6902,10 +6903,16 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT if( aAlignOffset.X() || aAlignOffset.Y() ) aAlignOffset = aRotScale.transform( aAlignOffset ); - if( bVertical ) - drawVerticalGlyphs( aGlyphs, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight ); - else - drawHorizontalGlyphs( aGlyphs, aLine, aAlignOffset, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight ); + /* #159153# do not emit an empty glyph vector; this can happen if e.g. the original + string contained only on of the UTF16 BOMs + */ + if( ! aGlyphs.empty() ) + { + if( bVertical ) + drawVerticalGlyphs( aGlyphs, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight ); + else + drawHorizontalGlyphs( aGlyphs, aLine, aAlignOffset, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight ); + } // end textobject aLine.append( "ET\n" ); @@ -9297,14 +9304,24 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const delete pStream; aLine.append( "q " ); - m_aPages.back().appendMappedLength( (sal_Int32)rTargetArea.GetWidth(), aLine, false ); + sal_Int32 nCheckWidth = 0; + m_aPages.back().appendMappedLength( (sal_Int32)rTargetArea.GetWidth(), aLine, false, &nCheckWidth ); aLine.append( " 0 0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)rTargetArea.GetHeight(), aLine, true ); + sal_Int32 nCheckHeight = 0; + m_aPages.back().appendMappedLength( (sal_Int32)rTargetArea.GetHeight(), aLine, true, &nCheckHeight ); aLine.append( ' ' ); m_aPages.back().appendPoint( rTargetArea.BottomLeft(), aLine ); aLine.append( " cm\n/Im" ); aLine.append( it->m_nObject ); aLine.append( " Do Q\n" ); + if( nCheckWidth == 0 || nCheckHeight == 0 ) + { + // #i97512# avoid invalid current matrix + aLine.setLength( 0 ); + aLine.append( "\n%jpeg image /Im" ); + aLine.append( it->m_nObject ); + aLine.append( " scaled to zero size, omitted\n" ); + } writeBuffer( aLine.getStr(), aLine.getLength() ); OStringBuffer aObjName( 16 ); @@ -9325,14 +9342,24 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize, appendNonStrokingColor( rFillColor, aLine ); aLine.append( ' ' ); } - m_aPages.back().appendMappedLength( (sal_Int32)rDestSize.Width(), aLine, false ); + sal_Int32 nCheckWidth = 0; + m_aPages.back().appendMappedLength( (sal_Int32)rDestSize.Width(), aLine, false, &nCheckWidth ); aLine.append( " 0 0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)rDestSize.Height(), aLine, true ); + sal_Int32 nCheckHeight = 0; + m_aPages.back().appendMappedLength( (sal_Int32)rDestSize.Height(), aLine, true, &nCheckHeight ); aLine.append( ' ' ); m_aPages.back().appendPoint( rDestPoint + Point( 0, rDestSize.Height()-1 ), aLine ); aLine.append( " cm\n/Im" ); aLine.append( rBitmap.m_nObject ); aLine.append( " Do Q\n" ); + if( nCheckWidth == 0 || nCheckHeight == 0 ) + { + // #i97512# avoid invalid current matrix + aLine.setLength( 0 ); + aLine.append( "\n%bitmap image /Im" ); + aLine.append( rBitmap.m_nObject ); + aLine.append( " scaled to zero size, omitted\n" ); + } writeBuffer( aLine.getStr(), aLine.getLength() ); } diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 89a47a9f4077..a96d4dc64b89 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1773,7 +1773,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) int nStartNew[ MAX_FALLBACK ]; int nCharPos[ MAX_FALLBACK ]; sal_Int32 nGlyphAdv[ MAX_FALLBACK ]; - int nValid[ MAX_FALLBACK ]; + int nValid[ MAX_FALLBACK ] = {0}; sal_GlyphId nDummy; Point aPos; diff --git a/vcl/source/helper/smartid.cxx b/vcl/source/helper/smartid.cxx index 7ac7abe0d18b..73ad6f89a21c 100755 --- a/vcl/source/helper/smartid.cxx +++ b/vcl/source/helper/smartid.cxx @@ -262,6 +262,6 @@ BOOL SmartId::operator < ( const SmartId& rRight ) const if ( HasString() ) return rRight.HasString() && rRight.HasNumeric(); else - return rRight.HasString() || !HasNumeric() && rRight.HasNumeric(); + return rRight.HasString() || (!HasNumeric() && rRight.HasNumeric()); } } diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 4dd2bca2d6fa..8c6bb2b76463 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -944,9 +944,16 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, Color aColor = bRound ? rStyleSettings.GetShadowColor() : pDev->GetSettings().GetStyleSettings().GetMonoColor(); // when the MonoColor wasn't set, check face color - if ( ( ( bRound && aColor.IsDark() ) || ( aColor == Color( COL_BLACK ) && - ( pDev->GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) ) ) ) + if ( + (bRound && aColor.IsDark()) || + ( + (aColor == Color(COL_BLACK)) && + (pDev->GetSettings().GetStyleSettings().GetFaceColor().IsDark()) + ) + ) + { aColor = Color( COL_WHITE ); + } ImplDrawDPILineRect( pDev, rRect, &aColor, bRound ); } else @@ -1183,7 +1190,7 @@ static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect, aFillRect.Right(), aFillRect.Top() ) ); aFillRect.Top()++; } - if ( ((nStyle & (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) && + if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) && !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED | BUTTON_DRAW_HIGHLIGHT)) ) { pDev->SetFillColor( rStyleSettings.GetDarkShadowColor() ); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 1318f4fa8415..adbc2a8de06e 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2323,6 +2323,8 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) { Size aImgSz = pData->aImage.GetSizePixel(); + aImgSz.Height() += 4; // add a border for native marks + aImgSz.Width() += 4; // add a border for native marks if ( aImgSz.Width() > aMaxImgSz.Width() ) aMaxImgSz.Width() = aImgSz.Width(); if ( aImgSz.Height() > aMaxImgSz.Height() ) @@ -2336,7 +2338,11 @@ Size Menu::ImplCalcSize( Window* pWin ) { nCheckWidth = nMaxCheckWidth; if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) - nWidth += nCheckWidth + nExtra * 2; + { + // checks / images take the same place + if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) + nWidth += nCheckWidth + nExtra * 2; + } } // Text: @@ -2397,16 +2403,14 @@ Size Menu::ImplCalcSize( Window* pWin ) nCheckPos = (USHORT)nExtra; if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) { - // non-NWF case has an implicit little extra space around - // the symbol; NWF case has not, so image pos needs to - // be distinct in this case + long nImgOrChkWidth = 0; + nImagePos = nCheckPos; if( nMax > 0 ) // NWF case - nImagePos = (USHORT)(nCheckPos + nMax + nExtra ); + nImgOrChkWidth = nMax + nExtra; else // non NWF case - nImagePos = (USHORT)(nCheckPos + nFontHeight/2 + gfxExtra ); - nTextPos = (USHORT)(nImagePos+aMaxImgSz.Width()); - if ( aMaxImgSz.Width() ) - nTextPos = nTextPos + gfxExtra; + nImgOrChkWidth = nFontHeight/2 + gfxExtra; + nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra ); + nTextPos = (USHORT)(nImagePos + nImgOrChkWidth); } else { @@ -2464,6 +2468,45 @@ Size Menu::ImplCalcSize( Window* pWin ) return aSz; } +static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight ) +{ + BOOL bNativeOk = FALSE; + if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + ImplControlValue aControlValue; + Region aCtrlRegion( i_rRect ); + ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED; + + aControlValue.setTristateVal( BUTTONVALUE_ON ); + + bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, + aCtrlRegion, nState, aControlValue, + rtl::OUString() ); + } + + if( ! bNativeOk ) + { + const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings(); + if( i_bHighlight ) + { + i_pWindow->Push( PUSH_ALL ); + Color aCol = rSettings.GetMenuHighlightTextColor(); + i_pWindow->SetFillColor( rSettings.GetMenuHighlightTextColor() ); + if( aCol.IsDark() ) + aCol.IncreaseLuminance( 128 ); + else + aCol.DecreaseLuminance( 128 ); + i_pWindow->SetLineColor( aCol ); + Polygon aPoly( i_rRect ); + PolyPolygon aPolyPoly( aPoly ); + i_pWindow->DrawTransparent( aPolyPoly, 20 ); + i_pWindow->Pop(); + } + else + i_pWindow->DrawSelectionBackground( i_rRect, 1, FALSE, TRUE, FALSE ); + } +} + void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted, bool bLayout ) const { // Fuer Symbole: nFontHeight x nFontHeight @@ -2537,15 +2580,89 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pWin->SetLineColor(); } + Rectangle aOuterCheckRect( Point( aPos.X()+nCheckPos, aPos.Y() ), Size( pData->aSz.Height(), pData->aSz.Height() ) ); + aOuterCheckRect.Left() += 1; + aOuterCheckRect.Right() -= 1; + aOuterCheckRect.Top() += 1; + aOuterCheckRect.Bottom() -= 1; + + // CheckMark + if ( !bLayout && !bIsMenuBar && pData->HasCheck() ) + { + // draw selection transparent marker if checked + // onto that either a checkmark or the item image + // will be painted + // however do not do this if native checks will be painted since + // the selection color too often does not fit the theme's check and/or radio + + if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) + { + if ( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + (pData->nBits & MIB_RADIOCHECK) + ? PART_MENU_ITEM_CHECK_MARK + : PART_MENU_ITEM_RADIO_MARK ) ) + { + ControlPart nPart = ((pData->nBits & MIB_RADIOCHECK) + ? PART_MENU_ITEM_RADIO_MARK + : PART_MENU_ITEM_CHECK_MARK); + + ControlState nState = 0; + + if ( pData->bChecked ) + nState |= CTRL_STATE_PRESSED; + + if ( pData->bEnabled ) + nState |= CTRL_STATE_ENABLED; + + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + + long nCtrlHeight = (pData->nBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight; + aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight)/2; + aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; + + Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); + pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, + Region( aCheckRect ), + nState, + ImplControlValue(), + OUString() ); + } + else if ( pData->bChecked ) // by default do nothing for unchecked items + { + ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted ); + + SymbolType eSymbol; + Size aSymbolSize; + if ( pData->nBits & MIB_RADIOCHECK ) + { + eSymbol = SYMBOL_RADIOCHECKMARK; + aSymbolSize = Size( nFontHeight/2, nFontHeight/2 ); + } + else + { + eSymbol = SYMBOL_CHECKMARK; + aSymbolSize = Size( (nFontHeight*25)/40, nFontHeight/2 ); + } + aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width())/2; + aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2; + Rectangle aRect( aTmpPos, aSymbolSize ); + aDecoView.DrawSymbol( aRect, eSymbol, pWin->GetTextColor(), nSymbolStyle ); + } + } + } + // Image: if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) { // Don't render an image for a check thing if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pData->HasCheck() ) { - aTmpPos.Y() = aPos.Y(); - aTmpPos.X() = aPos.X() + nImagePos; - aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2; + if( pData->bChecked ) + ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted ); + aTmpPos = aOuterCheckRect.TopLeft(); + aTmpPos.X() += (aOuterCheckRect.GetWidth()-pData->aImage.GetSizePixel().Width())/2; + aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pData->aImage.GetSizePixel().Height())/2; pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); } } @@ -2598,65 +2715,6 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pWin->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle ); } - // CheckMark - if ( !bLayout && !bIsMenuBar && pData->HasCheck() ) - { - if ( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, - (pData->nBits & MIB_RADIOCHECK) - ? PART_MENU_ITEM_CHECK_MARK - : PART_MENU_ITEM_RADIO_MARK ) ) - { - ControlPart nPart = ((pData->nBits & MIB_RADIOCHECK) - ? PART_MENU_ITEM_RADIO_MARK - : PART_MENU_ITEM_CHECK_MARK); - - ControlState nState = 0; - - if ( pData->bChecked ) - nState |= CTRL_STATE_PRESSED; - - if ( pData->bEnabled ) - nState |= CTRL_STATE_ENABLED; - - if ( bHighlighted ) - nState |= CTRL_STATE_SELECTED; - - aTmpPos.X() = aPos.X() + nCheckPos; - aTmpPos.Y() = aPos.Y() + nCheckPos; - - long nCtrlHeight = (pData->nBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight; - Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); - pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, - Region( aCheckRect ), - nState, - ImplControlValue(), - OUString() ); - } - else if ( pData->bChecked ) // by default do nothing for unchecked items - { - Rectangle aRect; - SymbolType eSymbol; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += pData->aSz.Height() / 2; - if ( pData->nBits & MIB_RADIOCHECK ) - { - aTmpPos.X() = aPos.X() + nCheckPos; - eSymbol = SYMBOL_RADIOCHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); - } - else - { - aTmpPos.X() = aPos.X() + nCheckPos; - eSymbol = SYMBOL_CHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); - } - aDecoView.DrawSymbol( aRect, eSymbol, pWin->GetTextColor(), nSymbolStyle ); - } - } - // SubMenu? if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) { diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index d41a861717e9..8c69c2a45daf 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1622,8 +1622,10 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ) ImplDestroyHelpWindow( true ); } - if ( ((nNewWidth > 0) && (nNewHeight > 0)) || - pWindow->ImplGetWindow()->ImplGetWindowImpl()->mbAllResize ) + if ( + (nNewWidth > 0 && nNewHeight > 0) || + pWindow->ImplGetWindow()->ImplGetWindowImpl()->mbAllResize + ) { if ( (nNewWidth != pWindow->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutputHeightPixel()) ) { @@ -1849,11 +1851,15 @@ static void ImplHandleGetFocus( Window* pWindow ) // nicht alles flackert, wenn diese den Focus bekommen if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId ) { + bool bCallDirect = ImplGetSVData()->mbIsTestTool; pWindow->ImplGetWindowImpl()->mpFrameData->mbStartFocusState = !pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus; - Application::PostUserEvent( pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) ); + if( ! bCallDirect ) + Application::PostUserEvent( pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) ); Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin; if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor ) pFocusWin->ImplGetWindowImpl()->mpCursor->ImplShow(); + if( bCallDirect ) + pWindow->ImplAsyncFocusHdl( NULL ); } } @@ -1887,15 +1893,19 @@ static void ImplHandleLoseFocus( Window* pWindow ) // Focus-Events zeitverzoegert ausfuehren, damit bei SystemChildFenstern // nicht alles flackert, wenn diese den Focus bekommen + bool bCallDirect = ImplGetSVData()->mbIsTestTool; if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId ) { pWindow->ImplGetWindowImpl()->mpFrameData->mbStartFocusState = !pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus; - Application::PostUserEvent( pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) ); + if( ! bCallDirect ) + Application::PostUserEvent( pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) ); } Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin; if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor ) pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide(); + if( bCallDirect ) + pWindow->ImplAsyncFocusHdl( NULL ); } // ----------------------------------------------------------------------- diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 60975174096a..1c839ed58839 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -322,9 +322,11 @@ text_wrapper_get_text_at_offset (AtkText *text, * which is the same index as the first character of the next line. In atk the magic offset * '-2' is used to cover this special case. */ - if( -2 == offset && - (ATK_TEXT_BOUNDARY_LINE_START == boundary_type) || - (ATK_TEXT_BOUNDARY_LINE_END == boundary_type) ) + if ( + -2 == offset && + (ATK_TEXT_BOUNDARY_LINE_START == boundary_type || + ATK_TEXT_BOUNDARY_LINE_END == boundary_type) + ) { accessibility::XAccessibleMultiLineText* pMultiLineText = getMultiLineText( text ); if( pMultiLineText ) diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index b06a601d177e..2692177c765a 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -174,21 +174,7 @@ extern "C" pSalData->Init(); pSalData->initNWF(); - const char* pGtkModules = getenv( "GTK_MODULES" ); - if( pGtkModules ) - { - rtl::OString aModules( pGtkModules ); - sal_Int32 nIndex = 0; - while( nIndex >= 0 ) - { - rtl::OString aToken = aModules.getToken( 0, ':', nIndex ); - if( aToken.equals( "gail" ) || aToken.equals( "atk-bridge" ) ) - { - InitAtkBridge(); - break; - } - } - } + InitAtkBridge(); return pInstance; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index a47b9bf31b01..8aef97904769 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -783,6 +783,11 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ); + /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME + at some point that may be fixed in metacity and we will have to revisit this + */ + bool bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && + (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); if( bDecoHandling ) { bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) ); @@ -798,7 +803,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) { eType = GDK_WINDOW_TYPE_HINT_UTILITY; gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true ); - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); + if( bMetaCityToolWindowHack ) + lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); } else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) { @@ -843,7 +849,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) || ( (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ) ) ) + if( ( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) || bMetaCityToolWindowHack ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -1329,7 +1335,10 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) if( nUserTime == 0 && ( getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") || - getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") + ( + getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") && + (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + ) ) ) { @@ -2791,7 +2800,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); - if( GetX11SalData()->isTestTool() ) + if( ImplGetSVData()->mbIsTestTool ) { /* #i76541# testtool needs the focus to be in a new document * however e.g. metacity does not necessarily put the focus into diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx index a4326990c464..2d09bd35649e 100644 --- a/vcl/unx/inc/saldata.hxx +++ b/vcl/unx/inc/saldata.hxx @@ -65,7 +65,6 @@ protected: SalXLib *pXLib_; SalDisplay *m_pSalDisplay; pthread_t hMainThread_; - bool m_bIsTesttool; public: X11SalData(); @@ -90,7 +89,6 @@ public: void StartTimer( ULONG nMS ); inline void StopTimer(); void Timeout() const; - bool isTestTool() const { return m_bIsTesttool; } static int XErrorHdl( Display*, XErrorEvent* ); static int XIOErrorHdl( Display* ); diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx index 0f9e21052c50..b1f5a113828f 100644 --- a/vcl/unx/source/app/saldata.cxx +++ b/vcl/unx/source/app/saldata.cxx @@ -277,21 +277,8 @@ X11SalData::X11SalData() m_pSalDisplay = NULL; m_pInstance = NULL; m_pPlugin = NULL; - m_bIsTesttool = false; hMainThread_ = pthread_self(); - - sal_uInt32 nArgs = osl_getCommandArgCount(); - for( sal_uInt32 i = 0; i < nArgs; i++ ) - { - rtl::OUString aArg; - osl_getCommandArg( i, &aArg.pData ); - if( aArg.equalsAscii( "-enableautomation" ) ) - { - m_bIsTesttool = true; - break; - } - } } X11SalData::~X11SalData() diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 73e117550a14..a116749daf47 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -63,9 +63,7 @@ #include "parseAFM.hxx" -#define NO_LIST -#include "sft.h" -#undef NO_LIST +#include "sft.hxx" #if OSL_DEBUG_LEVEL > 1 #include <sys/times.h> @@ -90,6 +88,7 @@ #define PRINTER_METRICDIR "fontmetric" +using namespace vcl; using namespace utl; using namespace psp; using namespace osl; diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 1d61dbe214a2..6d7812828a10 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1385,6 +1385,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 ); // notify xrender of target drawable + // TODO: cache the matching xrender picture in the X11SalGraphics Picture aDst = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL ); // set clipping @@ -1396,6 +1397,10 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly rRenderPeer.CompositeTrapezoids( PictOpOver, rEntry.m_aPicture, aDst, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() ); + // release xrender-counterpart of target drawable + // TODO: use scoped xrender picture + rRenderPeer.FreePicture( aDst ); + return TRUE; } diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index d76977944c11..668493c6ccb3 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -101,21 +101,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) */ if( rModuleBase.equalsAscii("gtk") ) { - const char* gtk_modules = getenv( "GTK_MODULES" ); - if( gtk_modules ) - { - rtl::OString aModules( gtk_modules ); - sal_Int32 nIndex = 0; - while( nIndex >= 0 ) - { - rtl::OString aToken = aModules.getToken( 0, ':', nIndex ); - if( aToken.equals( "atk-bridge" ) ) - { - pCloseModule = NULL; - break; - } - } - } + pCloseModule = NULL; } GetSalData()->m_pPlugin = aMod; diff --git a/vcl/unx/source/printergfx/glyphset.cxx b/vcl/unx/source/printergfx/glyphset.cxx index 0d26a66cac2f..2a35e975cbab 100644 --- a/vcl/unx/source/printergfx/glyphset.cxx +++ b/vcl/unx/source/printergfx/glyphset.cxx @@ -34,9 +34,7 @@ #include "glyphset.hxx" #include "psputil.hxx" -#define NO_LIST -#include "sft.h" -#undef NO_LIST +#include "sft.hxx" #include "vcl/printergfx.hxx" #include "vcl/fontmanager.hxx" @@ -51,6 +49,7 @@ #include <set> #include <map> +using namespace vcl; using namespace psp; using namespace rtl; diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 96cf50504ef0..6f5fd8a99522 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -190,8 +190,6 @@ SHL1STDLIBS+= \ $(BASEBMPLIB) \ -lAppleRemote$(DLLPOSTFIX) -SHL1STDLIBS+= \ - -framework QTKit LIB1FILES+= \ $(SLB)$/sala11y.lib .ENDIF diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 70701e2ee19a..16c055209088 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -64,8 +64,7 @@ #include "basegfx/polygon/b2dpolypolygon.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" -#include <list.h> -#include <sft.h> +#include "sft.hxx" #ifdef GCP_KERN_HACK #include <algorithm> @@ -76,6 +75,8 @@ #include <map> +using namespace vcl; + static const int MAXFONTHEIGHT = 2048; // ----------- diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 34900aaa951a..0689b8710655 100755 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -36,7 +36,7 @@ #include "salgdi.h" #include "saldata.hxx" // for GetMirroredChar -#include "sft.h" +#include "sft.hxx" #include "vcl/sallayout.hxx" #include "vcl/svapp.hxx" @@ -2441,9 +2441,9 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) if( rVisualItem.IsRTL() ) { for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i ) - if ( (1U << mpVisualAttrs[i].uJustification) & 0xFF89 ) // any Arabic justification ? - { // the last SCRIPT_JUSTIFY_xxx - // yes // == 15 (usp 1.6) + if ( (1U << mpVisualAttrs[i].uJustification) & 0xFF82 ) // any Arabic justification + { // excluding SCRIPT_JUSTIFY_NONE + // yes rVisualItem.mbHasKashidas = true; // so prepare for kashida handling InitKashidaHandling(); @@ -2509,10 +2509,14 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) for( i = nMinGlyphPos; i < nEndGlyphPos; ++i ) { const int nXOffsetAdjust = mpJustifications[i] - mpGlyphAdvances[i]; - if( i == nMinGlyphPos ) + // #i99862# skip diacritics, we mustn't add extra justification to diacritics + int nIdxAdd = i - 1; + while( (nIdxAdd >= nMinGlyphPos) && !mpGlyphAdvances[nIdxAdd] ) + --nIdxAdd; + if( nIdxAdd < nMinGlyphPos ) rVisualItem.mnXOffset += nXOffsetAdjust; else - mpJustifications[i-1] += nXOffsetAdjust; + mpJustifications[nIdxAdd] += nXOffsetAdjust; mpJustifications[i] -= nXOffsetAdjust; } } @@ -2540,8 +2544,8 @@ void UniscribeLayout::KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos ) { // check for vowels if( (i > nMinGlyphPos && !mpGlyphAdvances[ i-1 ]) - && (1U << mpVisualAttrs[i].uJustification) & 0xFF89 ) - { + && (1U << mpVisualAttrs[i].uJustification) & 0xFF83 ) // all Arabic justifiction types + { // including SCRIPT_JUSTIFY_NONE // vowel, we do it like ScriptJustify does // the vowel gets the extra width long nSpaceAdded = mpJustifications[ i ] - mpGlyphAdvances[ i ]; |