[Libreoffice-commits] .: 2 commits - vcl/inc vcl/source vcl/win
Thomas Arnhold
tarnhold at kemper.freedesktop.org
Sat Feb 18 05:40:58 PST 2012
vcl/inc/outfont.hxx | 3
vcl/source/gdi/outdev3.cxx | 77 +++++++++++++++++++++++-
vcl/win/source/gdi/salgdi3.cxx | 116 -------------------------------------
vcl/win/source/gdi/salprn.cxx | 1
vcl/win/source/window/salframe.cxx | 19 ------
5 files changed, 76 insertions(+), 140 deletions(-)
New commits:
commit f2601ba087d9d21af09134703b12de2a1d1763f8
Author: Thomas Arnhold <thomas at arnhold.org>
Date: Sat Feb 18 14:40:11 2012 +0100
remove some unused windows code
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 692005d..e3e94b4 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1228,8 +1228,6 @@ sal_IntPtr ImplWinFontData::GetFontId() const
// -----------------------------------------------------------------------
static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
-static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);}
-//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));}
static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); }
// -----------------------------------------------------------------------
@@ -1807,120 +1805,6 @@ int CALLBACK SalEnumCharSetsProcExA( const ENUMLOGFONTEXA* pLogFont,
// -----------------------------------------------------------------------
-static void ImplGetAllFontCharSets( WinSalGraphics* pData )
-{
- if ( !pData->mpFontCharSets )
- pData->mpFontCharSets = new BYTE[256];
-
- LOGFONTA aLogFont;
- memset( &aLogFont, 0, sizeof( aLogFont ) );
- aLogFont.lfCharSet = DEFAULT_CHARSET;
- GetTextFaceA( pData->mhDC, sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName );
- EnumFontFamiliesExA( pData->mhDC, &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA,
- (LPARAM)(void*)pData, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-static void ImplAddKerningPairs( WinSalGraphics* pData )
-{
- sal_uLong nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL );
- if ( !nPairs )
- return;
-
- CHARSETINFO aInfo;
- if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) )
- return;
-
- if ( !pData->mpFontKernPairs )
- pData->mpFontKernPairs = new KERNINGPAIR[nPairs];
- else
- {
- KERNINGPAIR* pOldPairs = pData->mpFontKernPairs;
- pData->mpFontKernPairs = new KERNINGPAIR[nPairs+pData->mnFontKernPairCount];
- memcpy( pData->mpFontKernPairs, pOldPairs,
- pData->mnFontKernPairCount*sizeof( KERNINGPAIR ) );
- delete[] pOldPairs;
- }
-
- UINT nCP = aInfo.ciACP;
- sal_uLong nOldPairs = pData->mnFontKernPairCount;
- KERNINGPAIR* pTempPair = pData->mpFontKernPairs+pData->mnFontKernPairCount;
- nPairs = ::GetKerningPairsA( pData->mhDC, nPairs, pTempPair );
- for ( sal_uLong i = 0; i < nPairs; i++ )
- {
- unsigned char aBuf[2];
- wchar_t nChar;
- int nLen;
- sal_Bool bAdd = TRUE;
-
- // None-ASCII?, then we must convert the char
- if ( (pTempPair->wFirst > 125) || (pTempPair->wFirst == 92) )
- {
- if ( pTempPair->wFirst < 256 )
- {
- aBuf[0] = (unsigned char)pTempPair->wFirst;
- nLen = 1;
- }
- else
- {
- aBuf[0] = (unsigned char)(pTempPair->wFirst >> 8);
- aBuf[1] = (unsigned char)(pTempPair->wFirst & 0xFF);
- nLen = 2;
- }
- if ( MultiByteToWideChar( nCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS,
- (const char*)aBuf, nLen, &nChar, 1 ) )
- pTempPair->wFirst = nChar;
- else
- bAdd = FALSE;
- }
- if ( (pTempPair->wSecond > 125) || (pTempPair->wSecond == 92) )
- {
- if ( pTempPair->wSecond < 256 )
- {
- aBuf[0] = (unsigned char)pTempPair->wSecond;
- nLen = 1;
- }
- else
- {
- aBuf[0] = (unsigned char)(pTempPair->wSecond >> 8);
- aBuf[1] = (unsigned char)(pTempPair->wSecond & 0xFF);
- nLen = 2;
- }
- if ( MultiByteToWideChar( nCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS,
- (const char*)aBuf, nLen, &nChar, 1 ) )
- pTempPair->wSecond = nChar;
- else
- bAdd = FALSE;
- }
-
- // TODO: get rid of linear search!
- KERNINGPAIR* pTempPair2 = pData->mpFontKernPairs;
- for ( sal_uLong j = 0; j < nOldPairs; j++ )
- {
- if ( (pTempPair2->wFirst == pTempPair->wFirst) &&
- (pTempPair2->wSecond == pTempPair->wSecond) )
- {
- bAdd = FALSE;
- break;
- }
- pTempPair2++;
- }
-
- if ( bAdd )
- {
- KERNINGPAIR* pDestPair = pData->mpFontKernPairs+pData->mnFontKernPairCount;
- if ( pDestPair != pTempPair )
- memcpy( pDestPair, pTempPair, sizeof( KERNINGPAIR ) );
- pData->mnFontKernPairCount++;
- }
-
- pTempPair++;
- }
-}
-
-// -----------------------------------------------------------------------
-
sal_uLong WinSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs )
{
DBG_ASSERT( sizeof( KERNINGPAIR ) == sizeof( ImplKernPairData ),
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index 53b54ed..99133ec 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -105,7 +105,6 @@ using ::rtl::OUString;
// =======================================================================
static char aImplWindows[] = "windows";
-static char aImplDevices[] = "devices";
static char aImplDevice[] = "device";
static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData )
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 6a2a16f..2243e21 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -3472,32 +3472,13 @@ static sal_uInt16 ImplSalGetKeyCode( WPARAM wParam )
// -----------------------------------------------------------------------
-static UINT ImplStrToNum( const sal_Char* pStr )
-{
- sal_uInt16 n = 0;
-
- // Solange es sich um eine Ziffer handelt, String umwandeln
- while( (*pStr >= 48) && (*pStr <= 57) )
- {
- n *= 10;
- n += ((*pStr) - 48);
- pStr++;
- }
-
- return n;
-}
-
-// -----------------------------------------------------------------------
-
static void ImplUpdateInputLang( WinSalFrame* pFrame )
{
- sal_Bool bLanguageChange = FALSE;
UINT nLang = LOWORD( GetKeyboardLayout( 0 ) );
if ( nLang && nLang != pFrame->mnInputLang )
{
// keep input lang up-to-date
pFrame->mnInputLang = nLang;
- bLanguageChange = TRUE;
}
// We are on Windows NT so we use Unicode FrameProcs and get
commit 04af52609aef5b4ccbbf82553ac190ef43700652
Author: Thomas Arnhold <thomas at arnhold.org>
Date: Sat Feb 18 14:33:54 2012 +0100
vcl: bring ImplFindByLocale back (windows build)
Partially reverts 78e9ba6febb7402d4661fbf7934a2526efc8629a
This is used by WinGlyphFallbackSubstititution::FindFontSubstitute
diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx
index 9acb296..75871da 100644
--- a/vcl/inc/outfont.hxx
+++ b/vcl/inc/outfont.hxx
@@ -228,6 +228,9 @@ public:
ImplGetDevFontList* GetDevFontList() const;
ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const;
+ //used by 2-level font fallback
+ ImplDevFontListData* ImplFindByLocale( com::sun::star::lang::Locale& ) const;
+
protected:
void InitMatchData() const;
bool AreMapNamesAvailable() const { return mbMapNames; }
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 598823e..6cd8e34 100755
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
#include "i18npool/mslangid.hxx"
@@ -416,6 +418,35 @@ sal_uInt16 OutputDevice::GetFontSubstituteCount()
// -----------------------------------------------------------------------
+void OutputDevice::GetFontSubstitute( sal_uInt16 n,
+ XubString& rFontName,
+ XubString& rReplaceFontName,
+ sal_uInt16& rFlags )
+{
+ const ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst;
+ if( pSubst )
+ pSubst->GetFontSubstitute( n, rFontName, rReplaceFontName, rFlags );
+}
+
+// -----------------------------------------------------------------------
+
+bool ImplDirectFontSubstitution::GetFontSubstitute( int nIndex,
+ String& rFontName, String& rSubstFontName, sal_uInt16& rFlags ) const
+{
+ FontSubstList::const_iterator it = maFontSubstList.begin();
+ for( int nCount = 0; (it != maFontSubstList.end()) && (nCount++ != nIndex); ++it ) ;
+ if( it == maFontSubstList.end() )
+ return false;
+
+ const ImplFontSubstEntry* pEntry = &(*it);
+ rFontName = pEntry->maName;
+ rSubstFontName = pEntry->maReplaceName;
+ rFlags = pEntry->mnFlags;
+ return true;
+}
+
+// -----------------------------------------------------------------------
+
bool ImplDirectFontSubstitution::FindFontSubstitute( String& rSubstName,
const String& rSearchName, sal_uInt16 nFlags ) const
{
@@ -1668,6 +1699,18 @@ void ImplDevFontList::InitMatchData() const
}
}
+//----------------------------------------------------------------------------
+ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const
+{
+ // get the default font for a specified locale
+ const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get();
+ const String aDefault = rDefaults.getUserInterfaceFont( rLocale );
+ ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault );
+ if( pFontData )
+ return pFontData;
+ return NULL;
+}
+
// -----------------------------------------------------------------------
ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( sal_uLong nSearchType,
@@ -3135,6 +3178,15 @@ bool OutputDevice::ImplNewFont() const
// -----------------------------------------------------------------------
+long OutputDevice::ImplGetTextWidth( const SalLayout& rSalLayout ) const
+{
+ long nWidth = rSalLayout.GetTextWidth();
+ nWidth /= rSalLayout.GetUnitsPerPixel();
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY,
long nDistX, long nDistY, long nWidth, long nHeight )
{
@@ -5460,6 +5512,13 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
// ------------------------------------------------------------------------
+sal_Bool OutputDevice::IsTextUnderlineAbove( const Font& rFont )
+{
+ return ImplIsUnderlineAbove( rFont );
+}
+
+// ------------------------------------------------------------------------
+
void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
sal_uInt16 nStyle )
{
@@ -5967,9 +6026,7 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr,
if( bFilter )
{
xub_StrLen nCutStart, nCutStop, nOrgLen = nLen;
- rtl::OUString aTmpStr(aStr);
- bool bFiltered = mpGraphics->filterText( rOrigStr, aTmpStr, nMinIndex, nLen, nCutStart, nCutStop );
- aStr = aTmpStr;
+ bool bFiltered = mpGraphics->filterText( rOrigStr, aStr, nMinIndex, nLen, nCutStart, nCutStop );
if( !nLen )
return NULL;
@@ -6416,7 +6473,8 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r
nFormatLines = nLines-1;
pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
- aLastLine = convertLineEnd(aStr.Copy(pLineInfo->GetIndex()), LINEEND_LF);
+ aLastLine = aStr.Copy( pLineInfo->GetIndex() );
+ aLastLine.ConvertLineEnd( LINEEND_LF );
// Alle LineFeed's durch Spaces ersetzen
xub_StrLen nLastLineLen = aLastLine.Len();
for ( i = 0; i < nLastLineLen; i++ )
@@ -7438,6 +7496,17 @@ long OutputDevice::GetMinKashida() const
ImplFontMetricData* pMetric = &(pEntry->maMetric);
return ImplDevicePixelToLogicWidth( pMetric->mnMinKashida );
}
+// -----------------------------------------------------------------------
+
+long OutputDevice::GetMinKashida( const Font& rFont ) const
+{
+ // select font, query Kashida, select original font again
+ Font aOldFont = GetFont();
+ const_cast<OutputDevice*>(this)->SetFont( rFont );
+ long aKashida = GetMinKashida();
+ const_cast<OutputDevice*>(this)->SetFont( aOldFont );
+ return aKashida;
+}
// -----------------------------------------------------------------------
xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt,
More information about the Libreoffice-commits
mailing list