vcl/generic/glyphs/gcach_ftyp.cxx | 56 +++++++++---------- vcl/generic/glyphs/gcach_ftyp.hxx | 30 +++++----- vcl/inc/PhysicalFontFace.hxx | 1 vcl/inc/fontattributes.hxx | 19 ++---- vcl/inc/fontselect.hxx | 88 ++++++++++++++++++++++++++++++ vcl/inc/generic/glyphcache.hxx | 6 +- vcl/inc/outfont.hxx | 110 +------------------------------------- vcl/inc/textlineinfo.hxx | 78 ++++++++++++++++++++++++++ vcl/source/gdi/pdfwriter_impl.cxx | 1 vcl/source/outdev/text.cxx | 2 10 files changed, 225 insertions(+), 166 deletions(-)
New commits: commit f5151af414f0ac0590d87040929cabe7f8db3106 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Thu Jan 7 15:25:31 2016 +1100 vcl: FtFont{Info|File} renamed to FreetypeFont{Info|Type} Change-Id: I91621a177f27200c9d3413dd4953d5292a2ac15b diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 686be00..f293998 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -74,7 +74,7 @@ static FT_Library aLibFT = nullptr; // enable linking with old FT versions static int nFTVERSION = 0; -typedef std::unordered_map<const char*, std::shared_ptr<FtFontFile>, rtl::CStringHash, rtl::CStringEqual> FontFileList; +typedef std::unordered_map<const char*, std::shared_ptr<FreetypeFontFile>, rtl::CStringHash, rtl::CStringEqual> FontFileList; namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; } @@ -91,7 +91,7 @@ static int nDefaultPrioAntiAlias = 1; // FreetypeManager -FtFontFile::FtFontFile( const OString& rNativeFileName ) +FreetypeFontFile::FreetypeFontFile( const OString& rNativeFileName ) : maNativeFileName( rNativeFileName ), mpFileMap( nullptr ), mnFileSize( 0 ), @@ -117,7 +117,7 @@ FtFontFile::FtFontFile( const OString& rNativeFileName ) } } -FtFontFile* FtFontFile::FindFontFile( const OString& rNativeFileName ) +FreetypeFontFile* FreetypeFontFile::FindFontFile( const OString& rNativeFileName ) { // font file already known? (e.g. for ttc, synthetic, aliased fonts) const char* pFileName = rNativeFileName.getStr(); @@ -127,13 +127,13 @@ FtFontFile* FtFontFile::FindFontFile( const OString& rNativeFileName ) return it->second.get(); // no => create new one - FtFontFile* pFontFile = new FtFontFile( rNativeFileName ); + FreetypeFontFile* pFontFile = new FreetypeFontFile( rNativeFileName ); pFileName = pFontFile->maNativeFileName.getStr(); rFontFileList[pFileName].reset(pFontFile); return pFontFile; } -bool FtFontFile::Map() +bool FreetypeFontFile::Map() { if( mnRefCount++ <= 0 ) { @@ -160,7 +160,7 @@ bool FtFontFile::Map() return (mpFileMap != nullptr); } -void FtFontFile::Unmap() +void FreetypeFontFile::Unmap() { if( (--mnRefCount > 0) || (mpFileMap == nullptr) ) return; @@ -170,10 +170,10 @@ void FtFontFile::Unmap() } #if ENABLE_GRAPHITE -// wrap FtFontInfo's table function +// wrap FreetypeFontInfo's table function const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, size_t *len) { - const FtFontInfo * pFontInfo = static_cast<const FtFontInfo*>(appFaceHandle); + const FreetypeFontInfo * pFontInfo = static_cast<const FreetypeFontInfo*>(appFaceHandle); typedef union { char m_c[5]; unsigned int m_id; @@ -196,11 +196,11 @@ const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, siz } #endif -FtFontInfo::FtFontInfo( const ImplFontAttributes& rDevFontAttributes, +FreetypeFontInfo::FreetypeFontInfo( const ImplFontAttributes& rDevFontAttributes, const OString& rNativeFileName, int nFaceNum, sal_IntPtr nFontId) : maFaceFT( nullptr ), - mpFontFile( FtFontFile::FindFontFile( rNativeFileName ) ), + mpFontFile( FreetypeFontFile::FindFontFile( rNativeFileName ) ), mnFaceNum( nFaceNum ), mnRefCount( 0 ), #if ENABLE_GRAPHITE @@ -219,7 +219,7 @@ FtFontInfo::FtFontInfo( const ImplFontAttributes& rDevFontAttributes, maDevFontAttributes.IncreaseQualityBy( mpFontFile->GetLangBoost() ); } -FtFontInfo::~FtFontInfo() +FreetypeFontInfo::~FreetypeFontInfo() { if( mpFontCharMap ) mpFontCharMap = nullptr; @@ -230,14 +230,14 @@ FtFontInfo::~FtFontInfo() #endif } -void FtFontInfo::InitHashes() const +void FreetypeFontInfo::InitHashes() const { // TODO: avoid pointers when empty stl::hash_* objects become cheap mpChar2Glyph = new Int2IntMap(); mpGlyph2Char = new Int2IntMap(); } -FT_FaceRec_* FtFontInfo::GetFaceFT() +FT_FaceRec_* FreetypeFontInfo::GetFaceFT() { if (!maFaceFT && mpFontFile->Map()) { @@ -253,7 +253,7 @@ FT_FaceRec_* FtFontInfo::GetFaceFT() } #if ENABLE_GRAPHITE -GraphiteFaceWrapper * FtFontInfo::GetGraphiteFace() +GraphiteFaceWrapper * FreetypeFontInfo::GetGraphiteFace() { if (mbCheckedGraphite) return mpGraphiteFace; @@ -275,7 +275,7 @@ GraphiteFaceWrapper * FtFontInfo::GetGraphiteFace() } #endif -void FtFontInfo::ReleaseFaceFT() +void FreetypeFontInfo::ReleaseFaceFT() { if (--mnRefCount <= 0) { @@ -293,7 +293,7 @@ static const sal_uInt32 T_true = 0x74727565; /* 'true' */ static const sal_uInt32 T_ttcf = 0x74746366; /* 'ttcf' */ static const sal_uInt32 T_otto = 0x4f54544f; /* 'OTTO' */ -const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength ) const +const unsigned char* FreetypeFontInfo::GetTable( const char* pTag, sal_uLong* pLength ) const { const unsigned char* pBuffer = mpFontFile->GetBuffer(); int nFileSize = mpFontFile->GetFileSize(); @@ -329,7 +329,7 @@ const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength return nullptr; } -void FtFontInfo::AnnounceFont( PhysicalFontCollection* pFontCollection ) +void FreetypeFontInfo::AnnounceFont( PhysicalFontCollection* pFontCollection ) { ImplFTSFontData* pFD = new ImplFTSFontData( this, maDevFontAttributes ); pFontCollection->Add( pFD ); @@ -380,7 +380,7 @@ void FreetypeManager::AddFontFile( const OString& rNormalizedName, if( maFontList.find( nFontId ) != maFontList.end() ) return; - FtFontInfo* pFontInfo = new FtFontInfo( rDevFontAttr, + FreetypeFontInfo* pFontInfo = new FreetypeFontInfo( rDevFontAttr, rNormalizedName, nFaceNum, nFontId); maFontList[ nFontId ] = pFontInfo; if( mnMaxFontId < nFontId ) @@ -391,8 +391,8 @@ void FreetypeManager::AnnounceFonts( PhysicalFontCollection* pToAdd ) const { for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it ) { - FtFontInfo* pFtFontInfo = it->second; - pFtFontInfo->AnnounceFont( pToAdd ); + FreetypeFontInfo* pFreetypeFontInfo = it->second; + pFreetypeFontInfo->AnnounceFont( pToAdd ); } } @@ -400,15 +400,15 @@ void FreetypeManager::ClearFontList( ) { for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it ) { - FtFontInfo* pFtFontInfo = it->second; - delete pFtFontInfo; + FreetypeFontInfo* pFreetypeFontInfo = it->second; + delete pFreetypeFontInfo; } maFontList.clear(); } ServerFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD ) { - FtFontInfo* pFontInfo = nullptr; + FreetypeFontInfo* pFontInfo = nullptr; // find a FontInfo matching to the font id sal_IntPtr nFontId = reinterpret_cast<sal_IntPtr>( rFSD.mpFontData ); @@ -424,9 +424,9 @@ ServerFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD ) return pNew; } -ImplFTSFontData::ImplFTSFontData( FtFontInfo* pFI, const ImplFontAttributes& rDFA ) +ImplFTSFontData::ImplFTSFontData( FreetypeFontInfo* pFI, const ImplFontAttributes& rDFA ) : PhysicalFontFace( rDFA ), - mpFtFontInfo( pFI ) + mpFreetypeFontInfo( pFI ) { SetBuiltInFontFlag( false ); SetOrientationFlag( true ); @@ -440,7 +440,7 @@ ImplFontEntry* ImplFTSFontData::CreateFontInstance( FontSelectPattern& rFSD ) co // ServerFont -ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI ) +ServerFont::ServerFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI ) : maGlyphList( 0), maFontSelData(rFSD), mnRefCount(1), @@ -976,7 +976,7 @@ const FontCharMapPtr ServerFont::GetFontCharMap() const return pFCMap; } -const FontCharMapPtr FtFontInfo::GetFontCharMap() +const FontCharMapPtr FreetypeFontInfo::GetFontCharMap() { // check if the charmap is already cached if( mpFontCharMap ) @@ -1000,7 +1000,7 @@ const FontCharMapPtr FtFontInfo::GetFontCharMap() } // TODO: merge into method GetFontCharMap() -bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const +bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& rResult ) const { rResult.mbSymbolic = IsSymbolFont(); diff --git a/vcl/generic/glyphs/gcach_ftyp.hxx b/vcl/generic/glyphs/gcach_ftyp.hxx index 3277777..acd74ec 100644 --- a/vcl/generic/glyphs/gcach_ftyp.hxx +++ b/vcl/generic/glyphs/gcach_ftyp.hxx @@ -28,13 +28,13 @@ class GraphiteFaceWrapper; #endif -// FtFontFile has the responsibility that a font file is only mapped once. +// FreetypeFontFile has the responsibility that a font file is only mapped once. // (#86621#) the old directly ft-managed solution caused it to be mapped // in up to nTTC*nSizes*nOrientation*nSynthetic times -class FtFontFile +class FreetypeFontFile { public: - static FtFontFile* FindFontFile( const OString& rNativeFileName ); + static FreetypeFontFile* FindFontFile( const OString& rNativeFileName ); bool Map(); void Unmap(); @@ -45,7 +45,7 @@ public: int GetLangBoost() const { return mnLangBoost; } private: - explicit FtFontFile( const OString& rNativeFileName ); + explicit FreetypeFontFile( const OString& rNativeFileName ); const OString maNativeFileName; unsigned char* mpFileMap; @@ -54,14 +54,14 @@ private: int mnLangBoost; }; -// FtFontInfo corresponds to an unscaled font face -class FtFontInfo +// FreetypeFontInfo corresponds to an unscaled font face +class FreetypeFontInfo { public: - FtFontInfo( const ImplFontAttributes&, + FreetypeFontInfo( const ImplFontAttributes&, const OString& rNativeFileName, int nFaceNum, sal_IntPtr nFontId); - ~FtFontInfo(); + ~FreetypeFontInfo(); const unsigned char* GetTable( const char*, sal_uLong* pLength=nullptr ) const; @@ -86,7 +86,7 @@ public: private: FT_FaceRec_* maFaceFT; - FtFontFile* mpFontFile; + FreetypeFontFile* mpFontFile; const int mnFaceNum; int mnRefCount; #if ENABLE_GRAPHITE @@ -108,7 +108,7 @@ private: // these two inlines are very important for performance -inline int FtFontInfo::GetGlyphIndex( sal_UCS4 cChar ) const +inline int FreetypeFontInfo::GetGlyphIndex( sal_UCS4 cChar ) const { if( !mpChar2Glyph ) return -1; @@ -118,7 +118,7 @@ inline int FtFontInfo::GetGlyphIndex( sal_UCS4 cChar ) const return it->second; } -inline void FtFontInfo::CacheGlyphIndex( sal_UCS4 cChar, int nIndex ) const +inline void FreetypeFontInfo::CacheGlyphIndex( sal_UCS4 cChar, int nIndex ) const { if( !mpChar2Glyph ) InitHashes(); @@ -140,7 +140,7 @@ public: ServerFont* CreateFont( const FontSelectPattern& ); private: - typedef std::unordered_map<sal_IntPtr,FtFontInfo*> FontList; + typedef std::unordered_map<sal_IntPtr,FreetypeFontInfo*> FontList; FontList maFontList; sal_IntPtr mnMaxFontId; @@ -149,14 +149,14 @@ private: class ImplFTSFontData : public PhysicalFontFace { private: - FtFontInfo* mpFtFontInfo; + FreetypeFontInfo* mpFreetypeFontInfo; public: - ImplFTSFontData( FtFontInfo*, const ImplFontAttributes& ); + ImplFTSFontData( FreetypeFontInfo*, const ImplFontAttributes& ); virtual ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const override; virtual PhysicalFontFace* Clone() const override { return new ImplFTSFontData( *this ); } - virtual sal_IntPtr GetFontId() const override { return mpFtFontInfo->GetFontId(); } + virtual sal_IntPtr GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); } }; #endif // INCLUDED_VCL_GENERIC_GLYPHS_GCACH_FTYP_HXX diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index bad1721..a14d8f0 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -39,7 +39,7 @@ #include <unordered_map> class FreetypeManager; -class FtFontInfo; +class FreetypeFontInfo; class GlyphData; class GraphiteFaceWrapper; class FontConfigFontOptions; @@ -147,7 +147,7 @@ private: class VCL_DLLPUBLIC ServerFont { public: - ServerFont( const FontSelectPattern&, FtFontInfo* ); + ServerFont( const FontSelectPattern&, FreetypeFontInfo* ); virtual ~ServerFont(); const OString& GetFontFileName() const; @@ -223,7 +223,7 @@ private: int mnPrioEmbedded; int mnPrioAntiAlias; int mnPrioAutoHint; - FtFontInfo* mpFontInfo; + FreetypeFontInfo* mpFontInfo; FT_Int mnLoadFlags; double mfStretch; FT_FaceRec_* maFaceFT; commit 575d39c56feb2102ad3c68da960f6630c12baefa Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Thu Jan 7 14:54:58 2016 +1100 vcl: cleanup headers - remove unnecessary includes and fwd decls Change-Id: Ib3cb2d905242d2a15935c074cb6d0634102de4e5 diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx index e8467f8..a0a9e6d 100644 --- a/vcl/inc/fontattributes.hxx +++ b/vcl/inc/fontattributes.hxx @@ -20,22 +20,15 @@ #ifndef INCLUDED_VCL_INC_FONTATTRIBUTES_HXX #define INCLUDED_VCL_INC_FONTATTRIBUTES_HXX +#include <sal/types.h> #include <i18nlangtag/lang.h> -#include <vcl/dllapi.h> #include <unotools/fontdefs.hxx> +#include <vcl/dllapi.h> #include <vcl/vclenum.hxx> #include "fontselect.hxx" -#include <unordered_map> - -class PhysicalFontFace; -class ImplFontEntry; -class ImplFontCache; -namespace vcl { class Font; } -class ConvertChar; class OutputDevice; -class Size; class FontSelectPattern; class ImplFontAttributes diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 80ed409..5049cad 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -28,7 +28,6 @@ #include <unordered_map> -namespace vcl { class Font; } class ImplFontCache; class ConvertChar; diff --git a/vcl/inc/textlineinfo.hxx b/vcl/inc/textlineinfo.hxx index 9686deb..807cdd6 100644 --- a/vcl/inc/textlineinfo.hxx +++ b/vcl/inc/textlineinfo.hxx @@ -23,16 +23,6 @@ #include <vcl/dllapi.h> #include <sal/types.h> -#include <unordered_map> - -class PhysicalFontFace; -class ImplFontEntry; -class ImplFontCache; -namespace vcl { class Font; } -class ConvertChar; -class OutputDevice; -class Size; - class ImplTextLineInfo { private: commit 7785c201a7e60a69f04dbf90a32f5539bebd92e4 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Thu Jan 7 14:44:08 2016 +1100 vcl: split more font classes from outfont.hxx Change-Id: Ifa10c3b954dd245ff8357b790b59316b3fb111a9 diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx index c79986c..6af79d7 100644 --- a/vcl/inc/PhysicalFontFace.hxx +++ b/vcl/inc/PhysicalFontFace.hxx @@ -24,6 +24,7 @@ #include "outfont.hxx" #include "fontattributes.hxx" +#include "fontselect.hxx" class ImplFontEntry; struct FontMatchStatus; diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx index a958d04..e8467f8 100644 --- a/vcl/inc/fontattributes.hxx +++ b/vcl/inc/fontattributes.hxx @@ -17,15 +17,15 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_VCL_INC_FONTSELECT_HXX -#define INCLUDED_VCL_INC_FONTSELECT_HXX +#ifndef INCLUDED_VCL_INC_FONTATTRIBUTES_HXX +#define INCLUDED_VCL_INC_FONTATTRIBUTES_HXX #include <i18nlangtag/lang.h> #include <vcl/dllapi.h> #include <unotools/fontdefs.hxx> #include <vcl/vclenum.hxx> -#include "outfont.hxx" +#include "fontselect.hxx" #include <unordered_map> @@ -241,6 +241,6 @@ private: }; -#endif // INCLUDED_VCL_INC_FONTSELECT_HXX +#endif // INCLUDED_VCL_INC_FONTATTRIBUTES_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx new file mode 100644 index 0000000..595f3c9 --- /dev/null +++ b/vcl/inc/fontselect.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_FONTSELECT_HXX +#define INCLUDED_VCL_INC_FONTSELECT_HXX + +#include <vcl/dllapi.h> +#include "fontattributes.hxx" + +#include <unordered_map> + +class PhysicalFontFace; +class ImplFontEntry; +class ImplFontCache; +namespace vcl { class Font; } +class ConvertChar; +class OutputDevice; +class Size; + +class FontSelectPatternAttributes : public ImplFontAttributes +{ +public: + FontSelectPatternAttributes( const vcl::Font&, const OUString& rSearchName, + const Size&, float fExactHeight ); +#ifdef WNT + FontSelectPatternAttributes( const PhysicalFontFace&, const Size&, + float fExactHeight, int nOrientation, bool bVertical ); +#endif + + size_t hashCode() const; + bool operator==(const FontSelectPatternAttributes& rOther) const; + bool operator!=(const FontSelectPatternAttributes& rOther) const + { + return !(*this == rOther); + } + +public: + OUString maTargetName; // name of the font name token that is chosen + OUString maSearchName; // name of the font that matches best + int mnWidth; // width of font in pixel units + int mnHeight; // height of font in pixel units + float mfExactHeight; // requested height (in pixels with subpixel details) + int mnOrientation; // text orientation in 3600 system + LanguageType meLanguage; // text language + bool mbVertical; // vertical mode of requested font + bool mbNonAntialiased; // true if antialiasing is disabled + + bool mbEmbolden; // Force emboldening + ItalicMatrix maItalicMatrix; // Force matrix for slant +}; + +class FontSelectPattern : public FontSelectPatternAttributes +{ +public: + FontSelectPattern( const vcl::Font&, const OUString& rSearchName, + const Size&, float fExactHeight ); +#ifdef WNT +// ifdeffed to prevent it going into unusedcode.easy + FontSelectPattern( const PhysicalFontFace&, const Size&, + float fExactHeight, int nOrientation, bool bVertical ); +#endif + +public: // TODO: change to private + const PhysicalFontFace* mpFontData; // a matching PhysicalFontFace object + ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry + + void copyAttributes(const FontSelectPatternAttributes &rAttributes); +}; + +#endif // INCLUDED_VCL_INC_FONTSELECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index cb5b983..80ed409 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -20,70 +20,17 @@ #ifndef INCLUDED_VCL_INC_OUTFONT_HXX #define INCLUDED_VCL_INC_OUTFONT_HXX +#include <sal/types.h> #include <vcl/dllapi.h> + +#include "fontselect.hxx" #include "fontattributes.hxx" #include <unordered_map> -class PhysicalFontFace; -class ImplFontEntry; -class ImplFontCache; namespace vcl { class Font; } +class ImplFontCache; class ConvertChar; -class OutputDevice; -class Size; - -class FontSelectPatternAttributes : public ImplFontAttributes -{ -public: - FontSelectPatternAttributes( const vcl::Font&, const OUString& rSearchName, - const Size&, float fExactHeight ); -#ifdef WNT - FontSelectPatternAttributes( const PhysicalFontFace&, const Size&, - float fExactHeight, int nOrientation, bool bVertical ); -#endif - - size_t hashCode() const; - bool operator==(const FontSelectPatternAttributes& rOther) const; - bool operator!=(const FontSelectPatternAttributes& rOther) const - { - return !(*this == rOther); - } - -public: - OUString maTargetName; // name of the font name token that is chosen - OUString maSearchName; // name of the font that matches best - int mnWidth; // width of font in pixel units - int mnHeight; // height of font in pixel units - float mfExactHeight; // requested height (in pixels with subpixel details) - int mnOrientation; // text orientation in 3600 system - LanguageType meLanguage; // text language - bool mbVertical; // vertical mode of requested font - bool mbNonAntialiased; // true if antialiasing is disabled - - bool mbEmbolden; // Force emboldening - ItalicMatrix maItalicMatrix; // Force matrix for slant -}; - -class FontSelectPattern : public FontSelectPatternAttributes -{ -public: - FontSelectPattern( const vcl::Font&, const OUString& rSearchName, - const Size&, float fExactHeight ); -#ifdef WNT -// ifdeffed to prevent it going into unusedcode.easy - FontSelectPattern( const PhysicalFontFace&, const Size&, - float fExactHeight, int nOrientation, bool bVertical ); -#endif - -public: // TODO: change to private - const PhysicalFontFace* mpFontData; // a matching PhysicalFontFace object - ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry - - void copyAttributes(const FontSelectPatternAttributes &rAttributes); -}; - -// - ImplFontEntry - // TODO: rename ImplFontEntry to LogicalFontInstance // TODO: allow sharing of metrics for related fonts @@ -121,56 +68,6 @@ private: UnicodeFallbackList* mpUnicodeFallbackList; }; -class ImplTextLineInfo -{ -private: - long mnWidth; - sal_Int32 mnIndex; - sal_Int32 mnLen; - -public: - ImplTextLineInfo( long nWidth, sal_Int32 nIndex, sal_Int32 nLen ) - { - if(nIndex == -1 || nIndex == 0x0FFFF || nLen == -1 || nLen == 0x0FFFF) - { - SAL_INFO("sal.rtl.xub", - "ImplTextLine Info Suspicious arguments nIndex:" << nIndex << " nLen:" << nLen); - } - mnWidth = nWidth; - mnIndex = nIndex; - mnLen = nLen; - } - - long GetWidth() const { return mnWidth; } - sal_Int32 GetIndex() const { return mnIndex; } - sal_Int32 GetLen() const { return mnLen; } -}; - -#define MULTITEXTLINEINFO_RESIZE 16 - -class ImplMultiTextLineInfo -{ -public: - ImplMultiTextLineInfo(); - ~ImplMultiTextLineInfo(); - - void AddLine( ImplTextLineInfo* pLine ); - void Clear(); - - ImplTextLineInfo* GetLine( sal_Int32 nLine ) const - { return mpLines[nLine]; } - sal_Int32 Count() const { return mnLines; } - -private: - ImplMultiTextLineInfo( const ImplMultiTextLineInfo& ) = delete; - ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& ) = delete; - - ImplTextLineInfo** mpLines; - sal_Int32 mnLines; - sal_Int32 mnSize; - -}; - #endif // INCLUDED_VCL_INC_OUTFONT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/textlineinfo.hxx b/vcl/inc/textlineinfo.hxx new file mode 100644 index 0000000..9686deb --- /dev/null +++ b/vcl/inc/textlineinfo.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_TEXTLINEINFO_HXX +#define INCLUDED_VCL_INC_TEXTLINEINFO_HXX + +#include <vcl/dllapi.h> +#include <sal/types.h> + +#include <unordered_map> + +class PhysicalFontFace; +class ImplFontEntry; +class ImplFontCache; +namespace vcl { class Font; } +class ConvertChar; +class OutputDevice; +class Size; + +class ImplTextLineInfo +{ +private: + long mnWidth; + sal_Int32 mnIndex; + sal_Int32 mnLen; + +public: + ImplTextLineInfo( long nWidth, sal_Int32 nIndex, sal_Int32 nLen ) + { + if(nIndex == -1 || nIndex == 0x0FFFF || nLen == -1 || nLen == 0x0FFFF) + { + SAL_INFO("sal.rtl.xub", + "ImplTextLine Info Suspicious arguments nIndex:" << nIndex << " nLen:" << nLen); + } + mnWidth = nWidth; + mnIndex = nIndex; + mnLen = nLen; + } + + long GetWidth() const { return mnWidth; } + sal_Int32 GetIndex() const { return mnIndex; } + sal_Int32 GetLen() const { return mnLen; } +}; + +#define MULTITEXTLINEINFO_RESIZE 16 + +class ImplMultiTextLineInfo +{ +public: + ImplMultiTextLineInfo(); + ~ImplMultiTextLineInfo(); + + void AddLine( ImplTextLineInfo* pLine ); + void Clear(); + + ImplTextLineInfo* GetLine( sal_Int32 nLine ) const + { return mpLines[nLine]; } + sal_Int32 Count() const { return mnLines; } + +private: + ImplMultiTextLineInfo( const ImplMultiTextLineInfo& ) = delete; + ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& ) = delete; + + ImplTextLineInfo** mpLines; + sal_Int32 mnLines; + sal_Int32 mnSize; + +}; + +#endif // INCLUDED_VCL_INC_TEXTLINEINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 7a53504..14cfa6c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -67,6 +67,7 @@ #include "salgdi.hxx" #include "sallayout.hxx" #include "textlayout.hxx" +#include "textlineinfo.hxx" #include "pdfwriter_impl.hxx" diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index b396e53..762e33a 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -47,6 +47,8 @@ #include <svdata.hxx> #include <textlayout.hxx> +#include "textlineinfo.hxx" + #include <config_graphite.h> #if ENABLE_GRAPHITE #include "graphite_features.hxx" _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits