diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-01 11:54:14 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-01 11:54:14 +0000 |
commit | a7571a96c307b85349eaadf0d5d9c777c7881137 (patch) | |
tree | e20ef90e9197c5ea5545e968e1afc9f926f48fe3 | |
parent | 173829f82f953ffee03558b57e6ef9036a08b9f1 (diff) |
CWS-TOOLING: integrate CWS vcl100
2009-03-26 21:27:56 +0100 pl r270106 : #i10000# fix an include path missing when using configure
2009-03-16 12:18:24 +0100 pl r269518 : #i98963# revert change
2009-03-13 14:56:47 +0100 pl r269483 : #i98980# work around a mysterious crash
2009-03-12 20:02:48 +0100 pl r269440 : resolve some warnings
2009-03-12 19:30:32 +0100 pl r269439 : resolve some warnings
2009-03-12 18:07:47 +0100 pl r269432 : solve some warnings
2009-03-12 09:07:33 +0100 hdu r269358 : #i100134# remove obsolete RCS/CVS keywords from source
2009-03-11 21:18:28 +0100 pl r269355 : #i100134# change sft.h and ttcr.h to c++ headers
2009-03-11 20:19:15 +0100 pl r269353 : #i100134# remove some ugly C style lists
2009-03-11 18:19:35 +0100 hdu r269347 : #i100134# make psprint.fontsubset source C++ and make it compile
2009-03-11 14:44:35 +0100 hdu r269334 : #i99862# fix justification of vocalized hebrew (thanks hennerdrewes)
2009-03-11 13:40:35 +0100 pl r269327 : CWS-TOOLING: rebase CWS vcl100 to trunk@269297 (milestone: DEV300:m43)
2009-03-10 16:49:34 +0100 hdu r269284 : #i1000020# add style-matching heuristics for single-char stylenames
2009-03-10 15:42:53 +0100 hdu r269278 : use fast ASCII-matching for extracting attributes from PSName
2009-03-09 16:29:08 +0100 pl r269200 : #i98980# skip bundles that are not NP plugins
2009-03-09 13:26:14 +0100 hdu r269083 : #i99868# fix text breaking for large nCharExtra
2009-03-09 12:20:01 +0100 hdu r269078 : #i99868# fix text breaking for large nCharExtra
2009-03-06 17:35:27 +0100 pl r269032 : #i98980# mouse events
2009-03-06 17:10:14 +0100 pl r269024 : #i98980# flash animations, initial paint problem
2009-03-05 20:00:21 +0100 pl r268939 : #i98980# more plugin support
2009-03-05 15:35:06 +0100 pl r268914 : #i98980# first twitches of a live plugin
2009-03-05 15:34:10 +0100 pl r268913 : #i98980# access to carbon headers
2009-03-04 15:46:29 +0100 pl r268839 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView
2009-03-04 15:40:20 +0100 pl r268838 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView
2009-03-04 11:30:49 +0100 hdu r268801 : #i99722# for OSX any anisotropy reported for the display resolution is best ignored
2009-03-02 15:52:21 +0100 pl r268655 : #i99770# fix ambiguous looking if statements (thanks cmc)
2009-03-02 13:28:17 +0100 pl r268649 : #i99770# fix ambiguous looking if statements (thanks cmc)
2009-02-27 15:39:30 +0100 pl r268603 : #i97512# omit degenrate current matrix
2009-02-27 12:37:29 +0100 pl r268579 : #i99716# remove unused code (thanks cmc)
2009-02-27 11:21:18 +0100 pl r268569 : #i99705 remove unused code (thanks cmc)
2009-02-23 10:42:00 +0100 pl r268345 : #i99492# remove a typo (thanks tono)
2009-02-19 12:46:21 +0100 pl r268274 : #i99411# add new mimetype
2009-02-10 12:57:59 +0100 pl r267548 : #i98980# more aqua plugin changes
2009-02-06 16:50:34 +0100 pl r267475 : #i98980# plugin detection
2009-02-06 16:46:48 +0100 pl r267474 : #i98980# make debug compilation work
2009-02-06 12:16:37 +0100 pl r267449 : #98963# add missing wrapper
2009-02-04 20:06:59 +0100 pl r267402 : #i97135# work around a gcc x64 optimizer bug
2009-02-04 13:45:36 +0100 pl r267380 : #159153# do not emit empty glyph vector
2009-02-03 17:47:16 +0100 pl r267338 : #i98533# recent gtk versions do not support GTK_MODULES for accessibility anymore
2009-02-03 10:39:46 +0100 pl r267305 : #i97146# check if the idle formatted view is still valid
2009-01-28 11:23:23 +0100 pl r267045 : #i42227# #i48965# refinement of check markings images
2009-01-27 19:40:01 +0100 pl r267016 : #i42227# #i48965# change menus wrt checkmarks and images
44 files changed, 687 insertions, 845 deletions
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/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/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/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/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index c717e491d7b2..a25ddbb68e8b 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -1124,7 +1124,7 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL mpEntryList->SetSelectionAnchor( nSelect ); } // MultiListBox nur mit CTRL/SHIFT oder nicht im SimpleMode - else if( ( !mbSimpleMode /* && !bShift */ ) || ( mbSimpleMode && ( bCtrl || bShift ) || mbStackMode ) ) + else if( ( !mbSimpleMode /* && !bShift */ ) || ( (mbSimpleMode && ( bCtrl || bShift )) || mbStackMode ) ) { // Space fuer Selektionswechsel if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) ) 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..6723e01b97f1 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 != glpyhlist.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 != glpyhlist.end(); ++it ) + { + fprintf( stderr,"%d ", (int) *it ); } fprintf(stderr, "]\n"); - fprintf(stderr, "glyphlist: -= %d\n", (int) listCurrent(glyphlist)); + if( ! glpyhlist.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..bf9e693d081c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6902,10 +6902,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 +9303,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 +9341,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 0358b25ca153..a96d4dc64b89 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1292,10 +1292,10 @@ void GenericSalLayout::ApplyAsianKerning( const sal_Unicode* pStr, int nLength ) { // ignore code ranges that are not affected by asian punctuation compression const sal_Unicode cHere = pStr[n]; - if( (0x3000 != (cHere & 0xFF00)) && (0x2010 != (cHere & 0xFFF0)) || (0xFF00 != (cHere & 0xFF00)) ) + if( ((0x3000 != (cHere & 0xFF00)) && (0x2010 != (cHere & 0xFFF0))) || (0xFF00 != (cHere & 0xFF00)) ) continue; const sal_Unicode cNext = pStr[n+1]; - if( (0x3000 != (cNext & 0xFF00)) && (0x2010 != (cNext & 0xFFF0)) || (0xFF00 != (cNext & 0xFF00)) ) + if( ((0x3000 != (cNext & 0xFF00)) && (0x2010 != (cNext & 0xFFF0))) || (0xFF00 != (cNext & 0xFF00)) ) continue; // calculate compression values @@ -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 90934b382a88..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/dialog.cxx b/vcl/source/window/dialog.cxx index c949a59cb222..1fc2b9be703a 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -347,7 +347,7 @@ void Dialog::ImplInit( Window* pParent, WinBits nStyle ) { mpWindowImpl->mbFrame = TRUE; mpWindowImpl->mbOverlapWin = TRUE; - SystemWindow::ImplInit( pParent, nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE) | WB_CLOSEABLE, NULL ); + SystemWindow::ImplInit( pParent, (nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)) | WB_CLOSEABLE, NULL ); // Now set all style bits mpWindowImpl->mnStyle = nStyle; } 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/splitwin.cxx b/vcl/source/window/splitwin.cxx index a7a21fb840ad..1e66849db73a 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1879,7 +1879,7 @@ void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize ) DrawPixel( Point( i+1, nCenter-2+1 ), rStyleSettings.GetShadowColor() ); } i++; - if ( (i < nEx1) || (i > nEx2 ) && (i < nRight-3) ) + if ( (i < nEx1) || ((i > nEx2 ) && (i < nRight-3)) ) { DrawPixel( Point( i, nCenter+2 ), rStyleSettings.GetLightColor() ); DrawPixel( Point( i+1, nCenter+2+1 ), rStyleSettings.GetShadowColor() ); @@ -1909,7 +1909,7 @@ void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize ) DrawPixel( Point( nCenter-2+1, i+1 ), rStyleSettings.GetShadowColor() ); } i++; - if ( (i < nEx1) || (i > nEx2 ) && (i < nBottom-3) ) + if ( (i < nEx1) || ((i > nEx2 ) && (i < nBottom-3)) ) { DrawPixel( Point( nCenter+2, i ), rStyleSettings.GetLightColor() ); DrawPixel( Point( nCenter+2+1, i+1 ), rStyleSettings.GetShadowColor() ); diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index a8be05bf4909..0dcf0d686cb2 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()) ) { 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/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/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 ]; |