--- a/fontservices/fontstore/group/BLD.INF Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/group/BLD.INF Sat Feb 20 00:37:46 2010 +0200
@@ -44,7 +44,6 @@
PRJ_MMPFILES
../group/FNTSTORE.MMP
-../group/fntstore_fmm.mmp
PRJ_TESTMMPFILES
@@ -52,6 +51,7 @@
../group/tcachedeletionprocess.mmp
../group/T_WriteInvalidFontFile.mmp
../group/T_RemoveInvalidFontFile.mmp
+../group/tfontsessioncacheproc.mmp
PRJ_TESTEXPORTS
@@ -85,6 +85,7 @@
../tfs/scripts/fntstoretest_T_LinkedFontUpdateInitial.script z:/fntstoretest/fntstoretest_T_LinkedFontUpdateInitial.script
../tfs/scripts/fntstoretest_T_LinkedFontUpdateStage1.script z:/fntstoretest/fntstoretest_T_LinkedFontUpdateStage1.script
../tfs/scripts/fntstoretest_T_LinkedFontUpdateStage2.script z:/fntstoretest/fntstoretest_T_LinkedFontUpdateStage2.script
+../tfs/scripts/fntstoretest_T_FontSessionCache.script z:/fntstoretest/fntstoretest_T_FontSessionCache.script
../tfs/CEUROPE.GDR z:/resource/fonts/ceurope.gdr
@@ -147,3 +148,4 @@
../tfs/scripts/tsetdefaulttypefacename.ini z:/fntstoretest/tsetdefaulttypefacename.ini
+
--- a/fontservices/fontstore/group/FntstoreTest.iby Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/group/FntstoreTest.iby Sat Feb 20 00:37:46 2010 +0200
@@ -50,11 +50,13 @@
data=DATAZ_\fntstoretest\fntstoretest_T_LinkedFontUpdateInitial.script \fntstoretest\fntstoretest_T_LinkedFontUpdateInitial.script
data=DATAZ_\fntstoretest\fntstoretest_T_LinkedFontUpdateStage1.script \fntstoretest\fntstoretest_T_LinkedFontUpdateStage1.script
data=DATAZ_\fntstoretest\fntstoretest_T_LinkedFontUpdateStage2.script \fntstoretest\fntstoretest_T_LinkedFontUpdateStage2.script
+data=DATAZ_\fntstoretest\fntstoretest_T_FontSessionCache.script \fntstoretest\fntstoretest_T_FontSessionCache.script
// FntStore test code - TFntStoreServer.exe needs to be copied into \sys\bin\ and set as data so it will be copied to the c: drive and we can change the capabilities of the .exe
data=ABI_DIR\DEBUG_DIR\TFntStoreServer.exe \sys\bin\TFntStoreServer.exe
//file=ABI_DIR\DEBUG_DIR\TFntStoreServer.exe \sys\bin\TFntStoreServer.exe
file=ABI_DIR\DEBUG_DIR\tcachedeletionprocess.exe \sys\bin\tcachedeletionprocess.exe
+file=ABI_DIR\DEBUG_DIR\tfontsessioncacheproc.exe \sys\bin\tfontsessioncacheproc.exe
// 7650 font which should be compatible with new font compression
--- a/fontservices/fontstore/group/TFntStoreServer.mmp Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/group/TFntStoreServer.mmp Sat Feb 20 00:37:46 2010 +0200
@@ -41,27 +41,28 @@
SOURCE TFntStoreServer.cpp
SOURCE T_FNTMEM.CPP
-SOURCE T_FSOPEN.CPP
+SOURCE T_FSOPEN.CPP
SOURCE T_FontBitmap.CPP
SOURCE FNTBODY_OLD.CPP
SOURCE T_MatchFonts.cpp
SOURCE T_GlyphTreeDel.cpp
SOURCE T_OpenFontTypes.cpp
-SOURCE T_GetNearestFont.cpp
-SOURCE T_GetNearestFontCapability.cpp
-SOURCE T_SetDefaultTypefaceName.cpp
+SOURCE T_GetNearestFont.cpp
+SOURCE T_GetNearestFontCapability.cpp
+SOURCE T_SetDefaultTypefaceName.cpp
SOURCE T_FontMetrics.cpp
SOURCE T_FNT.CPP
-SOURCE t_corruptfonts.cpp
-SOURCE T_SHAPERCACHE.CPP
-source t_cachedeletion.cpp
-SOURCE T_LinkedFonts2.cpp
-SOURCE t_linkedfontsmemory.cpp
-SOURCE t_linkedfontscomparison.cpp
-SOURCE t_linkedfontscapability.cpp
-SOURCE T_LinkedFontUpdateTests.cpp
+SOURCE t_corruptfonts.cpp
+SOURCE T_SHAPERCACHE.CPP
+source t_cachedeletion.cpp
+SOURCE T_LinkedFonts2.cpp
+SOURCE t_linkedfontsmemory.cpp
+SOURCE t_linkedfontscomparison.cpp
+SOURCE t_linkedfontscapability.cpp
+SOURCE T_LinkedFontUpdateTests.cpp
SOURCE T_IsolatedFontStore.cpp
SOURCE T_Cache.CPP
+SOURCE T_FontSessionCache.cpp
SOURCEPATH ../src
SOURCE FNTBODY.CPP
--- a/fontservices/fontstore/group/fntstore.iby Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/group/fntstore.iby Sat Feb 20 00:37:46 2010 +0200
@@ -21,11 +21,7 @@
REM Font File & Object Manager
-#ifdef WITH_FLEXIBLE_MM
-file=ABI_DIR\BUILD_DIR\fntstr_fmm.dll System\Libs\FntStr.dll
-#else
file=ABI_DIR\BUILD_DIR\fntstr.dll System\Libs\FntStr.dll
-#endif
#endif
--- a/fontservices/fontstore/group/fntstore_fmm.mmp Tue Feb 02 02:02:46 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* fntstr.dll Font store
-*
-*/
-
-
-/**
- @file
-*/
-
-TARGET fntstr_fmm.dll
-CAPABILITY All -Tcb
-TARGETTYPE dll
-
-UID 0x1000008d 0x10003b1a
-VENDORID 0x70000001
-
-// This option turns off any warnings in the CW build
-// This is a temp workaround until a better solution is found
-// for 2 warnings that appear when building fntstore.cpp
-// Remove this option when making any changes to this component
-// to avoid overlooking any new warnings.
-// MAY BE NEEDED IN THE FUTURE
-// OPTION CW -w off
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../../graphics/fbs/fontandbitmapserver/inc
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-SOURCEPATH ../src
-
-SOURCE FNTBODY.CPP
-SOURCE FNTSTORE.CPP
-SOURCE FNTUTIL.CPP
-SOURCE OPENFONT.CPP
-SOURCE ShaperCache.CPP
-SOURCE linkedfonts.cpp
-SOURCE patchableconstants.cpp
-
-LIBRARY euser.lib
-LIBRARY efsrv.lib
-LIBRARY estor.lib
-LIBRARY gdi.lib
-LIBRARY ecom.lib
-LIBRARY fbscli.lib
-LIBRARY hal.lib
-
-#ifdef WINSCW
-DEFFILE FNTSTR2.DEF
-#else
-DEFFILE fntstr2.def
-#endif
-
-START WINS
-BASEADDRESS 0x41700000
-END
-
-MACRO KMaxGlyphCacheMemory=32768
-MACRO FNTSTORE_SUPPORT_FMM
-UNPAGED
-
-
-SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fontservices/fontstore/group/tfontsessioncacheproc.mmp Sat Feb 20 00:37:46 2010 +0200
@@ -0,0 +1,36 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+TARGETTYPE EXE
+TARGET tfontsessioncacheproc.exe
+
+UID 0
+SOURCEPATH ../tfs
+
+userinclude ../tfs ../inc ../src
+APP_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
+
+SOURCE T_fontsessioncacheproc.cpp
+
+LIBRARY euser.lib
+LIBRARY gdi.lib
+LIBRARY fntstr.lib
+LIBRARY fbscli.lib
+LIBRARY bitgdi.lib
+
+
+SMPSAFE
--- a/fontservices/fontstore/inc/FNTSTORE.h Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/inc/FNTSTORE.h Sat Feb 20 00:37:46 2010 +0200
@@ -209,19 +209,22 @@
TAlgStyle iAlgStyle; // must not move this member
private:
- // Binary Compatibility warning - data member iOpenFont is referenced by inline methods
- RHeap* iHeap;
- TInt iFontBitmapOffset;
- COpenFont* iOpenFont; // if iOpenFont is non-null this is an open font and many functions are forwarded to it
-
-#ifdef FNTSTORE_SUPPORT_FMM
- // If iOpenFontOffet is non-zero this is an open font
- TInt iOpenFontOffset;
-#else
- TUint32 iReserved;
-#endif // FNTSTORE_SUPPORT_FMM
+ // Binary Compatibility warning - data member iOpenFont is referenced by inline methods
+ RHeap* iHeap;
+ TInt iFontBitmapOffset;
+
+ // In order to be able to work with the flexible memory model, iOpenFont is
+ // actually an offset from the address of this class.
+ // iOpenFont's type remains unchanged.
+ // As Qt code that uses OpenFont() must be able to run on new and old versions
+ // of Symbian OS, it must be able to determine whether iOpenFont is a pointer or
+ // an offset at run-time. Therefore an offset will have its lowest significant bit set to 1.
+ // If iOpenFont is null, this object is not an open font.
+ // Assumption: a pointer always has least significant bit value of zero.
+ COpenFont* iOpenFont; // if iOpenFont is non-null this is an open font and many functions are forwarded to it
- TUint32 iUniqueFontId; // unique id for this instance of this font
+ TUint32 iReserved;
+ TUint32 iUniqueFontId; // unique id for this instance of this font
};
/**
@@ -459,14 +462,10 @@
*/
inline TBool CBitmapFont::IsOpenFont() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
- return iOpenFontOffset!=0;
-#else
return iOpenFont != NULL;
-#endif // FNTSTORE_SUPPORT_FMM
}
-#ifdef FNTSTORE_SUPPORT_FMM
+
/** Returns a pointer to the open font being used by the bitmap font object.
@return A pointer to an open font.
@@ -474,23 +473,15 @@
*/
inline COpenFont* CBitmapFont::OpenFont() const
{
- if (IsOpenFont())
- {
- return reinterpret_cast<COpenFont*>(reinterpret_cast<TInt>(this)+iOpenFontOffset);
- }
- return NULL;
+ if (reinterpret_cast<TInt>(iOpenFont) & 1)
+ {
+ return reinterpret_cast<COpenFont*>(const_cast<CBitmapFont*>(PtrAdd(this, reinterpret_cast<TInt>(iOpenFont) & ~1)));
+ }
+ else
+ {
+ return iOpenFont;
+ }
}
-#else
-/** Returns a pointer to the open font being used by the bitmap font object.
-
-@return A pointer to an open font.
-@see IsOpenFont()
-*/
-inline COpenFont* CBitmapFont::OpenFont() const
- {
- return iOpenFont;
- }
-#endif // FNTSTORE_SUPPORT_FMM
/** Gets the anti-aliasing setting for the font, see TGlyphBitmapType for
the range of values.
--- a/fontservices/fontstore/inc/OPENFONT.H Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/inc/OPENFONT.H Sat Feb 20 00:37:46 2010 +0200
@@ -339,17 +339,15 @@
inline TInt FontMaxHeight() const;
void DeleteShaper() const;
TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, TInt& aLength);
- TInt GetGlyphOutline(TUint aCode, TBool aHinted,
- TAny*& aOutline, TInt& aLength);
-#ifdef FNTSTORE_SUPPORT_FMM
-private:
+ TInt GetGlyphOutline(TUint aCode, TBool aHinted, TAny*& aOutline, TInt& aLength);
+
+protected:
/** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
*/
TInt PointerToThisOffset(const TAny* aAny);
/** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
*/
TAny* ThisOffsetToPointer(const TInt aOffset);
-#endif // FNTSTORE_SUPPORT_FMM
protected:
RHeap* iHeap;
@@ -383,57 +381,44 @@
private:
const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const;
protected:
-#ifdef FNTSTORE_SUPPORT_FMM
+
/** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
*/
const COpenFontGlyph* FontCacheGlyph(TInt aCode,TInt*& aNode);
+ const COpenFontGlyph* FontCacheGlyph(TInt aCode);
- /** Used to calculate an offset that is applied to pointers to objects on the
- FBServ shared heap to convert them to valid pointers in the current process.
- Add the value returned here to pointers to items on the shared heap to get a
- valid pointer to the item in the current process.
-
- WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
-
- @return Returns an offset between the "this" pointer that this object had on
- construction and its current "this" pointer.
- */
- inline TInt Offset() const;
-#else
- /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
- */
- const COpenFontGlyph* FontCacheGlyph(TInt aCode,COpenFontGlyphTreeEntry**& aNode);
-#endif // FNTSTORE_SUPPORT_FMM
- /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
- */
- const COpenFontGlyph* FontCacheGlyph(TInt aCode);
+ void SetGlyphCache(COpenFontGlyphCache* aGlyphCache);
+
private:
const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode,
COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const;
void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData);
-#ifdef FNTSTORE_SUPPORT_FMM
- inline COpenFontSessionCacheList* SessionCacheList();
-#endif // FNTSTORE_SUPPORT_FMM
+
+ COpenFontSessionCacheList* SessionCacheList()const;
+
+ void SetSessionCacheList(COpenFontSessionCacheList* aSessionCacheList);
+
+ void SetFile(COpenFontFile* aFile);
private:
- COpenFontFile* iFile; // the file used by this font; null if it has been deleted
- // or cannot be used
+
+ // Offset from the address of the file used by this font.
+ // If the file has been deleted or cannot be used, the offest will be zero.
+ TInt iFileOffset;
+
TInt iFaceIndex; // index of the face in the font file
protected:
- /** WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please use the provided APIs only.
- */
- COpenFontGlyphCache* iGlyphCache; // the per-font glyph cache; owned by the font
+ /**
+ WARNING: Compatibility is not guaranteed in future releases. Please use the provided APIs only.
+ Offset from the address of this font of the per-font glyph cache which is owned by the font
+ @internalTechnology
+ */
+ TInt iGlyphCacheOffset;
private:
- COpenFontSessionCacheList* iSessionCacheList; // the list of per-session glyph caches; owned by CFontStore
-#ifdef FNTSTORE_SUPPORT_FMM
- /** The initial "this" pointer that this object has when created. When this
- object is used in a different process the offset between this starting
- "this" pointer and the current "this" pointer can be used to calculate
- the offset to other objects that also exist on the shared FBServ heap.
- @see Offset() */
- TInt iStartingThis;
-#else
+ // Offset from the address of this font of the list of per-session glyph
+ // caches which are owned by CFontStore
+ TInt iSessionCacheListOffset;
+
TAny* iReserved; // unused; for future expansion
-#endif // FNTSTORE_SUPPORT_FMM
};
/** Open Font System Extension Interface abstract base class.
@@ -1507,11 +1492,7 @@
@return The typeface attributes. */
inline const TOpenFontFaceAttrib* COpenFont::FaceAttrib() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
- return iFile ? &File()->FaceAttrib(iFaceIndex) : NULL;
-#else
- return iFile ? &iFile->FaceAttrib(iFaceIndex) : NULL;
-#endif // FNTSTORE_SUPPORT_FMM
+ return iFileOffset == 0 ? NULL : &File()->FaceAttrib(iFaceIndex);
}
/** Gets a pointer to the COpenFontFile which created this object.
@@ -1523,11 +1504,7 @@
@return The COpenFontFile which created this object. */
inline COpenFontFile* COpenFont::File() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
- return iFile?reinterpret_cast<COpenFontFile*>(reinterpret_cast<TInt>(iFile)+Offset()):NULL;
-#else
- return iFile;
-#endif // FNTSTORE_SUPPORT_FMM
+ return iFileOffset == 0 ? NULL : reinterpret_cast<COpenFontFile*>(const_cast<COpenFont*>(PtrAdd(this, iFileOffset)));
}
/** Gets the index of this typeface within the font file.
@@ -1648,26 +1625,6 @@
return iFontMaxAscent + iFontMaxDescent;
}
-#ifdef FNTSTORE_SUPPORT_FMM
-inline COpenFontSessionCacheList* COpenFont::SessionCacheList()
- {
- return iSessionCacheList?reinterpret_cast<COpenFontSessionCacheList*>(reinterpret_cast<TInt>(iSessionCacheList)+Offset()):NULL;
- }
-
-/** Used to calculate an offset that can be applied to pointers to objects on the
-FBServ shared heap to convert them to valid pointers in the current process.
-Add the value returned here to pointers to items on the shared heap to get a
-valid pointer to the item in the current process.
-
-@return Returns an offset between the "this" pointer that this object had on
-construction and its current "this" pointer.
- */
-inline TInt COpenFont::Offset() const
- {
- return reinterpret_cast<TInt>(this)-iStartingThis;
- }
-#endif // FNTSTORE_SUPPORT_FMM
-
/** Default C++ constructor.
This sets all attribute fields to zero. As for other T classes, there is no
--- a/fontservices/fontstore/inc/openfontsprivate.h Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/inc/openfontsprivate.h Sat Feb 20 00:37:46 2010 +0200
@@ -20,7 +20,6 @@
#define __OPENFONTS_PRIVATE_H__
#include <e32hashtab.h>
-
class COpenFontShaperCacheEntry;
/* MSB is set to indicate a glyph code rather than a unicode value
@@ -38,7 +37,6 @@
CFontStore* iFontStore; // pointer to the CFontStore instance that loaded the COpenFontFile
};
-#ifdef FNTSTORE_SUPPORT_FMM
/**
@internalComponent
*/
@@ -67,33 +65,6 @@
// calculated as (bitmapPointer)-(this)
TInt iBitmapOffset;
};
-#else
-/**
- @internalComponent
- */
-class COpenFontGlyph
- {
-public:
- COpenFontGlyph(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics):
- iCode(aCode), iGlyphIndex(aGlyphIndex), iMetrics(aMetrics), iBitmap(NULL) { }
-
- static COpenFontGlyph* NewL(RHeap* aHeap, TInt aCode, TInt aGlyphIndex,
- const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
-
- static void Delete(RHeap* aHeap, COpenFontGlyph* aGlyph);
-
- TInt iCode; // the Unicode value of the character
- TInt iGlyphIndex; // the glyph index
- TOpenFontCharMetrics iMetrics; // the metrics
- TUint8* iBitmap; // the run-length-encoded bitmap
-
-protected:
- TBool SetBitmap(RHeap* aHeap, const TDesC8& aBitmap);
- ~COpenFontGlyph();
- };
-#endif // FNTSTORE_SUPPORT_FMM
-
-#ifdef FNTSTORE_SUPPORT_FMM
/**
Binary tree of glyphs. Each glyph can have left and right child nodes which are added
depending on the value of their glyph code relative to the parent's glyph code.
@@ -110,94 +81,45 @@
private:
/** The left COpenFontGlyphTreeEntry from this entry. Represented by an offset from the
- current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
- COpenFontGlyphTreeEntry pointer. */
- TInt iLeftOffset;
- /** The right COpenFontGlyphTreeEntry from this entry. Represented by an offset from the
- current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
- COpenFontGlyphTreeEntry pointer. */
- TInt iRightOffset;
-
-private:
- COpenFontGlyphTreeEntry(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics)
- : COpenFontGlyph(aCode, aGlyphIndex, aMetrics), iLeftOffset(0), iRightOffset(0) {}
-
- ~COpenFontGlyphTreeEntry();
- };
-#else
-/**
- binary tree of glyphs
-
- @internalComponent
- */
-class COpenFontGlyphTreeEntry: public COpenFontGlyph
- {
-public:
- static COpenFontGlyphTreeEntry* New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex,
- const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
-
- COpenFontGlyphTreeEntry* iLeft; // pointer to left node in tree
- COpenFontGlyphTreeEntry* iRight; // pointer to right node in tree
- COpenFontGlyphTreeEntry* iNext; // pointer to next glyph in the list; so that the cache can be deleted non-recursively
+ current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
+ COpenFontGlyphTreeEntry pointer. */
+ TInt iLeftOffset;
+ /** The right COpenFontGlyphTreeEntry from this entry. Represented by an offset from the
+ current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
+ COpenFontGlyphTreeEntry pointer. */
+ TInt iRightOffset;
+ /** Pointer to next glyph that was added to the glyph cache. This enables
+ non-recursive deletion of the cache. This is only ever accessed from server
+ process, so can be a direct pointer, not an offset. */
+ COpenFontGlyphTreeEntry* iNext;
private:
COpenFontGlyphTreeEntry(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics)
- : COpenFontGlyph(aCode, aGlyphIndex, aMetrics), iLeft(NULL), iRight(NULL), iNext(NULL) { }
-
+ : COpenFontGlyph(aCode, aGlyphIndex, aMetrics), iLeftOffset(0), iRightOffset(0),iNext(NULL){}
+
~COpenFontGlyphTreeEntry();
};
-#endif // FNTSTORE_SUPPORT_FMM
-#ifdef FNTSTORE_SUPPORT_FMM
/**
- RArray for storing offsets to COpenFontGlyphTreeEntry objects. Stores each
- COpenFontGlyphTreeEntry as an offset from the "this" pointer of this object.
- Allows glyph entries to be added, accessed and deleted from the glyph array
- from different processes.
-
+ * Template for offset implementation of pointer to pointer
@internalComponent
*/
-class RArrayGlyphEntries : public RArray<TInt>
- {
+template<class T>
+class ROffsetArray
+ {
public:
- inline const COpenFontGlyphTreeEntry& operator[](TInt anIndex) const;
- inline COpenFontGlyphTreeEntry& operator[](TInt anIndex);
- TInt Append(COpenFontGlyphTreeEntry& anEntry);
+ ROffsetArray();
+ TInt Create(RHeap* aHeap, TInt aCount);
+ void Close(RHeap* aHeap);
+ TInt Count() const;
+ T* operator[](TInt aIndex) const;
+ void SetAt(TInt aIndex, T* aEntry);
private:
- inline const COpenFontGlyphTreeEntry* Entry(TInt anIndex) const;
- inline COpenFontGlyphTreeEntry** EntryMemberOffSet() const;
- inline TAny** EntryMember() const;
-private:
- TInt iEntriesOffset;
- };
-#endif // FNTSTORE_SUPPORT_FMM
-
-#ifdef FNTSTORE_SUPPORT_FMM
-/**
- The per-font glyph cache. For now, just the members that used to be directly in
- COpenFont. Now it is a private class it can be elaborated to do character-to-glyph-index
- mapping when that is needed.
+ TInt iOffset;
+ TInt iCount;
+ };
- @internalComponent
- */
-class COpenFontGlyphCache
- {
-public:
- COpenFontGlyphCache(): iGlyphTreeOffset(0), iGlyphCacheMemory(0), iShaperCacheSentinel(NULL), iShapingInfoCacheMemory(0), iNumberOfShaperCacheEntries(0) { }
- TShapeHeader* SearchShaperCache(TInt aSessionHandle, TFontShapeFunctionParameters*& aParams);
- TShapeHeader* Insert(TInt aSessionHandle, RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader, TInt& aAddedBytes);
- TInt DeleteLeastRecentlyUsedEntry(RHeap* aHeap);
- TBool ShaperCacheIsEmpty();
-
-public:
- TInt iGlyphTreeOffset; // an offset to root of the glyph cache; a binary tree
- TInt iGlyphCacheMemory; // memory used by the glyph tree in bytes
- COpenFontShaperCacheEntry* iShaperCacheSentinel;
- TInt iShapingInfoCacheMemory;
- TInt iNumberOfShaperCacheEntries;
- RArrayGlyphEntries iGlyphArray;
- };
-#else
+
/**
The per-font glyph cache. For now, just the members that used to be directly in
COpenFont. Now it is a private class it can be elaborated to do character-to-glyph-index
@@ -208,71 +130,48 @@
class COpenFontGlyphCache
{
public:
- COpenFontGlyphCache(): iGlyphTree(NULL), iGlyphCacheMemory(0), iGlyphList(NULL), iShaperCacheSentinel(NULL), iShapingInfoCacheMemory(0), iNumberOfShaperCacheEntries(0) { }
+ COpenFontGlyphCache(): iGlyphTreeOffset(0), iGlyphCacheMemory(0),iGlyphList(NULL),iShaperCacheSentinel(NULL), iShapingInfoCacheMemory(0), iNumberOfShaperCacheEntries(0) { }
TShapeHeader* SearchShaperCache(TInt aSessionHandle, TFontShapeFunctionParameters*& aParams);
TShapeHeader* Insert(TInt aSessionHandle, RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader, TInt& aAddedBytes);
TInt DeleteLeastRecentlyUsedEntry(RHeap* aHeap);
TBool ShaperCacheIsEmpty();
public:
- COpenFontGlyphTreeEntry* iGlyphTree; // the root of the glyph cache; a binary tree
+ TInt iGlyphTreeOffset; // an offset to root of the glyph cache; a binary tree
TInt iGlyphCacheMemory; // memory used by the glyph tree in bytes
- COpenFontGlyphTreeEntry* iGlyphList; // the glyphs, organized as a list
+ COpenFontGlyphTreeEntry* iGlyphList; // the glyphs, organized as a list
COpenFontShaperCacheEntry* iShaperCacheSentinel;
TInt iShapingInfoCacheMemory;
- TInt iNumberOfShaperCacheEntries;
+ TInt iNumberOfShaperCacheEntries;
};
-#endif // FNTSTORE_SUPPORT_FMM
/**
@internalComponent
*/
-#ifdef FNTSTORE_SUPPORT_FMM
+
class COpenFontSessionCacheEntry: public COpenFontGlyph
{
public:
static COpenFontSessionCacheEntry* New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,
const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
- inline COpenFont* Font()const;
+ inline const COpenFont* Font()const;
private:
- COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics):
- COpenFontGlyph(aCode, aGlyphIndex, aMetrics)
- , iFontOffset(reinterpret_cast<TInt>(aFont) - reinterpret_cast<TInt>(this))
- { }
+ inline COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics);
~COpenFontSessionCacheEntry();
public:
TInt iLastAccess; // serial number of the last access to the glyph
private:
- const TInt iFontOffset; // offset of the font that contains this glyph, (not owned by this class!)
+ TInt iFontOffset; // offset of the font that contains this glyph, (not owned by this class!)
};
-#else
-class COpenFontSessionCacheEntry: public COpenFontGlyph
- {
-public:
- static COpenFontSessionCacheEntry* New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,
- const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
-
-private:
- COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics):
- COpenFontGlyph(aCode, aGlyphIndex, aMetrics), iFont(aFont) { }
- ~COpenFontSessionCacheEntry();
-public:
- const COpenFont* iFont; // the font that contains this glyph, (not owned by this class!)
- TInt iLastAccess; // serial number of the last access to the glyph
- };
-
-#endif //FNTSTORE_SUPPORT_FMM
-
/**
A glyph cache for a particular session.
Because session caches are not shared they can shrink as well as grow.
@internalComponent
*/
-#ifdef FNTSTORE_SUPPORT_FMM
class COpenFontSessionCache
{
public:
@@ -282,44 +181,19 @@
TInt SessionHandle() { return iSessionHandle; }
const COpenFontGlyph* Glyph(const COpenFont* aFont, TInt aCode, TInt& aIndex);
void Insert(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry, TInt aIndex);
- inline TInt* Entry()const;
- inline COpenFontSessionCacheEntry* ToCOpenFontSessionCacheEntryPointer(TInt aOffset)const;
private:
- COpenFontSessionCache(TInt aSessionHandle, TInt aEntries);
+ COpenFontSessionCache(TInt aSessionHandle);
~COpenFontSessionCache();
public:
TInt iSessionHandle;
- TInt iEntries;
TInt iLastAccess;
-private:
- TInt iEntryOffset; // Offset of the pointer to an offset array which is of COpenFontSessionCacheEntry*
+ ROffsetArray<COpenFontSessionCacheEntry> iEntryArray;
};
-#else
-class COpenFontSessionCache
- {
-public:
- static COpenFontSessionCache* NewL(RHeap* aHeap, TInt aSessionHandle, TInt aEntries);
- void Delete(RHeap* aHeap);
-
- TInt SessionHandle() { return iSessionHandle; }
- const COpenFontGlyph* Glyph(const COpenFont* aFont, TInt aCode, TInt& aIndex);
- void Insert(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry, TInt aIndex);
-private:
- COpenFontSessionCache(TInt aSessionHandle, TInt aEntries);
- ~COpenFontSessionCache();
-public:
- TInt iSessionHandle;
- TInt iEntries;
- TInt iLastAccess;
- COpenFontSessionCacheEntry** iEntry;
- };
-#endif //FNTSTORE_SUPPORT_FMM
/**
@internalComponent
*/
-#ifdef FNTSTORE_SUPPORT_FMM
class COpenFontSessionCacheListItem
{
public:
@@ -336,20 +210,6 @@
TInt iNextOffset;
TInt iCacheOffset;
};
-#else
-class COpenFontSessionCacheListItem
- {
-public:
- COpenFontSessionCacheListItem(COpenFontSessionCache* aCache): iNext(NULL), iCache(aCache) { }
- void Delete(RHeap* aHeap);
-private:
- ~COpenFontSessionCacheListItem();
-public:
- COpenFontSessionCacheListItem* iNext; // the next cache in the list
- COpenFontSessionCache* iCache; // the cache if non-null;
- };
-#endif // FNTSTORE_SUPPORT_FMM
-
class TFontTableGlyphOutlineCacheMemMonitor
{
@@ -571,4 +431,24 @@
};
+// inline functions
+inline COpenFontSessionCacheEntry::COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,const TOpenFontCharMetrics& aMetrics) :
+ COpenFontGlyph(aCode, aGlyphIndex, aMetrics)
+ {
+ iFontOffset = aFont ? reinterpret_cast<TInt>(aFont) - reinterpret_cast<TInt>(this) : 0;
+ }
+
+
+inline const COpenFont* COpenFontSessionCacheEntry::Font() const
+ {
+ if (iFontOffset)
+ {
+ return reinterpret_cast<const COpenFont*> (PtrAdd(this, iFontOffset));
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
#endif // __OPENFONTSPRIVATE_H__
--- a/fontservices/fontstore/src/FNTBODY.CPP Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/FNTBODY.CPP Sat Feb 20 00:37:46 2010 +0200
@@ -217,7 +217,8 @@
: iHeap(aHeap),
iMetricsStartId(KNullStreamId),
iCharacterMetricsStartPtr(0),
- iNumberOfMetrics(0)
+ iNumberOfMetrics(0),
+ iMetricsOnHeap(EFalse)
{}
void TCharacterMetricsTable::InternalizeL(RReadStream& aStream)
@@ -230,8 +231,9 @@
{
aStream.ReadInt32L(); // size
TBitmapFontCharacterMetrics* charactermetricslist = static_cast<TBitmapFontCharacterMetrics*>(iHeap->AllocL(sizeof(TBitmapFontCharacterMetrics) * iNumberOfMetrics));
-
- iCharacterMetricsStartPtr = TInt(charactermetricslist); // Ptr to location on the heap ('cos the file is not in ROM)
+ iMetricsOnHeap = ETrue;
+ // Offset from this to location on the heap ('cos the file is not in ROM)
+ iCharacterMetricsStartPtr = reinterpret_cast<TInt>(charactermetricslist) - reinterpret_cast<TInt>(this);
TBitmapFontCharacterMetrics* pEnd = charactermetricslist + iNumberOfMetrics;
for (TBitmapFontCharacterMetrics* p = charactermetricslist; p < pEnd; p++)
{
@@ -255,22 +257,33 @@
TBitmapFontCharacterMetrics* charactermetricslist = reinterpret_cast<TBitmapFontCharacterMetrics*>(aFileAddress + sizeof(TInt) + iMetricsStartId.Value());
iCharacterMetricsStartPtr = TInt(charactermetricslist); // Ptr to location in a ROM file
iMetricsStartId = KNullStreamId;
+ iMetricsOnHeap = EFalse;
}
void TCharacterMetricsTable::Delete()
{ // This routine is only called if the font file is in RAM, not ROM, and therefore the metrics have been stashed on the heap
- if (iCharacterMetricsStartPtr)
- {
- iHeap->Free(reinterpret_cast<TAny*>(iCharacterMetricsStartPtr));
- iCharacterMetricsStartPtr = 0;
- }
+ if (iMetricsOnHeap && iCharacterMetricsStartPtr)
+ {
+ iHeap->Free(reinterpret_cast<TAny*>(MetricsFromOffset(0)));
+ iCharacterMetricsStartPtr = 0;
+ iMetricsOnHeap = EFalse;
+ }
}
const TBitmapFontCharacterMetrics* TCharacterMetricsTable::Metric(TInt aIndex) const
{
__ASSERT_DEBUG((aIndex >= 0) && (aIndex <= iNumberOfMetrics), Panic(EFntMetricsIndexOutOfBounds));
- // Sometimes the start ptr is to a metrics heap item and sometimes it points into a ROM file
- return reinterpret_cast<const TBitmapFontCharacterMetrics*>(iCharacterMetricsStartPtr + (aIndex * sizeof(TBitmapFontCharacterMetrics)));
+ // Sometimes the start ptr is to a metrics heap item and sometimes it points into a ROM file
+ if (iMetricsOnHeap)
+ {
+ // Start ptr is to metrics heap item
+ return MetricsFromOffset(aIndex);
+ }
+ else
+ {
+ // Start ptr is to a file in ROM
+ return reinterpret_cast<const TBitmapFontCharacterMetrics*> (iCharacterMetricsStartPtr + (aIndex * sizeof(TBitmapFontCharacterMetrics)));
+ }
}
TInt TCharacterMetricsTable::NumberOfMetrics() const
@@ -278,6 +291,12 @@
return iNumberOfMetrics;
}
+TBitmapFontCharacterMetrics* TCharacterMetricsTable::MetricsFromOffset(TInt aIndex) const
+ {
+ __ASSERT_DEBUG(iMetricsOnHeap,Panic(EFntMetricsNotOnHeap));
+ return reinterpret_cast<TBitmapFontCharacterMetrics*>(reinterpret_cast<TInt>(this) + iCharacterMetricsStartPtr+ (aIndex * sizeof(TBitmapFontCharacterMetrics)));
+ }
+
CFontBitmap::CFontBitmap(RHeap* aHeap, CFontStoreFile* aFontStoreFile)
: iHeap(aHeap),
iFontStoreFileOffset(0),
--- a/fontservices/fontstore/src/FNTBODY.H Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/FNTBODY.H Sat Feb 20 00:37:46 2010 +0200
@@ -111,10 +111,16 @@
const TBitmapFontCharacterMetrics* Metric(TInt aIndex) const;
TInt NumberOfMetrics() const;
private:
+ TBitmapFontCharacterMetrics* MetricsFromOffset(TInt aIndex) const;
+private:
RHeap* iHeap;
TStreamId iMetricsStartId;
- TInt iCharacterMetricsStartPtr; // Sometimes this address is on the metrics heap and sometimes in a ROM file
+ // Sometimes this address is on the metrics heap and sometimes in a ROM file
+ // If the address is on the heap, then this is actually an offset from
+ // the address of this class.
+ TInt iCharacterMetricsStartPtr;
TInt iNumberOfMetrics;
+ TBool iMetricsOnHeap;
};
NONSHARABLE_CLASS(CFontBitmap) : public CBase
--- a/fontservices/fontstore/src/FNTSTD.H Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/FNTSTD.H Sat Feb 20 00:37:46 2010 +0200
@@ -41,6 +41,8 @@
EFntNoFontFound,
EFntRemovingAlreadyDeletedLinkedFont,
EFntOverFlow,
+ EFntMetricsNotOnHeap,
+ EFntPointerNotByteAligned,
};
/**
@@ -53,7 +55,6 @@
class COpenFontSessionCacheListItem;
class COpenFont;
-#ifdef FNTSTORE_SUPPORT_FMM
class COpenFontSessionCacheList
/**
@internalComponent
@@ -76,30 +77,6 @@
iStartOffset(0)
{
}
-#else
-class COpenFontSessionCacheList
-/**
-@internalComponent
-*/
- {
- friend class COpenFont;
-
- public:
- inline COpenFontSessionCacheList();
- void Delete(RHeap* aHeap);
- void DeleteCache(RHeap* aHeap,TInt aSessionHandle);
-
- private:
- void DeleteFontGlyphs(RHeap* aHeap,const COpenFont* aFont);
-
- COpenFontSessionCacheListItem* iStart;
- };
-
-inline COpenFontSessionCacheList::COpenFontSessionCacheList():
- iStart(NULL)
- {
- }
-#endif // FNTSTORE_SUPPORT_FMM
/**
@internalComponent
--- a/fontservices/fontstore/src/FNTSTORE.CPP Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/FNTSTORE.CPP Sat Feb 20 00:37:46 2010 +0200
@@ -74,7 +74,7 @@
Array stored in Twips as that is the only form of the value currently used.
@internalComponent
-*/
+*/
#define POINTSIZE_IN_TWIPS(p) ((p) * 20)
const TInt gOpenFontSizeInTwipsArray[] =
{
@@ -538,39 +538,36 @@
COpenFont* aOpenFont):
iFontSpecInTwips(aFontSpecInTwips),
iAlgStyle(aAlgStyle),
- iHeap(aHeap),
- iOpenFont(aOpenFont)
+ iHeap(aHeap)
{
-#ifdef FNTSTORE_SUPPORT_FMM
- iOpenFontOffset=reinterpret_cast<TInt>(aOpenFont)-reinterpret_cast<TInt>(this);
-#endif // FNTSTORE_SUPPORT_FMM
+ // Set iOpenFont to be the offset of aOpenFont from the address of CBitmapFont.
+ // In order to be able to identify iOpenFont as an offset instead of a pointer,
+ // bitwise or the offset with 1. Pointers will always be byte aligned (and therefore even).
+ if (aOpenFont)
+ {
+ iOpenFont = reinterpret_cast<COpenFont*>((reinterpret_cast<TInt>(aOpenFont) - reinterpret_cast<TInt>(this)) | 1);
+ __ASSERT_DEBUG((reinterpret_cast<TInt>(iOpenFont) & 1),Panic(EFntPointerNotByteAligned));
+ }
+ else
+ {
+ iOpenFont = NULL;
+ }
}
/** This member is private and not intended for use. */
void CBitmapFont::ConstructL()
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (!IsOpenFont())
FontBitmap()->UseL();
-#else
- if (!iOpenFont)
- FontBitmap()->UseL();
-#endif // FNTSTORE_SUPPORT_FMM
}
/** This member is private and not intended for use. */
CBitmapFont::~CBitmapFont()
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (!IsOpenFont() && iFontBitmapOffset)
FontBitmap()->Release();
else if (IsOpenFont())
delete OpenFont();
-#else
- if (!iOpenFont)
- FontBitmap()->Release();
- delete iOpenFont;
-#endif // FNTSTORE_SUPPORT_FMM
}
CBitmapFont* CBitmapFont::NewL(
@@ -616,13 +613,8 @@
@return A font identifier. */
TUid CBitmapFont::Uid() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return TUid::Uid(0);
-#else
- if (iOpenFont)
- return TUid::Uid(0);
-#endif // FNTSTORE_SUPPORT_FMM
else
return FontBitmap()->iUid;
}
@@ -635,13 +627,8 @@
*/
EXPORT_C TInt CBitmapFont::DoHeightInPixels() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return Height(OpenFont()->Metrics().Size());
-#else
- if (iOpenFont)
- return Height(iOpenFont->Metrics().Size());
-#endif // FNTSTORE_SUPPORT_FMM
else
return Height(FontBitmap()->iCellHeightInPixels);
}
@@ -658,13 +645,8 @@
*/
EXPORT_C TInt CBitmapFont::DoAscentInPixels() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return Height(OpenFont()->Metrics().Ascent());
-#else
- if (iOpenFont)
- return Height(iOpenFont->Metrics().Ascent());
-#endif // FNTSTORE_SUPPORT_FMM
else
return Height(FontBitmap()->iAscentInPixels);
}
@@ -766,13 +748,8 @@
@return The maximum character width in pixels. */
EXPORT_C TInt CBitmapFont::DoMaxCharWidthInPixels() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return Width(OpenFont()->Metrics().MaxWidth());
-#else
- if (iOpenFont)
- return Width(iOpenFont->Metrics().MaxWidth());
-#endif // FNTSTORE_SUPPORT_FMM
else
return Width(FontBitmap()->iMaxCharWidthInPixels);
}
@@ -786,13 +763,8 @@
@return The normal maximum character width in pixels. */
EXPORT_C TInt CBitmapFont::DoMaxNormalCharWidthInPixels() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return Width(OpenFont()->Metrics().MaxWidth());
-#else
- if (iOpenFont)
- return Width(iOpenFont->Metrics().MaxWidth());
-#endif // FNTSTORE_SUPPORT_FMM
else
return Width(FontBitmap()->iMaxNormalCharWidthInPixels);
}
@@ -827,13 +799,8 @@
the cache; otherwise EFalse. */
EXPORT_C TBool CBitmapFont::Rasterize(TInt aSessionHandle, TInt aCode, TOpenFontGlyphData* aGlyphData) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return OpenFont()->Rasterize(aSessionHandle, aCode, aGlyphData);
-#else
- if (iOpenFont)
- return iOpenFont->Rasterize(aSessionHandle, aCode, aGlyphData);
-#endif // FNTSTORE_SUPPORT_FMM
else
return EFalse;
}
@@ -856,11 +823,7 @@
This function does not work for Open Fonts because the character data need not be
shared between sessions and a session handle is needed; GetCharacterData should be used instead.
*/
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
-#else
- if (iOpenFont)
-#endif // FNTSTORE_SUPPORT_FMM
{
aBytes = NULL;
return TCharacterMetrics();
@@ -908,18 +871,10 @@
EXPORT_C TBool CBitmapFont::GetCharacterData(TInt aSessionHandle,TInt aCode,
TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
-#else
- if (iOpenFont)
-#endif // FNTSTORE_SUPPORT_FMM
{
const TOpenFontCharMetrics* nm;
-#ifdef FNTSTORE_SUPPORT_FMM
if (OpenFont()->GetCharacterData(aSessionHandle,aCode,nm,aBitmap))
-#else
- if (iOpenFont->GetCharacterData(aSessionHandle,aCode,nm,aBitmap))
-#endif // FNTSTORE_SUPPORT_FMM
{
aMetrics = *nm;
return ETrue;
@@ -945,13 +900,8 @@
EXPORT_C void CBitmapFont::GetFontMetrics(TOpenFontMetrics& aMetrics) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
aMetrics = OpenFont()->Metrics();
-#else
- if (iOpenFont)
- aMetrics = iOpenFont->Metrics();
-#endif // FNTSTORE_SUPPORT_FMM
else
{
new(&aMetrics) TOpenFontMetrics;
@@ -975,17 +925,9 @@
attributes. */
EXPORT_C TBool CBitmapFont::GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
-#else
- if (iOpenFont)
-#endif // FNTSTORE_SUPPORT_FMM
{
-#ifdef FNTSTORE_SUPPORT_FMM
const TOpenFontFaceAttrib* a = OpenFont()->FaceAttrib();
-#else
- const TOpenFontFaceAttrib* a = iOpenFont->FaceAttrib();
-#endif // FNTSTORE_SUPPORT_FMM
if (a)
{
aAttrib = *a;
@@ -1000,13 +942,8 @@
@return Bitmap encoding value. */
EXPORT_C TInt CBitmapFont::BitmapEncoding() const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return 0;
-#else
- if (iOpenFont)
- return 0;
-#endif // FNTSTORE_SUPPORT_FMM
else
return FontBitmap()->iBitmapEncoding;
}
@@ -1017,13 +954,8 @@
@return ETrue if the font has the specified character; otherwise EFalse. */
EXPORT_C TBool CBitmapFont::HasCharacterL(TInt aCode) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return OpenFont()->HasCharacterL(aCode);
-#else
- if (iOpenFont)
- return iOpenFont->HasCharacterL(aCode);
-#endif // FNTSTORE_SUPPORT_FMM
else
{
const TUint8* bytes;
@@ -1043,13 +975,8 @@
@return ETrue if the character needs to be rasterized; otherwise EFalse. */
EXPORT_C TBool CBitmapFont::CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
return OpenFont()->CharacterNeedsToBeRasterized(aSessionHandle,aCode);
-#else
- if (iOpenFont)
- return iOpenFont->CharacterNeedsToBeRasterized(aSessionHandle,aCode);
-#endif // FNTSTORE_SUPPORT_FMM
else
return FALSE; // characters in bitmap fonts do not need to be rasterized
}
@@ -1177,17 +1104,11 @@
CFontBitmap* CBitmapFont::FontBitmap() const
/** This member is private and not intended for use. */
{
-#ifdef FNTSTORE_SUPPORT_FMM
- __ASSERT_ALWAYS(!IsOpenFont(),Panic(EFntTypefaceHasNoFontBitmaps));
- if(iFontBitmapOffset)
- return reinterpret_cast<CFontBitmap*>(reinterpret_cast<TInt>(this)+iFontBitmapOffset);
- else
- return NULL;
-#else
- __ASSERT_ALWAYS(!iOpenFont,Panic(EFntTypefaceHasNoFontBitmaps));
- TInt fontbitmap=TInt(this)+iFontBitmapOffset;
- return((CFontBitmap*)fontbitmap);
-#endif // FNTSTORE_SUPPORT_FMM
+ __ASSERT_ALWAYS(!IsOpenFont(),Panic(EFntTypefaceHasNoFontBitmaps));
+ if(iFontBitmapOffset)
+ return reinterpret_cast<CFontBitmap*>(reinterpret_cast<TInt>(this)+iFontBitmapOffset);
+ else
+ return NULL;
}
/** Gets a font table.
@@ -1198,18 +1119,12 @@
@return KErrNone on success, specific error code on failure.
@internalTechnology
*/
-EXPORT_C
-TInt CBitmapFont::GetFontTable(TUint32 aTag, TAny *&aTableContent,
+EXPORT_C TInt CBitmapFont::GetFontTable(TUint32 aTag, TAny *&aTableContent,
TInt &aLength, TInt aSessionHandle)
{
COpenFont *fontPtr = NULL;
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
fontPtr = OpenFont();
-#else
- if (iOpenFont)
- fontPtr = iOpenFont;
-#endif // FNTSTORE_SUPPORT_FMM
else
return KErrNotSupported;
@@ -1252,13 +1167,8 @@
TInt aSessionHandle)
{
COpenFont *fontPtr = NULL;
-#ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
fontPtr = OpenFont();
-#else
- if (iOpenFont)
- fontPtr = iOpenFont;
-#endif // FNTSTORE_SUPPORT_FMM
else
return;
@@ -1284,13 +1194,8 @@
TBool aHinted, TInt aSessionHandle)
{
COpenFont *fontPtr = NULL;
- #ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
fontPtr = OpenFont();
- #else
- if (iOpenFont)
- fontPtr = iOpenFont;
- #endif // FNTSTORE_SUPPORT_FMM
else
return;
@@ -1328,13 +1233,8 @@
TBool aHinted, TAny *&aOutline, TInt &aLength, TInt aSessionHandle)
{
COpenFont *fontPtr = NULL;
- #ifdef FNTSTORE_SUPPORT_FMM
if (IsOpenFont())
fontPtr = OpenFont();
- #else
- if (iOpenFont)
- fontPtr = iOpenFont;
- #endif // FNTSTORE_SUPPORT_FMM
else
return KErrNotSupported;
--- a/fontservices/fontstore/src/OPENFONT.CPP Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/OPENFONT.CPP Sat Feb 20 00:37:46 2010 +0200
@@ -31,53 +31,58 @@
const TInt KDefaultSlantFactor = 20480;
const TInt KOneIn16Dot16FixedPointFormat = 65536;
-#ifdef FNTSTORE_SUPPORT_FMM
-class TPointerArrayBaseOffset
- {
-public:
- TInt iCount;
- TAny** iEntries;
- TInt iAllocated;
- TInt iGranularity;
- };
+template<class T>
+ROffsetArray<T>::ROffsetArray()
+ : iOffset(0), iCount(0)
+ {}
-/*RArrayGlyphEntries*/
-
-inline const COpenFontGlyphTreeEntry& RArrayGlyphEntries::operator[](TInt anIndex) const
- {
- return *Entry(anIndex);
- }
-
-inline COpenFontGlyphTreeEntry& RArrayGlyphEntries::operator[](TInt anIndex)
- {
- return *const_cast<COpenFontGlyphTreeEntry*>(Entry(anIndex));
- }
+template<class T>
+TInt ROffsetArray<T>::Create(RHeap* aHeap, TInt aCount)
+ {
+ if (iOffset != 0)
+ {
+ return KErrAlreadyExists;
+ }
+ TAny* p = aHeap->AllocZ(aCount * sizeof(TInt));
+ if (p == NULL)
+ {
+ return KErrNoMemory;
+ }
+ iOffset = (TInt)p - (TInt)this;
+ iCount = aCount;
+ return KErrNone;
+ }
-inline const COpenFontGlyphTreeEntry* RArrayGlyphEntries::Entry(TInt anIndex) const
- {
- return reinterpret_cast<const COpenFontGlyphTreeEntry*>(PtrAdd(EntryMemberOffSet()[anIndex],reinterpret_cast<TInt>(this)));
- }
-
-inline COpenFontGlyphTreeEntry** RArrayGlyphEntries::EntryMemberOffSet() const
- {
- return reinterpret_cast<COpenFontGlyphTreeEntry**>(iEntriesOffset+reinterpret_cast<TInt>(this));
- }
+template<class T>
+void ROffsetArray<T>::Close(RHeap* aHeap)
+ {
+ if (iOffset != 0)
+ {
+ aHeap->Free(PtrAdd(this, iOffset));
+ }
+ iOffset = 0;
+ iCount = 0;
+ }
-inline TAny** RArrayGlyphEntries::EntryMember() const
- {
- return reinterpret_cast<const TPointerArrayBaseOffset*>(this)->iEntries;
- }
+template<class T>
+TInt ROffsetArray<T>::Count() const
+ {
+ return iCount;
+ }
-TInt RArrayGlyphEntries::Append(COpenFontGlyphTreeEntry& anEntry)
- {
- TInt err = RArray<TInt>::Append(reinterpret_cast<TInt>(&anEntry)-reinterpret_cast<TInt>(this));
- if (err == KErrNone)
- {
- iEntriesOffset=reinterpret_cast<TInt>(EntryMember())-reinterpret_cast<TInt>(this);
- }
- return err;
- }
-#endif // FNTSTORE_SUPPORT_FMM
+template<class T>
+T* ROffsetArray<T>::operator[](TInt aIndex) const
+ {
+ TInt e = ((TInt*)PtrAdd(this, iOffset))[aIndex];
+ return e != 0 ? (T*)PtrAdd(this, e) : NULL;
+ }
+
+template<class T>
+void ROffsetArray<T>::SetAt(TInt aIndex, T* aEntry)
+ {
+ ((TInt*)PtrAdd(this, iOffset))[aIndex] = aEntry ? (TInt)aEntry - (TInt)this : 0;
+ }
+
/*COpenFontGlyphCache*/
@@ -149,7 +154,7 @@
COpenFontShaperCacheEntry* new_entry;
new_entry = COpenFontShaperCacheEntry::New(aHeap, aInput, aShapeHeader);
- if (new_entry)
+ if (new_entry != NULL)
{
// increase the reference count for this
TInt ret=new_entry->IncRefCount(aSessionHandle);
@@ -221,20 +226,12 @@
TInt COpenFont::DecrementCachedRefCount(TInt aSessionHandle, TShapeHeader* aShapeHeader, TBool aResetAll)
{
-#ifdef FNTSTORE_SUPPORT_FMM
COpenFontShaperCacheEntry* ptr=NULL;
COpenFontGlyphCache* glyphCache=GetGlyphCache();
- if (glyphCache)
+ if (glyphCache != NULL)
ptr=glyphCache->iShaperCacheSentinel;
- if (!ptr)
+ if (ptr == NULL)
return KErrNone;
-#else
- if (!iGlyphCache || !(iGlyphCache->iShaperCacheSentinel))
- return KErrNone;
-
- COpenFontShaperCacheEntry* ptr=iGlyphCache->iShaperCacheSentinel;
- COpenFontGlyphCache* glyphCache=iGlyphCache;
-#endif // FNTSTORE_SUPPORT_FMM
TInt ret = KErrNotFound;
CFontStore* thisFontStore = File()->GetFontStore();
@@ -243,7 +240,7 @@
TInt deletedBytes = 0;
// loop through the cache entry to decrement the ref count for a particular session
- while (ptr->iNext)
+ while (ptr->iNext != NULL)
{
if (aResetAll)
{
@@ -264,7 +261,7 @@
ret=KErrNone;
}
- else if (ptr->iShapeHeader && ptr->iShapeHeader==aShapeHeader)
+ else if (ptr->iShapeHeader != NULL && ptr->iShapeHeader==aShapeHeader)
{
// Always update the memory usage of the cache as decreasing the ref count
// releases memory
@@ -335,23 +332,22 @@
j++;
}
i++;
- }
- }
-
- // If deleted bytes are still less than the required one delete from this font
-#ifdef FNTSTORE_SUPPORT_FMM
- COpenFontGlyphCache* glyphCache = GetGlyphCache();
-#else
- COpenFontGlyphCache* glyphCache = iGlyphCache;
-#endif // FNTSTORE_SUPPORT_FMM
- while (totalDeletedBytes < aBytesNeeded && !glyphCache->ShaperCacheIsEmpty())
- {
- tempDeletedBytes = glyphCache->DeleteLeastRecentlyUsedEntry(iHeap);
- if ( tempDeletedBytes == 0)
- break;
- totalDeletedBytes += tempDeletedBytes;
- }
- }
+ }
+ }
+
+ // If deleted bytes are still less than the required one delete from this font
+ COpenFontGlyphCache* glyphCache = GetGlyphCache();
+ if (glyphCache != NULL)
+ {
+ while (totalDeletedBytes < aBytesNeeded && !glyphCache->ShaperCacheIsEmpty())
+ {
+ tempDeletedBytes = glyphCache->DeleteLeastRecentlyUsedEntry(iHeap);
+ if (tempDeletedBytes == 0)
+ break;
+ totalDeletedBytes += tempDeletedBytes;
+ }
+ } //if(glyphCache)
+ } //if(aBytesNeeded <= KMaxShaperSesssionCacheMemory)
// Update the global CFontStore cache memory count
if (totalDeletedBytes > 0)
@@ -376,45 +372,47 @@
input.iReserved1 = 0;
CFontStore* thisFontStore = File()->GetFontStore();
+
+ // Create the glyph cache if it doesn't already exist.
+ // This call can only come from FBSERV
+ COpenFontGlyphCache* glyphCache = GetGlyphCache();
+ if (glyphCache == NULL)
+ {
+ glyphCache = (COpenFontGlyphCache*) iHeap->Alloc(sizeof(COpenFontGlyphCache));
+ if (glyphCache == NULL) // no memory
+ {
+ return NULL;
+ }
+ new (glyphCache) COpenFontGlyphCache;
+ SetGlyphCache(glyphCache);
+ }
+ // If there is no sentinel present, i.e. new cache
+ if (glyphCache->iShaperCacheSentinel == NULL)
+ {
+ // Create a sentinel
+ glyphCache->iShaperCacheSentinel = COpenFontShaperCacheEntry::New(iHeap);
+ if (glyphCache->iShaperCacheSentinel == NULL)
+ {
+ // no memory
+ return NULL;
+ }
+ glyphCache->iShaperCacheSentinel->iNext = glyphCache->iShaperCacheSentinel;
+ glyphCache->iShaperCacheSentinel->iPrevious = glyphCache->iShaperCacheSentinel;
+ glyphCache->iNumberOfShaperCacheEntries = 1;
+ }
- // Create the glyph cache if it doesnt already exist.
- // This call can only come from FBSERV
- if (iGlyphCache == NULL)
- {
- iGlyphCache = (COpenFontGlyphCache*)iHeap->Alloc(sizeof(COpenFontGlyphCache));
- if (iGlyphCache == NULL) // no memory
- {
- return NULL;
- }
- new(iGlyphCache) COpenFontGlyphCache;
- }
- // If there is no sentinel present, i.e. new cache
- if (iGlyphCache->iShaperCacheSentinel == NULL)
- {
- // Create a sentinel
- iGlyphCache->iShaperCacheSentinel = COpenFontShaperCacheEntry::New(iHeap);
- if (!iGlyphCache->iShaperCacheSentinel)
- {
- // no memory
- return NULL;
- }
- iGlyphCache->iShaperCacheSentinel->iNext = iGlyphCache->iShaperCacheSentinel;
- iGlyphCache->iShaperCacheSentinel->iPrevious = iGlyphCache->iShaperCacheSentinel;
- iGlyphCache->iNumberOfShaperCacheEntries = 1;
- }
-
- // Before inserting into this cache, check if it was empty.
- // If empty, then increment the global cache count signifying one more cache is active
- if (iGlyphCache->ShaperCacheIsEmpty())
- {
- thisFontStore->IncNumShaperCaches();
- }
+ // Before inserting into this cache, check if it was empty.
+ // If empty, then increment the global cache count signifying one more cache is active
+ if (glyphCache->ShaperCacheIsEmpty())
+ {
+ thisFontStore->IncNumShaperCaches();
+ }
TInt addedBytes = 0;
TShapeHeader* cached_header = NULL;
// Insert a new entry and return the newly inserted TShapeHeader entry
- cached_header = iGlyphCache->Insert(aSessionHandle, iHeap, input, aShapeHeader, addedBytes);
+ cached_header = glyphCache->Insert(aSessionHandle, iHeap, input, aShapeHeader, addedBytes);
if (cached_header == NULL)
return NULL;
@@ -432,7 +430,8 @@
TShapeHeader* COpenFont::GetShapedData(TInt aSessionHandle, TFontShapeFunctionParameters* aParams)
{
- if (iGlyphCache == NULL)
+ COpenFontGlyphCache* glyphCache = GetGlyphCache();
+ if (glyphCache == NULL)
return NULL;
TShapeHeader* cachedHeader = NULL;
@@ -442,12 +441,7 @@
TInt allocBefInc = 0;
TInt allocAfterInc = 0;
iHeap->AllocSize(allocBefInc);
-
-#ifdef FNTSTORE_SUPPORT_FMM
- COpenFontGlyphCache* glyphCache = GetGlyphCache();
-#else
- COpenFontGlyphCache* glyphCache = iGlyphCache;
-#endif // FNTSTORE_SUPPORT_FMM
+
cachedHeader = glyphCache->SearchShaperCache(aSessionHandle,aParams);
iHeap->AllocSize(allocAfterInc);
@@ -482,29 +476,15 @@
e.g. when creating a COpenFont the COpenFontFile derived object would pass
it this.
*/
-#ifdef FNTSTORE_SUPPORT_FMM
EXPORT_C COpenFont::COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
COpenFontFile* aFile):
iHeap(aHeap),
iShaper(NULL),
- iFile(aFile),
- iFaceIndex(0),
- iSessionCacheList(aSessionCacheList)
+ iFaceIndex(0)
{
- iStartingThis=reinterpret_cast<TInt>(this);
+ SetFile(aFile);
+ SetSessionCacheList(aSessionCacheList);
}
-#else
-EXPORT_C COpenFont::COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList, COpenFontFile* aFile)
- : iHeap(aHeap),
- iShaper(NULL),
- iFile(aFile),
- iFaceIndex(0),
- iSessionCacheList(aSessionCacheList),
- iReserved(NULL)
- {
-
- }
-#endif // FNTSTORE_SUPPORT_FMM
/**
C++ constructor taking shared heap, session cache list, font file and face
@@ -521,28 +501,14 @@
it this.
@param aFaceIndex The index of the typeface within the font file aFile.
*/
-#ifdef FNTSTORE_SUPPORT_FMM
EXPORT_C COpenFont::COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList, COpenFontFile* aFile,TInt aFaceIndex) :
iHeap(aHeap),
iShaper(NULL),
- iFile(aFile),
- iFaceIndex(aFaceIndex),
- iSessionCacheList(aSessionCacheList)
+ iFaceIndex(aFaceIndex)
{
- iStartingThis=reinterpret_cast<TInt>(this);
+ SetFile(aFile);
+ SetSessionCacheList(aSessionCacheList);
}
-#else
-EXPORT_C COpenFont::COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList, COpenFontFile* aFile,TInt aFaceIndex)
- : iHeap(aHeap),
- iShaper(NULL),
- iFile(aFile),
- iFaceIndex(aFaceIndex),
- iSessionCacheList(aSessionCacheList),
- iReserved(NULL)
- {
-
- }
-#endif // FNTSTORE_SUPPORT_FMM
/**
Destructor
@@ -557,52 +523,48 @@
File()->GetFontStore()->CleanupCacheOnOpenFontRemoval(this);
- if (iGlyphCache)
+ COpenFontGlyphCache* glyphCache = GetGlyphCache();
+ if (glyphCache != NULL)
{
COpenFontGlyphTreeEntry* next = NULL;
-#ifdef FNTSTORE_SUPPORT_FMM
- TInt ii;
- RArrayGlyphEntries& glyphArray=iGlyphCache->iGlyphArray;
- for (ii=glyphArray.Count()-1;ii>=0;--ii)
- {
- next=&glyphArray[ii];
- COpenFontGlyph::Delete(iHeap,next);
- }
- iGlyphCache->iGlyphArray.Close();
-#else
- for (COpenFontGlyphTreeEntry* g = iGlyphCache->iGlyphList; g; g = next)
+ for (COpenFontGlyphTreeEntry* g = glyphCache->iGlyphList; g != NULL; g = next)
{
next = g->iNext;
COpenFontGlyph::Delete(iHeap, g);
}
-#endif // FNTSTORE_SUPPORT_FMM
// Delete the shaper cache as well
- if (iGlyphCache->iShaperCacheSentinel)
+ if (glyphCache->iShaperCacheSentinel)
{
COpenFontShaperCacheEntry* previous = NULL;
- COpenFontShaperCacheEntry* si = iGlyphCache->iShaperCacheSentinel->iPrevious;
+ COpenFontShaperCacheEntry* si = glyphCache->iShaperCacheSentinel->iPrevious;
TInt heapBefore = 0;
TInt heapAfter = 0;
iHeap->AllocSize(heapBefore);
- while (iGlyphCache->iNumberOfShaperCacheEntries > 0)
+ while (glyphCache->iNumberOfShaperCacheEntries > 0)
{
previous = si->iPrevious;
COpenFontShaperCacheEntry::Delete(iHeap, si);
si = previous;
- iGlyphCache->iNumberOfShaperCacheEntries--;
+ glyphCache->iNumberOfShaperCacheEntries--;
}
iHeap->AllocSize(heapAfter);
File()->GetFontStore()->SetShaperCacheMemUsage(File()->GetFontStore()->GetShaperCacheMemUsage() - (heapBefore - heapAfter));
File()->GetFontStore()->DecNumShaperCaches();
}
- iHeap->Free(iGlyphCache);
+ iHeap->Free(glyphCache);
}
- if (iSessionCacheList)
- iSessionCacheList->DeleteFontGlyphs(iHeap, this);
- if (iFile)
- iFile->RemoveFontFromList(this);
+ COpenFontSessionCacheList* sessionCacheList = SessionCacheList();
+ if (sessionCacheList != NULL)
+ {
+ sessionCacheList->DeleteFontGlyphs(iHeap, this);
+ }
+ COpenFontFile* file = File();
+ if (file != NULL)
+ {
+ file->RemoveFontFromList(this);
+ }
}
COpenFontGlyph::~COpenFontGlyph()
@@ -611,20 +573,16 @@
void COpenFontGlyph::Delete(RHeap* aHeap, COpenFontGlyph* aGlyph)
{
- if (aGlyph)
+ if (aGlyph != NULL)
{
-#ifdef FNTSTORE_SUPPORT_FMM
aHeap->Free(aGlyph->Bitmap());
-#else
- aHeap->Free(aGlyph->iBitmap);
-#endif // FNTSTORE_SUPPORT_FMM
aHeap->Free(aGlyph);
}
}
EXPORT_C void COpenFont::operator delete(TAny *aFont)
{
- if(aFont)
+ if(aFont != NULL)
{
COpenFont* f = (COpenFont*)aFont;
if (f->iHeap)
@@ -647,20 +605,21 @@
ETrue if aGlyphData contains valid data (that is, if aGlyphData->Bitmap()
and aGlyphData->Metrics() are valid), EFalse otherwise.
*/
-#ifdef FNTSTORE_SUPPORT_FMM
TBool COpenFont::Rasterize(TInt aSessionHandle, TInt aCode,
TOpenFontGlyphData* aGlyphData)
{
// create the cache if it doesn't exisit. As this call can only come from
// FBSERV if the chunk has to be resized then no panic will happen.
- if (iGlyphCache == NULL)
+ COpenFontGlyphCache* glyphCache = GetGlyphCache();
+ if (glyphCache == NULL)
{
- iGlyphCache = (COpenFontGlyphCache*)iHeap->Alloc(sizeof(COpenFontGlyphCache));
- if (iGlyphCache == NULL) // no memory
+ glyphCache = (COpenFontGlyphCache*)iHeap->Alloc(sizeof(COpenFontGlyphCache));
+ if (glyphCache == NULL) // no memory
{
return EFalse;
}
- new(iGlyphCache) COpenFontGlyphCache;
+ new(glyphCache) COpenFontGlyphCache;
+ SetGlyphCache(glyphCache);
}
// Look in the Font Cache
@@ -670,15 +629,15 @@
// If it is not found there look in the session cache.
COpenFontSessionCache* cache = NULL;
TInt index = 0;
- if (!g)
+ if (g == NULL)
{
g = SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, EFalse);
}
// If it has already been rasterized return it.
- if (g)
+ if (g != NULL)
{
- if (aGlyphData)
+ if (aGlyphData != NULL)
{
aGlyphData->SetMetricsPointer(&g->iMetrics);
aGlyphData->SetBitmapPointer(g->Bitmap());
@@ -703,43 +662,36 @@
// If the maximum per-font cache memory will not be exceeded, put the glyph into the font cache.
TInt bytes = sizeof(COpenFontGlyphTreeEntry) + cur_glyph_data->BytesNeeded();
- if(iGlyphCache && bytes + iGlyphCache->iGlyphCacheMemory <= KMaxGlyphCacheMemory)
+ if(glyphCache != NULL && bytes + glyphCache->iGlyphCacheMemory <= KMaxGlyphCacheMemory)
{
COpenFontGlyphTreeEntry* new_entry = COpenFontGlyphTreeEntry::New(iHeap, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
new_glyph=new_entry;
- if(new_entry)
- {
- // Insert new entry into the delete list
- error = iGlyphCache->iGlyphArray.Append(*new_entry);
- if (error == KErrNone)
- {
- if(!iGlyphCache->iGlyphTreeOffset)
- {
- // First entry in tree
- iGlyphCache->iGlyphTreeOffset = PointerToThisOffset(new_entry);
- }
- else if (nodeInsertPtr)
- {
- // Add the glyph to a leaf node using the nodeInsertPtr that was returned by FontCacheGlyph()
- *nodeInsertPtr = PointerToThisOffset(new_entry);
- }
- else
- {
- // Failed to add the glyph to the glyph tree, remove it from the delete array.
- // (The glyph is deleted below).
- iGlyphCache->iGlyphArray.Remove(iGlyphCache->iGlyphArray.Count()-1);
- error = KErrGeneral;
- }
- }
- if (error != KErrNone)
- {
- COpenFontGlyph::Delete(iHeap,new_entry);
- }
- else
- {
- iGlyphCache->iGlyphCacheMemory += bytes;
- }
- }
+ if (new_entry != NULL)
+ {
+ // Add the glyph to a leaf node using the nodeInsertPtr that was returned by FontCacheGlyph()
+ // This is the first node if the glyph cache is empty. This updates the cache atomically.
+ *nodeInsertPtr = PointerToThisOffset(new_entry);
+
+ // If new_entry is not the first in the cache, set the previous
+ // entry to link to this so that a linked-list of entries can be
+ // maintained to simplify deletion.
+ COpenFontGlyphTreeEntry* tree = static_cast<COpenFontGlyphTreeEntry*> (ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
+ if (new_entry != tree)
+ {
+ while (tree->iNext != NULL)
+ {
+ tree = tree->iNext;
+ }
+ tree->iNext = new_entry;
+ }
+ else
+ {
+ // First entry in tree, initialise iGlyphList
+ glyphCache->iGlyphList = new_entry;
+ }
+
+ glyphCache->iGlyphCacheMemory += bytes;
+ }//if (new_entry)
}
else
{
@@ -750,11 +702,11 @@
if (error != KErrNone)
{
// If the session cache is not yet known find it or create one.
- if (!cache)
+ if (cache == NULL)
{
SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, TRUE);
}
- if (!cache)
+ if (cache == NULL)
{
return EFalse;
}
@@ -762,21 +714,21 @@
COpenFontSessionCacheEntry* new_entry =
COpenFontSessionCacheEntry::New(iHeap, this, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
new_glyph = new_entry;
- if (new_entry)
+ if (new_entry != NULL)
{
cache->Insert(iHeap, new_entry, index);
}
}
- if (temp_glyph_data)
+ if (temp_glyph_data != NULL)
{
iHeap->Free(temp_glyph_data);
}
// Fix up the returned glyph data pointers to point to the actual data.
- if (!new_glyph)
- glyph_data_valid = FALSE;
- else if (aGlyphData)
+ if (new_glyph == NULL)
+ glyph_data_valid = EFalse;
+ else if (aGlyphData != NULL)
{
aGlyphData->SetMetricsPointer(&new_glyph->iMetrics);
aGlyphData->SetBitmapPointer(new_glyph->Bitmap());
@@ -784,120 +736,6 @@
return glyph_data_valid;
}
-#else
-TBool COpenFont::Rasterize(TInt aSessionHandle, TInt aCode,
- TOpenFontGlyphData* aGlyphData)
- {
- // First look in the font cache.
- COpenFontGlyphTreeEntry** node_ptr = NULL;
- // create the cache if it doesn't exisit. As this call can only come from
- // FBSERV if the chunk has to be resized then no panic will happen.
- if (iGlyphCache == NULL)
- {
- iGlyphCache = (COpenFontGlyphCache*)iHeap->Alloc(sizeof(COpenFontGlyphCache));
- if (iGlyphCache == NULL) // no memory
- {
- return FALSE;
- }
- new(iGlyphCache) COpenFontGlyphCache;
- }
-
- // Look in the fontcache. Do not expect to find a glyph here. However,
- // it is called again so that a node pointer is found where the new glyph
- // will be placed when added to the font cache.
- const COpenFontGlyph* glyph = FontCacheGlyph(aCode, node_ptr);
- if (glyph)
- {
- // Do not expect it to get here, since the font cache has already been searched client-side,
- // prior to calling Rasterize(). However, just in case it does find a match, use it.
- if (aGlyphData)
- {
- aGlyphData->SetMetricsPointer(&glyph->iMetrics);
- aGlyphData->SetBitmapPointer(glyph->iBitmap);
- }
- return TRUE;
- }
-
- // Rasterize the glyph.
- TOpenFontGlyphData* temp_glyph_data = NULL;
- TInt error = KErrNone;
- TRAP(error, RasterizeHelperL(aCode, aGlyphData, temp_glyph_data));
- if (error)
- {
- iHeap->Free(temp_glyph_data);
- return FALSE;
- }
-
- TBool glyph_data_valid = TRUE;
- const TOpenFontGlyphData* cur_glyph_data = temp_glyph_data ? temp_glyph_data : aGlyphData;
- const COpenFontGlyph* new_glyph = NULL;
-
- // If the maximum per-font cache memory will not be exceeded, put the glyph into the font cache.
- TInt bytes = sizeof(COpenFontGlyphTreeEntry) + cur_glyph_data->BytesNeeded();
- if (iGlyphCache && node_ptr && bytes + iGlyphCache->iGlyphCacheMemory <= KMaxGlyphCacheMemory)
- {
- COpenFontGlyphTreeEntry* new_entry = COpenFontGlyphTreeEntry::New(iHeap, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
- new_glyph = new_entry;
- if (new_entry)
- {
- *node_ptr = new_entry; // update the cache atomically
-
- // Insert new entry into the delete list
-
- COpenFontGlyphTreeEntry* start = iGlyphCache->iGlyphTree;
- COpenFontGlyphTreeEntry* tree = start;
-
- if (new_entry != iGlyphCache->iGlyphTree)
- {
- while (tree->iNext)
- {
- tree = tree->iNext;
- }
- tree->iNext = new_entry;
- }
- else
- {
- // First entry in tree, initialise iGlyphList
- iGlyphCache->iGlyphList = new_entry;
- }
-
- iGlyphCache->iGlyphCacheMemory += bytes;
- }
- }
-
- // Otherwise put the glyph into the per-session cache.
- else
- {
- // If the session cache is not yet known find it or create one.
- COpenFontSessionCache* cache = NULL;
- TInt index = 0;
- SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, TRUE);
- if (!cache)
- return FALSE;
- COpenFontSessionCacheEntry* new_entry =
- COpenFontSessionCacheEntry::New(iHeap, this, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
- new_glyph = new_entry;
- if (new_entry)
- cache->Insert(iHeap, new_entry, index);
- }
-
- if (temp_glyph_data)
- {
- iHeap->Free(temp_glyph_data);
- }
-
- // Fix up the returned glyph data pointers to point to the actual data.
- if (!new_glyph)
- glyph_data_valid = FALSE;
- else if (aGlyphData)
- {
- aGlyphData->SetMetricsPointer(&new_glyph->iMetrics);
- aGlyphData->SetBitmapPointer(new_glyph->iBitmap);
- }
-
- return glyph_data_valid;
- }
-#endif // FNTSTORE_SUPPORT_FMM
void COpenFont::RasterizeHelperL(TInt aCode, TOpenFontGlyphData* aGlyphData, TOpenFontGlyphData*& aTempGlyphData)
{
@@ -915,14 +753,14 @@
ExtendedInterface(KUidOpenFontShapingExtension, ext);
extensionInterface = reinterpret_cast<MOpenFontShapingExtension*>(ext);
- if (!extensionInterface)
+ if (extensionInterface == NULL)
// an attempt to rasterize a glyph when the rasterizer does not
// support it; best to do nothing
return;
}
TOpenFontGlyphData* currGlyphData = aGlyphData;
- if (!currGlyphData)
+ if (currGlyphData == NULL)
{
aTempGlyphData = TOpenFontGlyphData::New(iHeap, 0);
if (!aTempGlyphData)
@@ -930,7 +768,7 @@
currGlyphData = aTempGlyphData;
}
- if (extensionInterface)
+ if (extensionInterface != NULL)
extensionInterface->RasterizeGlyphL(aCode, currGlyphData);
else
RasterizeL(aCode, currGlyphData);
@@ -943,13 +781,13 @@
if (aTempGlyphData)
iHeap->Free(aTempGlyphData);
aTempGlyphData = TOpenFontGlyphData::New(iHeap, bytesNeeded);
- if (!aTempGlyphData)
+ if (aTempGlyphData == NULL)
User::Leave(KErrNoMemory);
currGlyphData = aTempGlyphData;
// If the extension interface was used above, then use again here
- if (extensionInterface)
+ if (extensionInterface != NULL)
extensionInterface->RasterizeGlyphL(aCode, currGlyphData);
else
RasterizeL(aCode, currGlyphData);
@@ -993,7 +831,7 @@
reinterpret_cast<MOpenFontTrueTypeExtension*>(ext);
TInt ret = KErrNone;
- if (!extensionInterface)
+ if (extensionInterface == NULL)
{
ret = KErrNotSupported;
}
@@ -1020,7 +858,7 @@
reinterpret_cast<MOpenFontGlyphOutlineExtension*>(ext);
TInt ret = KErrNone;
- if (!extensionInterface)
+ if (extensionInterface == NULL)
{
ret = KErrNotSupported;
}
@@ -1031,7 +869,7 @@
}
return ret;
}
-#ifdef FNTSTORE_SUPPORT_FMM
+
/** Given the passed pointer aAny, return an offset from it to the "this" pointer
of this COpenFont object.
@param aAny A pointer to an object that exists on the shared heap, i.e. the same heap
@@ -1043,7 +881,7 @@
*/
TInt COpenFont::PointerToThisOffset(const TAny* aAny)
{
- if (aAny)
+ if (aAny != NULL)
{
return ((TInt)aAny - (TInt)this);
}
@@ -1065,7 +903,6 @@
}
return NULL;
}
-#endif // FNTSTORE_SUPPORT_FMM
/**
A constructor initialised with a TCharacterMetrics object.
@@ -1101,27 +938,23 @@
aMetrics.iLeftAdjustInPixels = iHorizBearingX;
aMetrics.iMoveInPixels = iHorizAdvance;
aMetrics.iRightAdjustInPixels = (TInt16)(iHorizAdvance - iHorizBearingX - iWidth);
- return TRUE;
+ return ETrue;
}
TBool COpenFont::GetCharacterData(TInt aSessionHandle, TInt aCode, const TOpenFontCharMetrics*& aMetrics, const TUint8*& aBitmap) const
{
const COpenFontGlyph* g = Glyph(aSessionHandle, aCode);
- if (g)
+ if (g != NULL)
{
aMetrics = &g->iMetrics;
-#ifdef FNTSTORE_SUPPORT_FMM
aBitmap = g->Bitmap();
-#else
- aBitmap = g->iBitmap;
-#endif // FNTSTORE_SUPPORT_FMM
- return TRUE;
+ return ETrue;
}
else
{
aMetrics = NULL;
aBitmap = NULL;
- return FALSE;
+ return EFalse;
}
}
@@ -1129,44 +962,29 @@
void COpenFont::OnFileDeleted()
{
- iFile = NULL;
+ iFileOffset = 0;
}
COpenFontGlyphCache* COpenFont::GetGlyphCache()
{
-#ifdef FNTSTORE_SUPPORT_FMM
- if (iGlyphCache)
- return reinterpret_cast<COpenFontGlyphCache*>(reinterpret_cast<TInt>(iGlyphCache)+Offset());
-#else
- if (iGlyphCache)
- return iGlyphCache;
-#endif // FNTSTORE_SUPPORT_FMM
- else
- return NULL;
+ if (iGlyphCacheOffset == 0)
+ {
+ return NULL;
+ }
+ return reinterpret_cast<COpenFontGlyphCache*>(PtrAdd(this, iGlyphCacheOffset));
}
const COpenFontGlyph* COpenFont::Glyph(TInt aSessionHandle, TInt aCode) const
{
-#ifdef FNTSTORE_SUPPORT_FMM
const COpenFontGlyph* glyph = const_cast<COpenFont*>(this)->FontCacheGlyph(aCode);
- if (!glyph)
+ if (glyph == NULL)
{
COpenFontSessionCache* cache;
TInt index;
- glyph = SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, FALSE);
+ glyph = SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, EFalse);
}
return glyph;
-#else
- const COpenFontGlyph* g = CONST_CAST(COpenFont*,this)->FontCacheGlyph(aCode);
- if (!g)
- {
- COpenFontSessionCache* cache;
- TInt index;
- g = SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, FALSE);
- }
- return g;
-#endif // FNTSTORE_SUPPORT_FMM
}
/**
@@ -1175,13 +993,12 @@
TBool COpenFont::HasCharacterL(TInt aCode) const
{
COpenFontFile* file = File();
- if (file)
+ if (file != NULL)
return file->HasUnicodeCharacterL(iFaceIndex, aCode);
else
- return FALSE;
+ return EFalse;
}
-#ifdef FNTSTORE_SUPPORT_FMM
/**
Retrieve glyph data from the per-font glyph cache.
If it is not found return NULL.
@@ -1203,7 +1020,7 @@
node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
}
- while (node)
+ while (node != NULL)
{
TInt code = node->iCode;
if(code == aCode)
@@ -1245,13 +1062,17 @@
if (COpenFontGlyphCache* glyphCache = GetGlyphCache())
{
- COpenFontGlyphTreeEntry* node = NULL;
- if (glyphCache->iGlyphTreeOffset)
- {
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
- }
-
- while (node)
+ COpenFontGlyphTreeEntry* node = NULL;
+ if (glyphCache->iGlyphTreeOffset)
+ {
+ node = static_cast<COpenFontGlyphTreeEntry*> (ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
+ }
+ else
+ {
+ aNodeInsertPtr = &glyphCache->iGlyphTreeOffset;
+ }
+
+ while (node != NULL)
{
TInt code = node->iCode;
if(code == aCode)
@@ -1275,67 +1096,6 @@
// No glyph found
return NULL;
}
-#else
-/**
-Retrieve glyph data from the per-font glyph cache.
-If it is not found return NULL.
-If the cache hasn't been created, then return null.
-Previous versions of this function created the cache, but as this function can potentially
-run in the context of threads other than FBSERV the alloc could panic if iHeap's chunk had to
-be resized - this is not allowed by the kernel.
-The cache is now created in COpenFont::Rasterize which can only be called within the context of FBSERV
-*/
-const COpenFontGlyph* COpenFont::FontCacheGlyph(TInt aCode)
- {
- if (iGlyphCache)
- {
- COpenFontGlyphTreeEntry* node = iGlyphCache->iGlyphTree;
- while (node)
- {
- if (node->iCode == aCode)
- return node;
- if (node->iCode > aCode)
- node = node->iLeft;
- else
- node = node->iRight;
- }
- }
-
- return NULL;
- }
-
-/**
-Retrieve glyph data from the per-font glyph cache.
-If it is not found return NULL and place the address of the node pointer
-to receive a new glyph in aNode.
-If the cache hasn't been created, then return null.
-Previous versions of this function created the cache, but as this function can potentially
-run in the context of threads other than FBSERV the alloc could panic if iHeap's chunk had to
-be resized - this is not allowed by the kernel.
-The cache is now created in COpenFont::Rasterize which can only be called within the context of FBSERV
-*/
-const COpenFontGlyph* COpenFont::FontCacheGlyph(TInt aCode, COpenFontGlyphTreeEntry**& aNode)
- {
- if (!iGlyphCache)
- {
- aNode = NULL;
- return NULL;
- }
-
- aNode = &iGlyphCache->iGlyphTree;
- while (*aNode)
- {
- if ((*aNode)->iCode == aCode)
- return *aNode;
- if ((*aNode)->iCode > aCode)
- aNode = &((*aNode)->iLeft);
- else
- aNode = &((*aNode)->iRight);
- }
-
- return NULL;
- }
-#endif // FNTSTORE_SUPPORT_FMM
/** Retrieve glyph data from the session cache. If the glyph is not in the
cache, return the cache and glyph index where the glyph data should be put. If
@@ -1359,7 +1119,6 @@
@return The glyph data, or null if the glyph is not in the cache
@internalComponent
*/
-#ifdef FNTSTORE_SUPPORT_FMM
const COpenFontGlyph* COpenFont::SessionCacheGlyph(RHeap* aHeap,
TInt aSessionHandle, TInt aCode, COpenFontSessionCache*& aCache,
TInt& aIndex, TBool aCreate) const
@@ -1376,7 +1135,7 @@
}
sem.Wait();
COpenFontSessionCacheListItem* cacheListStart=cachelist->Start();
- if(cacheListStart)
+ if(cacheListStart != NULL)
{
for (COpenFontSessionCacheListItem* p = cacheListStart; p; p = p->Next())
{
@@ -1399,10 +1158,10 @@
COpenFontSessionCache* new_cache = NULL;
TRAPD(error, new_cache = COpenFontSessionCache::NewL(aHeap, aSessionHandle, KSessionCacheEntries));
- if ((!error) && new_cache)
+ if ((!error) && new_cache != NULL)
{
COpenFontSessionCacheListItem* new_item = (COpenFontSessionCacheListItem*)aHeap->Alloc(sizeof(COpenFontSessionCacheListItem));
- if (!new_item)
+ if (new_item == NULL)
{
new_cache->Delete(aHeap);
aHeap->Free(new_cache);
@@ -1411,7 +1170,7 @@
new(new_item) COpenFontSessionCacheListItem(new_cache);
- if (prev)
+ if (prev != NULL)
{
prev->SetNext(new_item);
}
@@ -1426,64 +1185,31 @@
}
return NULL;
}
-#else
-const COpenFontGlyph* COpenFont::SessionCacheGlyph(RHeap* aHeap,
- TInt aSessionHandle, TInt aCode, COpenFontSessionCache*& aCache,
- TInt& aIndex, TBool aCreate) const
- {
- aCache = NULL;
- aIndex = 0;
- COpenFontSessionCacheListItem* prev = NULL;
- RSemaphore sem;
- if(KErrNone != sem.OpenGlobal(KSessionCacheSemaphoreName))
+
+COpenFontSessionCacheList* COpenFont::SessionCacheList()const
+ {
+ if (iSessionCacheListOffset == 0)
{
- RDebug::Print(_L("COpenFont::SessionCacheGlyphe() can't open SessionCacheSemaphore"));
return NULL;
}
- sem.Wait();
- for (COpenFontSessionCacheListItem* p = iSessionCacheList->iStart; p; p = p->iNext)
- {
- if (p->iCache->iSessionHandle == aSessionHandle)
- {
- aCache = p->iCache;
- sem.Signal();
- sem.Close();
- return aCache->Glyph(this, aCode, aIndex);
- }
- prev = p;
- }
- sem.Signal();
- sem.Close();
-
- if (aCreate)
- {
- COpenFontSessionCache* new_cache = NULL;
- TRAPD(error, new_cache = COpenFontSessionCache::NewL(aHeap, aSessionHandle, KSessionCacheEntries));
-
- if ((!error) && new_cache)
- {
- COpenFontSessionCacheListItem* new_item = (COpenFontSessionCacheListItem*)aHeap->Alloc(sizeof(COpenFontSessionCacheListItem));
- if (!new_item)
- {
- new_cache->Delete(aHeap);
- aHeap->Free(new_cache);
- return NULL;
- }
+ return reinterpret_cast<COpenFontSessionCacheList*>(reinterpret_cast<TInt>(this) + iSessionCacheListOffset);
+ }
+
+void COpenFont::SetSessionCacheList(COpenFontSessionCacheList* aSessionCacheList)
+ {
+ iSessionCacheListOffset = aSessionCacheList ? reinterpret_cast<TInt>(aSessionCacheList) - reinterpret_cast<TInt>(this) : NULL;
+ }
- new(new_item) COpenFontSessionCacheListItem(new_cache);
-
- if (prev)
- prev->iNext = new_item;
- else
- iSessionCacheList->iStart = new_item;
+void COpenFont::SetFile(COpenFontFile* aFile)
+ {
+ iFileOffset = aFile ? reinterpret_cast<TInt>(aFile) - reinterpret_cast<TInt>(this) : NULL;
+ }
- aCache = new_cache;
- aIndex = GLYPH_CODE(aCode) % KSessionCacheEntries;
- }
- }
- return NULL;
- }
-#endif // FNTSTORE_SUPPORT_FMM
+void COpenFont::SetGlyphCache(COpenFontGlyphCache* aGlyphCache)
+ {
+ iGlyphCacheOffset = aGlyphCache ? reinterpret_cast<TInt>(aGlyphCache) - reinterpret_cast<TInt>(this) : NULL;
+ }
+
/**
Create a glyph data object on the shared heap, given the code, metrics and the data bytes.
@@ -1504,7 +1230,7 @@
COpenFontGlyphTreeEntry* COpenFontGlyphTreeEntry::New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
{
COpenFontGlyphTreeEntry* entry = (COpenFontGlyphTreeEntry*)aHeap->Alloc(sizeof(COpenFontGlyphTreeEntry));
- if (!entry)
+ if (entry == NULL)
return NULL;
new(entry) COpenFontGlyphTreeEntry(aCode, aGlyphIndex, aMetrics);
if (!entry->SetBitmap(aHeap, aBitmap))
@@ -1518,7 +1244,7 @@
COpenFontSessionCacheEntry* COpenFontSessionCacheEntry::New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
{
COpenFontSessionCacheEntry* entry = (COpenFontSessionCacheEntry*)aHeap->Alloc(sizeof(COpenFontSessionCacheEntry));
- if (!entry)
+ if (entry == NULL)
return NULL;
new(entry) COpenFontSessionCacheEntry(aFont, aCode, aGlyphIndex, aMetrics);
if (!entry->SetBitmap(aHeap, aBitmap))
@@ -1529,18 +1255,6 @@
return entry;
}
-#ifdef FNTSTORE_SUPPORT_FMM
-
-inline COpenFont* COpenFontSessionCacheEntry::Font()const
-{
-if(iFontOffset)
- {
- return reinterpret_cast<COpenFont*>(reinterpret_cast<TInt>(this) + iFontOffset);
- }
-else
- return NULL;
-}
-
/**
@return A pointer to the run-length-encoded bitmap stored with this glyph, or NULL
if no bitmap has been stored with this glyph.
@@ -1549,213 +1263,122 @@
{
if (iBitmapOffset)
{
- return (TUint8*)((TInt)this + iBitmapOffset);
+ return reinterpret_cast<TUint8*>(reinterpret_cast<TInt>(this) + iBitmapOffset);
}
return NULL;
}
-#endif // FNTSTORE_SUPPORT_FMM
TBool COpenFontGlyph::SetBitmap(RHeap* aHeap, const TDesC8& aBitmap)
{
TUint8* bitmap = (TUint8*)aHeap->Alloc(aBitmap.Length());
- if (!bitmap)
- return FALSE;
+ if (bitmap == NULL)
+ return EFalse;
Mem::Copy(bitmap, aBitmap.Ptr(), aBitmap.Length());
-#ifdef FNTSTORE_SUPPORT_FMM
aHeap->Free(Bitmap());
- iBitmapOffset = (TInt)bitmap - (TInt)this;
-#else
- if (iBitmap)
- aHeap->Free(iBitmap);
- iBitmap = bitmap;
-#endif // FNTSTORE_SUPPORT_FMM
- return TRUE;
+ iBitmapOffset = reinterpret_cast<TInt>(bitmap) - reinterpret_cast<TInt>(this);
+ return ETrue;
}
-#ifdef FNTSTORE_SUPPORT_FMM
+
COpenFontSessionCache* COpenFontSessionCache::NewL(RHeap* aHeap, TInt aSessionHandle, TInt aEntries)
{
- COpenFontSessionCache* c = reinterpret_cast<COpenFontSessionCache*>(aHeap->AllocL(sizeof(COpenFontSessionCache)));
- new(c) COpenFontSessionCache(aSessionHandle,aEntries);
- TInt bytes = sizeof(TInt) * aEntries;
- TInt* entry= reinterpret_cast<TInt*>(aHeap->Alloc(bytes));
- Mem::FillZ(entry, bytes);
- if (!entry)
- {
- aHeap->Free(c);
- User::Leave(KErrNoMemory);
- }
- c->iEntryOffset = reinterpret_cast<TInt>(entry) - reinterpret_cast<TInt>(c);
- return c;
- }
-#else
-COpenFontSessionCache* COpenFontSessionCache::NewL(RHeap* aHeap, TInt aSessionHandle, TInt aEntries)
- {
COpenFontSessionCache* c = (COpenFontSessionCache*)aHeap->AllocL(sizeof(COpenFontSessionCache));
- new(c) COpenFontSessionCache(aSessionHandle,aEntries);
- TInt bytes = sizeof(COpenFontSessionCacheEntry*) * aEntries;
- c->iEntry = (COpenFontSessionCacheEntry**)aHeap->Alloc(bytes);
- Mem::FillZ(c->iEntry, bytes);
- if (!c->iEntry)
+ new(c) COpenFontSessionCache(aSessionHandle);
+ if (c->iEntryArray.Create(aHeap, aEntries) != KErrNone)
{
aHeap->Free(c);
User::Leave(KErrNoMemory);
}
return c;
- }
-#endif //FNTSTORE_SUPPORT_FMM
+ }
-#ifdef FNTSTORE_SUPPORT_FMM
+
void COpenFontSessionCache::Delete(RHeap* aHeap)
{
- TInt* e =Entry();
- if(e)
+ TInt entries = iEntryArray.Count();
+ for (TInt i = 0; i < entries; ++i)
{
- for (TInt i = 0; i < iEntries; i++, e++)
+ COpenFontSessionCacheEntry* e = iEntryArray[i];
+ if (e != NULL)
{
- if (ToCOpenFontSessionCacheEntryPointer(*e))
- {
- COpenFont* font=const_cast<COpenFont*>((ToCOpenFontSessionCacheEntryPointer(*e))->Font());
- if (font)
- font->DecrementCachedRefCount(iSessionHandle, NULL, ETrue);
- aHeap->Free((ToCOpenFontSessionCacheEntryPointer(*e))->Bitmap());
- aHeap->Free(ToCOpenFontSessionCacheEntryPointer(*e));
- }
+ COpenFont* font=const_cast<COpenFont*>(e->Font());
+ if (font != NULL)
+ font->DecrementCachedRefCount(iSessionHandle,NULL,ETrue);
+ aHeap->Free(e->Bitmap());
+ aHeap->Free(e);
}
- aHeap->Free(Entry());
- iEntryOffset = 0;
}
+ iEntryArray.Close(aHeap);
}
-#else
-void COpenFontSessionCache::Delete(RHeap* aHeap)
- {
- COpenFontSessionCacheEntry** e =iEntry;
- for (TInt i = 0; i < iEntries; i++, e++)
- {
- if (*e)
- {
- COpenFont* font=const_cast<COpenFont*>((*e)->iFont);
- if (font)
- font->DecrementCachedRefCount(iSessionHandle, NULL, ETrue);
- aHeap->Free((*e)->iBitmap);
- aHeap->Free(*e);
- }
- }
- aHeap->Free(iEntry);
- }
-#endif //FNTSTORE_SUPPORT_FMM
const COpenFontGlyph* COpenFontSessionCache::Glyph(const COpenFont* aFont, TInt aCode, TInt& aIndex)
{
- aIndex = -1;
- TInt oldest = KMaxTInt;
- TInt oldest_index = 0;
- TInt index = GLYPH_CODE(aCode) % iEntries; // simple hash function to shorten searches
- for (TInt i = 0; i < iEntries; i++, index++)
- {
- if (index >= iEntries)
- index = 0;
-#ifdef FNTSTORE_SUPPORT_FMM
- COpenFontSessionCacheEntry* e = ToCOpenFontSessionCacheEntryPointer(Entry()[index]);
-#else
- COpenFontSessionCacheEntry* e = iEntry[index];
-#endif //FNTSTORE_SUPPORT_FMM
- if (!e)
- {
- if (aIndex == -1)
- aIndex = index;
- }
- else
- {
-#ifdef FNTSTORE_SUPPORT_FMM
- if (e->Font() == aFont && e->iCode == aCode)
-#else
- if (e->iFont == aFont && e->iCode == aCode)
-#endif //FNTSTORE_SUPPORT_FMM
- {
- e->iLastAccess = iLastAccess++;
- return e;
- }
- if (e->iLastAccess < oldest)
- {
- oldest = e->iLastAccess;
- oldest_index = index;
- }
- }
- }
- if (aIndex == -1)
- aIndex = oldest_index;
- return NULL;
+ aIndex = -1;
+ TInt oldest = KMaxTInt;
+ TInt oldest_index = 0;
+ TInt entries = iEntryArray.Count();
+ TInt index = GLYPH_CODE(aCode) % entries; // simple hash function to shorten searches
+ for (TInt i = 0; i < entries; ++i, ++index)
+ {
+ if (index >= entries)
+ index = 0;
+ COpenFontSessionCacheEntry* e = iEntryArray[index];
+ if (e == NULL)
+ {
+ if (aIndex == -1)
+ aIndex = index;
+ }
+ else
+ {
+ if (e->Font() == aFont && e->iCode == aCode)
+ {
+ e->iLastAccess = iLastAccess++;
+ return e;
+ }
+ if (e->iLastAccess < oldest)
+ {
+ oldest = e->iLastAccess;
+ oldest_index = index;
+ }
+ }
+ }
+ if (aIndex == -1)
+ aIndex = oldest_index;
+ return NULL;
}
void COpenFontSessionCache::Insert(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry, TInt aIndex)
{
- if ((aIndex < 0) || (aIndex > iEntries))
- Panic(EFntSessionCacheIndexOutOfRange);
-#ifdef FNTSTORE_SUPPORT_FMM
- COpenFontSessionCacheEntry* e = ToCOpenFontSessionCacheEntryPointer(Entry()[aIndex]);
- COpenFontGlyph::Delete(aHeap, e);
- Entry()[aIndex] = reinterpret_cast<TInt>(aEntry) - reinterpret_cast<TInt>(this);
-#else
- COpenFontGlyph::Delete(aHeap, iEntry[aIndex]);
- iEntry[aIndex] = aEntry;
-#endif //FNTSTORE_SUPPORT_FMM
- aEntry->iLastAccess = iLastAccess++;
- }
-
-COpenFontSessionCache::COpenFontSessionCache(TInt aSessionHandle, TInt aEntries)
- : iSessionHandle(aSessionHandle),
- iEntries(aEntries),
- iLastAccess(0),
-#ifdef FNTSTORE_SUPPORT_FMM
- iEntryOffset(0)
-#else
- iEntry(NULL)
-#endif //FNTSTORE_SUPPORT_FMM
- {
+ if (aIndex < 0 || aIndex >= iEntryArray.Count())
+ Panic(EFntSessionCacheIndexOutOfRange);
+ COpenFontGlyph::Delete(aHeap, iEntryArray[aIndex]);
+ iEntryArray.SetAt(aIndex, aEntry);
+ aEntry->iLastAccess = iLastAccess++;
}
-#ifdef FNTSTORE_SUPPORT_FMM
-
-inline TInt* COpenFontSessionCache::Entry() const
- {
- if (iEntryOffset)
- {
- return reinterpret_cast<TInt*>(reinterpret_cast<TInt>(this) + iEntryOffset);
- }
- return NULL;
+COpenFontSessionCache::COpenFontSessionCache(TInt aSessionHandle):
+ iSessionHandle(aSessionHandle),
+ iLastAccess(0)
+ {
}
-inline COpenFontSessionCacheEntry* COpenFontSessionCache::ToCOpenFontSessionCacheEntryPointer(TInt aOffset)const
- {
- if(aOffset)
- {
- return reinterpret_cast<COpenFontSessionCacheEntry*>(reinterpret_cast<TInt>(this) + aOffset);
- }
- return NULL;
- }
-
-#endif // FNTSTORE_SUPPORT_FMM
-
/*COpenFontSessionCacheListItem*/
-#ifdef FNTSTORE_SUPPORT_FMM
COpenFontSessionCacheListItem::COpenFontSessionCacheListItem(COpenFontSessionCache* aCache):
iNextOffset(NULL)
{
- if(aCache)
- {
- iCacheOffset = (TInt)aCache - (TInt)this;
- }
- else
- {
- iCacheOffset = NULL;
- }
+ if(aCache != NULL)
+ {
+ iCacheOffset = reinterpret_cast<TInt>(aCache) - reinterpret_cast<TInt>(this);
+ }
+ else
+ {
+ iCacheOffset = NULL;
+ }
}
COpenFontSessionCacheListItem::~COpenFontSessionCacheListItem()
{
}
-#endif // FNTSTORE_SUPPORT_FMM
/** Delete a COpenFontSessionCacheListItem from the passed heap.
@@ -1763,19 +1386,16 @@
*/
void COpenFontSessionCacheListItem::Delete(RHeap* aHeap)
{
-#ifdef FNTSTORE_SUPPORT_FMM
- Cache()->Delete(aHeap);
- aHeap->Free(Cache());
- iCacheOffset=NULL;
- iNextOffset=NULL;
-#else
- iCache->Delete(aHeap);
- aHeap->Free(iCache);
- iCache=NULL;
-#endif // FNTSTORE_SUPPORT_FMM
+ COpenFontSessionCache* cache = Cache();
+ if (cache != NULL)
+ {
+ cache->Delete(aHeap);
+ aHeap->Free(cache);
+ }
+ iCacheOffset=NULL;
+ iNextOffset=NULL;
}
-#ifdef FNTSTORE_SUPPORT_FMM
/** Get the next item to this cache list item.
@return A pointer to the next item to this one in the session cache, or NULL
@@ -1785,7 +1405,7 @@
{
if(iNextOffset)
{
- COpenFontSessionCacheListItem* next = (COpenFontSessionCacheListItem*)((TInt)this + (TInt)iNextOffset);
+ COpenFontSessionCacheListItem* next = reinterpret_cast<COpenFontSessionCacheListItem*>(reinterpret_cast<TInt>(this) + iNextOffset);
return next;
}
else
@@ -1800,9 +1420,9 @@
*/
void COpenFontSessionCacheListItem::SetNext(COpenFontSessionCacheListItem* aNext)
{
- if(aNext)
+ if(aNext != NULL)
{
- iNextOffset = (TInt)aNext - (TInt)this;
+ iNextOffset = reinterpret_cast<TInt>(aNext) - reinterpret_cast<TInt>(this);
}
else
{
@@ -1818,7 +1438,7 @@
{
if(iCacheOffset)
{
- COpenFontSessionCache* cache = (COpenFontSessionCache*)((TInt)this + (TInt)iCacheOffset);
+ COpenFontSessionCache* cache = reinterpret_cast<COpenFontSessionCache*>(reinterpret_cast<TInt>(this) + iCacheOffset);
return cache;
}
else
@@ -1835,7 +1455,7 @@
{
if(iStartOffset)
{
- COpenFontSessionCacheListItem* start = (COpenFontSessionCacheListItem*)((TInt)this + (TInt)iStartOffset);
+ COpenFontSessionCacheListItem* start = reinterpret_cast<COpenFontSessionCacheListItem*>(reinterpret_cast<TInt>(this) + iStartOffset);
return start;
}
else
@@ -1851,16 +1471,15 @@
*/
void COpenFontSessionCacheList::SetStart(COpenFontSessionCacheListItem* aItem)
{
- if(aItem!=NULL)
+ if(aItem != NULL)
{
- iStartOffset = (TInt)aItem - (TInt)this;
+ iStartOffset = reinterpret_cast<TInt>(aItem) - reinterpret_cast<TInt>(this);
}
else
{
iStartOffset = 0;
}
}
-#endif // FNTSTORE_SUPPORT_FMM
/** Delete all the items in the session cache if the current cache session handle
matches the passed session handle.
@@ -1877,51 +1496,33 @@
RDebug::Print(_L("COpenFontSessionCacheList::DeleteCache() can't open SessionCacheSemaphore"));
return;
}
-#ifdef FNTSTORE_SUPPORT_FMM
- for (COpenFontSessionCacheListItem* curr = Start(); curr; prev = curr, curr = curr->Next())
- {
- if (curr->Cache()->iSessionHandle == aSessionHandle)
- {
- for(TInt i=0; i<KSessionCacheSemaphoreCount; i++)
- {
- //coverity[lock]
- //coverity[double_lock]
- sem.Wait();
- }
- if (curr==Start())
- SetStart(curr->Next());
- else
- prev->SetNext(curr->Next());
-
- curr->Delete(aHeap);
- aHeap->Free(curr);
- sem.Signal(KSessionCacheSemaphoreCount);
- sem.Close();
- return;
- }
- }
-#else
- for (COpenFontSessionCacheListItem* curr = iStart; curr; prev = curr, curr = curr->iNext)
- {
- if (curr->iCache->iSessionHandle == aSessionHandle)
- {
- for(TInt i=0; i<KSessionCacheSemaphoreCount; i++)
- {
- sem.Wait();
- }
- if (curr==iStart)
- iStart = curr->iNext;
- else
- prev->iNext = curr->iNext;
+
+ for (COpenFontSessionCacheListItem* curr = Start(); curr; prev = curr, curr = curr->Next())
+ {
+ COpenFontSessionCache* cache = curr->Cache();
+ if (cache != NULL && cache->iSessionHandle == aSessionHandle)
+ {
+ for (TInt i = 0; i < KSessionCacheSemaphoreCount; i++)
+ {
+ //coverity[lock]
+ //coverity[double_lock]
+ sem.Wait();
+ }
- curr->Delete(aHeap);
- aHeap->Free(curr);
+ if (curr == Start())
+ SetStart(curr->Next());
+ else
+ prev->SetNext(curr->Next());
+
+ curr->Delete(aHeap);
+ aHeap->Free(curr);
+
sem.Signal(KSessionCacheSemaphoreCount);
sem.Close();
- return;
- }
- }
-#endif // FNTSTORE_SUPPORT_FMM
+ return;
+ }
+ }
+ sem.Close();
}
/** Delete all the items in the current session cache.
@@ -1936,11 +1537,7 @@
RDebug::Print(_L("COpenFontSessionCacheList::Delete() can't open SessionCacheSemaphore"));
return;
}
-#ifdef FNTSTORE_SUPPORT_FMM
COpenFontSessionCacheListItem* cur = Start();
-#else
- COpenFontSessionCacheListItem* cur = iStart;
-#endif // FNTSTORE_SUPPORT_FMM
COpenFontSessionCacheListItem* next = NULL;
for(TInt i=0; i<KSessionCacheSemaphoreCount; i++)
@@ -1949,13 +1546,9 @@
//coverity[double_lock]
sem.Wait();
}
- while (cur)
+ while (cur != NULL)
{
-#ifdef FNTSTORE_SUPPORT_FMM
next = cur->Next();
-#else
- next = cur->iNext;
-#endif // FNTSTORE_SUPPORT_FMM
cur->Delete(aHeap);
aHeap->Free(cur);
cur = next;
@@ -1975,39 +1568,24 @@
RDebug::Print(_L("COpenFontSessionCacheList::DeleteFontGlyphs can't global open SessionCacheSemaphore"));
return;
}
- sem.Wait();
-#ifdef FNTSTORE_SUPPORT_FMM
+ sem.Wait();
for (COpenFontSessionCacheListItem* p = Start(); p; p = p->Next())
- {
- COpenFontSessionCache* cache=p->Cache();
- TInt* e = cache->Entry();
- TInt entries = cache->iEntries;
- for (TInt i = 0; i < entries; i++, e++)
- {
- if ((cache->ToCOpenFontSessionCacheEntryPointer(*e))
- && ((cache->ToCOpenFontSessionCacheEntryPointer(*e))->Font() == aFont))
- {
- COpenFontSessionCacheEntry::Delete(aHeap, cache->ToCOpenFontSessionCacheEntryPointer(*e));
- *e = 0;
- }
- }
- }
-#else
- for (COpenFontSessionCacheListItem* p = iStart; p; p = p->iNext)
- {
- COpenFontSessionCacheEntry** e = p->iCache->iEntry;
- TInt entries = p->iCache->iEntries;
- for (TInt i = 0; i < entries; i++, e++)
- {
- if ((*e) && ((*e)->iFont == aFont))
- {
- COpenFontSessionCacheEntry::Delete(aHeap, *e);
- *e = NULL;
- }
- }
- }
-#endif // FNTSTORE_SUPPORT_FMM
-
+ {
+ COpenFontSessionCache* cache = p->Cache();
+ if (cache != NULL)
+ {
+ TInt entries = cache->iEntryArray.Count();
+ for (TInt i = 0; i < entries; ++i)
+ {
+ COpenFontSessionCacheEntry* e = cache->iEntryArray[i];
+ if (e != NULL && e->Font() == aFont)
+ {
+ COpenFontSessionCacheEntry::Delete(aHeap, e);
+ cache->iEntryArray.SetAt(i, NULL);
+ }
+ }
+ } //if(cache != NULL)
+ }
sem.Signal();
sem.Close();
}
@@ -2121,7 +1699,7 @@
EXPORT_C COpenFontFile::~COpenFontFile()
{
CFontStore *fs = GetFontStore();
- if (fs)
+ if (fs != NULL)
{
fs->CleanupCacheOnOpenFontFileRemoval(this);
}
@@ -2540,7 +2118,7 @@
void COpenFontFile::SetFontStoreL(CFontStore* aFontStore)
{
- if (!iData)
+ if (iData == NULL)
{
iData = new (ELeave) TOpenFontFileData;
}
@@ -2864,7 +2442,7 @@
aBufferSize = 1;
TInt bytes = sizeof(TOpenFontGlyphData) + aBufferSize - 1;
TOpenFontGlyphData* g = (TOpenFontGlyphData*)aHeap->Alloc(bytes);
- if (g)
+ if (g != NULL)
{
Mem::FillZ(g, bytes);
g->iBitmapBufferSize = aBufferSize;
--- a/fontservices/fontstore/src/linkedfontsprivate.h Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/src/linkedfontsprivate.h Sat Feb 20 00:37:46 2010 +0200
@@ -63,11 +63,8 @@
TInt iSession; //Not owned
TInt iUsageCounter; //
-#ifdef FNTSTORE_SUPPORT_FMM
+
const COpenFontGlyph* GlyphLinked(TInt aCode,TInt*& aNode);
-#else
- const COpenFontGlyph* GlyphLinked(TInt aCode,COpenFontGlyphTreeEntry**& aNode);
-#endif // FNTSTORE_SUPPORT_FMM
void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData);
};
--- a/fontservices/fontstore/tfs/TFntStoreServer.cpp Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/tfs/TFntStoreServer.cpp Sat Feb 20 00:37:46 2010 +0200
@@ -44,6 +44,7 @@
#include "t_linkedfontscapability.h"
#include "T_LinkedFontUpdateTests.h"
#include "T_CACHE.H"
+#include "T_FontSessionCache.h"
CTFntStoreServer* CTFntStoreServer::NewL()
/**
@@ -122,14 +123,10 @@
Implementation of CTestServer pure virtual
*/
{
- if(aStepName == KTFntStep)
- {
- return new CTFntStep();
- }
- else if(aStepName == KTCacheStep)
- {
- return new CTCacheStep();
- }
+ if (aStepName == KTFntStep)
+ {
+ return new CTFntStep();
+ }
else if(aStepName == KTFntMemStep)
{
return new CTFntMemStep();
@@ -188,24 +185,32 @@
}
else if (aStepName == KTLinkedFontsMemoryStep)
{
- return new CTLinkedFontsMemoryStep();
- }
- else if (aStepName == KTLinkedFontsComparisonStep)
- {
- return new CTLinkedFontsComparisonStep();
- }
- else if (aStepName == KTLinkedFontsCapabilityStep)
- {
- return new CTLinkedFontsCapabilityStep();
- }
- else if (aStepName == KTLinkedFontsUpdateStage1Step)
- {
- return new CTLinkedFontsUpdateStage1Step();
- }
- else if (aStepName == KTLinkedFontsUpdateStage2Step)
- {
- return new CTLinkedFontsUpdateStage2Step();
- }
+ return new CTLinkedFontsMemoryStep();
+ }
+ else if (aStepName == KTLinkedFontsComparisonStep)
+ {
+ return new CTLinkedFontsComparisonStep();
+ }
+ else if (aStepName == KTLinkedFontsCapabilityStep)
+ {
+ return new CTLinkedFontsCapabilityStep();
+ }
+ else if (aStepName == KTLinkedFontsUpdateStage1Step)
+ {
+ return new CTLinkedFontsUpdateStage1Step();
+ }
+ else if (aStepName == KTLinkedFontsUpdateStage2Step)
+ {
+ return new CTLinkedFontsUpdateStage2Step();
+ }
+ else if (aStepName == KTCacheStep)
+ {
+ return new CTCacheStep();
+ }
+ else if (aStepName == KTFontSessionCacheStep)
+ {
+ return new CTFontSessionCacheStep();
+ }
RDebug::Printf("Test Step is either mis-spelt or doesn't exist - see CTFntStoreServer::CreateTestStep");
return NULL;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fontservices/fontstore/tfs/T_fontsessioncache.cpp Sat Feb 20 00:37:46 2010 +0200
@@ -0,0 +1,222 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @test
+ @internalComponent Internal Symbian test code
+*/
+
+#include "FNTSTORE.H"
+#include "OPENFONT.H"
+#include "FNTBODY.H"
+#include "FNTSTD.H"
+#include "t_fontsessioncache.h"
+#include <hal.h>
+#include <s32file.h>
+#include <graphics/shapeimpl.h>
+
+_LIT(KWorkerProcess,"tfontsessioncacheproc");
+
+const TInt KNumOfProc = 4;
+const TInt KRunningTime = 1000 * 1000 * 5;
+
+class CTFontSessionCache : public CTGraphicsBase
+ {
+public:
+ CTFontSessionCache(CTestStep* aStep);
+ ~CTFontSessionCache();
+
+ static void TimerCleanup(TAny *);
+protected:
+// From CTGraphicsStep
+ virtual void RunTestCaseL(TInt aCurTestCase);
+private:
+ void TestOpenFontForQtL();
+ void RunMultiWorkerProcessL();
+ };
+
+// This class is a data mirror to CBitmapFont in order to check its private
+// member iOpenFont. It is only used by TestOpenFontForQtL().
+class CBitmapFontDummy:public CFont
+ {
+public:
+ TFontSpec iFontSpecInTwips;
+ TAlgStyle iAlgStyle;
+ RHeap* iHeap;
+ TInt iFontBitmapOffset;
+ COpenFont* iOpenFont;
+ TUint32 iReserved;
+ TUint32 iUniqueFontId;
+ };
+
+class CFbsFontUtil:public CFbsFont
+ {
+public:
+ static CBitmapFontDummy *getBitmapFont(CFbsFont *aFbsfont)
+ {
+ return reinterpret_cast<CBitmapFontDummy*>(static_cast<CFbsFontUtil*>(aFbsfont)->Address());
+ }
+ };
+
+
+CTFontSessionCache::CTFontSessionCache(CTestStep* aStep)
+ : CTGraphicsBase(aStep)
+ {
+
+ }
+
+CTFontSessionCache::~CTFontSessionCache()
+ {
+ // no action needed
+ }
+
+void CTFontSessionCache::TimerCleanup(TAny *aTimer)
+ {
+ ((RTimer*)aTimer)->Cancel();
+ }
+
+/**
+Qt needs the last bit of iOpenFont to be set 1 as a workaround to maintain
+its compatibility across difference Symbian OS versions.
+*/
+void CTFontSessionCache::TestOpenFontForQtL()
+ {
+ _LIT(KTypefaceName, "DejaVu Sans Condensed");
+ TFontSpec spec(KTypefaceName, 15);
+ CFbsTypefaceStore *tfs = CFbsTypefaceStore::NewL(NULL);
+
+ CFont* font = NULL;
+ TInt ret = tfs->GetNearestFontToDesignHeightInPixels(font,spec);
+ TEST(ret == KErrNone);
+
+ CFbsFont *fbs_font = static_cast<CFbsFont*>(font);
+ TEST(reinterpret_cast<TInt>((CFbsFontUtil::getBitmapFont(fbs_font))->iOpenFont) & 1);
+
+ tfs->ReleaseFont(font);
+ delete tfs;
+ }
+
+/*
+ * Launch 4 worker processes running with random latency at beginning.
+ * Each one lasts about 1 sec. Within duration of 5 sec, if one terminates,
+ * re-launch it.
+ *
+ */
+void CTFontSessionCache::RunMultiWorkerProcessL()
+ {
+ RProcess ProcArray[KNumOfProc];
+ TRequestStatus *completeStatus[KNumOfProc];
+
+ for (TInt i = 0; i < KNumOfProc; i++)
+ {
+ RDebug::Print(_L(">>> Launching %d..."),i);
+ TInt err;
+ err = ProcArray[i].Create(KWorkerProcess, KNullDesC);
+ User::LeaveIfError(err);
+
+ completeStatus[i] = new(ELeave) TRequestStatus;
+ CleanupStack::PushL(completeStatus[i]);
+ *completeStatus[i] = KRequestPending;
+
+ ProcArray[i].Logon(*completeStatus[i]);
+ ProcArray[i].Resume(); //start the process
+ }
+
+ RTimer timer;
+ timer.CreateLocal();
+ TRequestStatus timerStatus = KRequestPending;
+ TTimeIntervalMicroSeconds32 timeout(KRunningTime);
+ timer.After(timerStatus, timeout);
+
+ do
+ {
+ User::WaitForNRequest(completeStatus, KNumOfProc);
+ TInt i = 0;
+ for(;i < KNumOfProc;i++ )
+ {
+ if (*completeStatus[i] != KRequestPending)
+ {
+ break;
+ }
+ }
+
+ TExitType exit = ProcArray[i].ExitType();
+ TEST(exit == EExitKill);
+ TInt reason = ProcArray[i].ExitReason();
+ TEST (reason == 0);
+
+ RDebug::Print(_L("<<< Close %d..."), i);
+ ProcArray[i].Close();
+
+ RDebug::Print(_L(">>> Launching %d..."), i);
+ TInt err;
+ err = ProcArray[i].Create(KWorkerProcess, KNullDesC);
+ User::LeaveIfError(err);
+
+ //run process 1
+ *completeStatus[i] = KRequestPending;
+ ProcArray[i].Logon(*completeStatus[i]);
+ ProcArray[i].Resume(); //start the process
+ }
+ while (timerStatus == KRequestPending);
+
+ for (TInt i = 0; i < KNumOfProc; i++)
+ {
+ if(*completeStatus[i] == KRequestPending)
+ {
+ User::WaitForRequest(*completeStatus[i]);
+ }
+ RDebug::Print(_L("<<< Tear down Close %d..."),i);
+ ProcArray[i].Close(); //tear down
+ }
+ CleanupStack::PopAndDestroy(4);
+ }
+
+
+void CTFontSessionCache::RunTestCaseL( TInt aCurTestCase )
+ {
+#if defined __WINS__ || defined __WINSCW__
+ aCurTestCase = aCurTestCase; //to avoid unused warning
+ // TestComplete(); //only run test on hardware, always passes on winscw
+ // return;
+#endif
+ ((CTFontSessionCacheStep*) iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
+
+ switch (aCurTestCase)
+ {
+ case 1:
+ ((CTFontSessionCacheStep*) iStep)->SetTestStepID(_L("TI18N-FNTSTORE-UT--4003"));
+ INFO_PRINTF1(_L("Test CBitmapFont::iOpenFont last bit for Qt\n"));
+ TestOpenFontForQtL();
+ break;
+
+ case 2:
+ ((CTFontSessionCacheStep*) iStep)->SetTestStepID(_L("TI18N-FNTSTORE-CIT-4002"));
+ INFO_PRINTF1(_L("Test GetCharacterData() in muti-process client\n"));
+ RunMultiWorkerProcessL();
+ break;
+
+ case 3:
+ ((CTFontSessionCacheStep*) iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
+ ((CTFontSessionCacheStep*) iStep)->CloseTMSGraphicsStep();
+ TestComplete();
+ break;
+ }
+ ((CTFontSessionCacheStep*)iStep)->RecordTestResultL();
+ }
+
+// --------------
+__CONSTRUCT_STEP__(FontSessionCache)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fontservices/fontstore/tfs/T_fontsessioncache.h Sat Feb 20 00:37:46 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef T_FONTSESSIONCACHE_H_
+#define T_FONTSESSIONCACHE_H_
+
+#include "TGraphicsHarness.h"
+
+class CTFontSessionCacheStep : public CTGraphicsStep
+ {
+public:
+ CTFontSessionCacheStep();
+protected:
+ //from CTGraphicsStep
+ virtual CTGraphicsBase* CreateTestL();
+ };
+
+_LIT(KTFontSessionCacheStep,"TFontSessionCache");
+
+
+#endif /* T_FONTSESSIONCACHE_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fontservices/fontstore/tfs/T_fontsessioncacheproc.cpp Sat Feb 20 00:37:46 2010 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code
+*/
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32test.h>
+#include <e32std.h>
+#include <e32debug.h>
+#include "FNTSTORE.H"
+#include "FNTBODY.H"
+#include "FNTSTD.H"
+#include <fbs.h>
+#include <bitstd.h>
+#include <bitdev.h>
+#include <e32math.h>
+
+_LIT(KOpenFont, "DejaVu Sans Condensed");
+
+#ifdef __WINSCW__
+//this is used for winscw breakpoints
+#define BR _asm( int 3);
+#endif
+
+const TInt KTimeOut = 1000 * 1000;
+//make sure that the font is large enough to ensure that the session
+//cache is used.
+const TInt KTextHight = 220;
+
+/* it is expected that the main in this file will be called to test multiple
+process output at the same time a process is being deleted (font and bitmap server
+disconnection. There are normally two instances of this process. Two virtually
+identical processes are required to ensure that the session ID is the same.
+
+The first is with aThirdProcess set. This sets output to run in a loop until
+the timeout is completed. These values are input via program arguments.
+
+If aThirdProcess is false then only one font creation, draw text,
+font deletion cycle is completed. The test code will then repeatedly run
+this process with aThirdProcess set to false.
+*/
+
+
+class TRunProc: public CBase
+ {
+public:
+ static TRunProc* NewL();
+ void RunTestL();
+ ~TRunProc();
+private:
+ TRunProc(){};
+ void ConstructL();
+ void DrawText();
+ void CreateFontL();
+
+private:
+ RFbsSession* iFbs;
+ CFbsBitGc* iGc;
+ CFbsScreenDevice* iDev;
+ CFbsFont *iFbsFont;
+ };
+
+TRunProc::~TRunProc()
+ {
+ delete iGc;
+ delete iDev;
+ iFbs->Disconnect();
+ }
+
+void TRunProc::ConstructL()
+ {
+ TInt err = RFbsSession::Connect();
+ User::LeaveIfError(err);
+ iFbs = RFbsSession::GetSession();
+ User::LeaveIfNull(iFbs);
+
+ const TInt KDisplayMode = 3;
+ TDisplayMode mode[KDisplayMode];
+ mode[0] = EColor16MA;
+ mode[1] = EColor16MU;
+ mode[2] = EColor64K;
+
+ TInt count;
+ for (count = 0; count < KDisplayMode; count++)
+ {
+ TRAP(err, iDev = CFbsScreenDevice::NewL(KNullDesC, mode[count]));
+ if (err != KErrNotSupported)
+ {
+ break;
+ }
+ }
+
+ User::LeaveIfNull(iDev);
+
+ if(err == KErrNone)
+ {
+ iDev->ChangeScreenDevice(NULL);
+ iDev->SetAutoUpdate(ETrue);
+ iDev->CreateContext(iGc);
+ }
+ User::LeaveIfNull(iGc);
+ }
+
+TRunProc* TRunProc::NewL()
+ {
+ TRunProc *ptr = new (ELeave) TRunProc;
+ CleanupStack::PushL(ptr);
+ ptr->ConstructL();
+ CleanupStack::Pop();
+ return ptr;
+ }
+
+void TRunProc::CreateFontL()
+ {
+ TOpenFontSpec openFontSpec;
+ openFontSpec.SetName(KOpenFont);
+ openFontSpec.SetHeight(KTextHight);
+ openFontSpec.SetItalic(EFalse);
+ openFontSpec.SetBold(EFalse);
+
+ TTypeface Typeface;
+ Typeface.iName = KOpenFont;
+ TFontSpec fs;
+ fs.iTypeface = Typeface;
+
+ fs.iHeight = KTextHight;
+ CFbsFont* font = NULL;
+ TInt err = iDev->GetNearestFontToDesignHeightInPixels(font, fs);
+
+ User::LeaveIfNull(font);
+
+ // Use the font
+ iFbsFont = font;
+ iGc->UseFont(font);
+ iGc->Clear();
+ }
+
+void TRunProc::RunTestL()
+ {
+ TTime theTime;
+ theTime.UniversalTime();
+ TInt64 randSeed(theTime.Int64());
+ TInt random(Math::Rand(randSeed) % (1000 * 1000));
+ User::After(random);
+
+ RTimer timer;
+ timer.CreateLocal();
+ TRequestStatus timerStatus = KRequestPending;
+ TTimeIntervalMicroSeconds32 timeout(KTimeOut);
+ timer.After(timerStatus, timeout);
+
+ CreateFontL();
+ RDebug::Print(_L("DrawText()random=%d"), random);
+ DrawText();
+
+ TText ch;
+ const TUint8 *bitmap;
+ TSize bitmapsize;
+ TOpenFontCharMetrics Metrics;
+ do
+ {
+ for (ch = 'A'; ch <= 'Z'; ch++)
+ {
+ iFbsFont->GetCharacterData((TInt) ch, Metrics, bitmap,bitmapsize);
+ }
+ }
+ while (timerStatus == KRequestPending);
+
+ timer.Cancel();
+ iGc->DiscardFont();
+ timer.Close();
+ }
+
+
+void TRunProc::DrawText()
+ {
+ TText ch[2];
+ ch[1] = '\0';
+ for (ch[0] = 'A';ch[0] <= 'Z';ch[0]++)
+ {
+ TBufC<2> buf(ch);
+ iGc->DrawText(buf,TPoint(10,100));
+ }
+ for (ch[0] = 'a';ch[0] <= 'z';ch[0]++)
+ {
+ TBufC<2> buf(ch);
+ iGc->DrawText(buf,TPoint(10,100));
+ }
+ }
+
+
+
+void MainL()
+ {
+ TRunProc* test = TRunProc::NewL();
+ CleanupStack::PushL(test);
+
+ RDebug::Print(_L("T_fontsessioncacheproc MainL()"));
+ test->RunTestL();
+
+ CleanupStack::PopAndDestroy();
+ }
+
+// Cleanup stack harness
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ CTrapCleanup* cleanupStack = CTrapCleanup::New();
+ TRAPD(error, MainL());
+ _LIT(KTCacheDeletionProcess,"T_fontsessioncacheproc");
+ __ASSERT_ALWAYS(!error, User::Panic(KTCacheDeletionProcess, error));
+ delete cleanupStack;
+ __UHEAP_MARKEND;
+ return 0;
+ }
--- a/fontservices/fontstore/tfs/scripts/fntstoretest_T_All.script Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/tfs/scripts/fntstoretest_T_All.script Sat Feb 20 00:37:46 2010 +0200
@@ -33,6 +33,7 @@
RUN_TEST_STEP 100 TFntStoreServer TCorruptFonts
RUN_TEST_STEP 300 TFntStoreServer TShaperCache
RUN_TEST_STEP 300 TFntStoreServer TCacheDeletion
+RUN_TEST_STEP 300 TFntStoreServer TFontSessionCache
RUN_TEST_STEP !PanicCode=-40 !PanicString="FBSERV" 100 TFntStoreServer TSetDefaultTypefaceName
RUN_TEST_STEP 100 TFntStoreServer TLinkedFonts
RUN_TEST_STEP 100 TFntStoreServer TGetNearestFontCapability
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fontservices/fontstore/tfs/scripts/fntstoretest_T_FontSessionCache.script Sat Feb 20 00:37:46 2010 +0200
@@ -0,0 +1,21 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+PRINT Run TFontSessionCache Font Store test
+//
+LOAD_SUITE TFntStoreServer
+RUN_TEST_STEP 300 TFntStoreServer TFontSessionCache
\ No newline at end of file
--- a/fontservices/fontstore/tfs/scripts/fntstoretest_run.bat Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/fontstore/tfs/scripts/fntstoretest_run.bat Sat Feb 20 00:37:46 2010 +0200
@@ -31,6 +31,7 @@
testexecute.exe z:\fntstoretest\fntstoretest_t_setdefaulttypefacename.script
testexecute.exe z:\fntstoretest\fntstoretest_t_linkedfonts.script
testexecute.exe z:\fntstoretest\fntstoretest_t_cache.script
+testexecute.exe z:\fntstoretest\fntstoretest_t_fontsessioncache.script
@echo off
md e:\logs
--- a/fontservices/textshaperplugin/group/IcuLayoutEngine.iby Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/textshaperplugin/group/IcuLayoutEngine.iby Sat Feb 20 00:37:46 2010 +0200
@@ -20,10 +20,7 @@
REM Shaper
-#ifdef WITH_FLEXIBLE_MM
-ECOM_PLUGIN(iculayoutengine_fmm.dll, iculayoutengine_fmm.rsc)
-#else
ECOM_PLUGIN(IcuLayoutEngine.dll, IcuLayoutEngine.RSC)
-#endif
+
#endif
--- a/fontservices/textshaperplugin/group/bld.inf Tue Feb 02 02:02:46 2010 +0200
+++ b/fontservices/textshaperplugin/group/bld.inf Sat Feb 20 00:37:46 2010 +0200
@@ -29,10 +29,6 @@
PRJ_MMPFILES
IcuLayoutEngine.mmp
-#ifndef WINS
- iculayoutengine_fmm.mmp
-#endif
-
PRJ_TESTMMPFILES
TC_SHAP_shapeText.mmp
--- a/fontservices/textshaperplugin/group/iculayoutengine_fmm.mmp Tue Feb 02 02:02:46 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Builds the ICU layoutEngine into a Symbian Shaper DDL.
-* This version defines the FNTSTORE_SUPPORT_FMM macro in order
-* to provide flexible memory model support for fonts.
-* Symbian Shaper dll
-*
-*/
-
-
-/**
- @file
-*/
-
-target iculayoutengine_fmm.dll
-targettype PLUGIN
-
-CAPABILITY All -Tcb
-
-userinclude ../source
-userinclude ../IcuSource/common
-userinclude ../IcuSource/layout
-userinclude ../IcuSource
-userinclude ../include
-OS_LAYER_ESTLIB_SYSTEMINCLUDE
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-uid 0x10009D8D 0x10274DB8
-VENDORID 0x70000001
-
-
-// Switch off some warnings for the following files,
-// which are imported source code that needs to be
-// kept unchanged as far as possible to ease porting
-// of upgrades or fixes.
-// N.B. As a siIcuLayoutEngine.cpp, Shaper.cpp,
-// SymbianFontInstance.cpp and Umemory.cpp (our wrapper code)
-// so it should be re-checked with the warnings back on if changes
-// are made to it.
-OPTION ARMCC -W
-
-// Symbian sources
-sourcepath ../source
-source Umemory.cpp
-source shaper.cpp
-source IcuLayoutEngine.cpp
-source SymbianFontInstance.cpp
-source FontTableCache.cpp
-source cmaps.cpp
-
-// Icu layout sources
-sourcepath ../IcuSource/layout
-source AlternateSubstSubtables.cpp
-source AnchorTables.cpp
-source ArabicLayoutEngine.cpp
-source ArabicShaping.cpp
-source CanonData.cpp
-source CanonShaping.cpp
-source ClassDefinitionTables.cpp
-source ContextualGlyphSubstProc.cpp
-source ContextualSubstSubtables.cpp
-source CoverageTables.cpp
-source CursiveAttachmentSubtables.cpp
-source DeviceTables.cpp
-source ExtensionSubtables.cpp
-source Features.cpp
-source GDEFMarkFilter.cpp
-source GlyphDefinitionTables.cpp
-source GlyphIterator.cpp
-source GlyphLookupTables.cpp
-source GlyphPositionAdjustments.cpp
-source GlyphPositioningTables.cpp
-source GlyphPosnLookupProc.cpp
-source GlyphSubstitutionTables.cpp
-source GlyphSubstLookupProc.cpp
-source GXLayoutEngine.cpp
-source HanLayoutEngine.cpp
-source IndicClassTables.cpp
-source IndicLayoutEngine.cpp
-source IndicRearrangementProcessor.cpp
-source IndicReordering.cpp
-source KernTable.cpp
-source KhmerLayoutEngine.cpp
-source KhmerReordering.cpp
-source LayoutEngine.cpp
-source LEFontInstance.cpp
-source LEGlyphStorage.cpp
-source LEInsertionList.cpp
-source LigatureSubstProc.cpp
-source LigatureSubstSubtables.cpp
-source LookupProcessor.cpp
-source Lookups.cpp
-source LookupTables.cpp
-source MarkArrays.cpp
-source MarkToBasePosnSubtables.cpp
-source MarkToLigaturePosnSubtables.cpp
-source MarkToMarkPosnSubtables.cpp
-source MorphTables.cpp
-source MPreFixups.cpp
-source MultipleSubstSubtables.cpp
-source NonContextualGlyphSubstProc.cpp
-source OpenTypeLayoutEngine.cpp
-source OpenTypeUtilities.cpp
-source PairPositioningSubtables.cpp
-source ScriptAndLanguage.cpp
-source ScriptAndLanguageTags.cpp
-source SegmentArrayProcessor.cpp
-source SegmentSingleProcessor.cpp
-source SimpleArrayProcessor.cpp
-source SinglePositioningSubtables.cpp
-source SingleSubstitutionSubtables.cpp
-source SingleTableProcessor.cpp
-source StateTableProcessor.cpp
-source SubstitutionLookups.cpp
-source SubtableProcessor.cpp
-source ThaiLayoutEngine.cpp
-source ThaiShaping.cpp
-source ThaiStateTables.cpp
-source TrimmedArrayProcessor.cpp
-source ValueRecords.cpp
-
-library euser.lib
-library estlib.lib
-library ecom.lib
-library fntstr.lib
-
-sourcepath ../source
-start resource iculayoutengine_fmm.rss
-target iculayoutengine_fmm.rsc
-lang sc
-end
-
-MACRO FNTSTORE_SUPPORT_FMM
-
-SMPSAFE
--- a/fontservices/textshaperplugin/source/iculayoutengine_fmm.rss Tue Feb 02 02:02:46 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* 10279727.RSS
-* Registration data for a CShaperFactory Interface Implementation Collection.
-* For use with IcuLayoutEngine_fmm.dll (the flexible memory model version of
-* the ICU Layout Engine).
-*
-*/
-
-
-#include "ecom/registryinfov2.rh"
-RESOURCE REGISTRY_INFO theInfo
- {
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
- dll_uid = 0x10274DB8;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = 0x10279726;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0x10279727;
- version_no = 1;
- display_name = "ICU LayoutEngine Shaper Plugin";
- default_data = "text/wml||This is the type of data that this implementation understands. (Can be anything which will allow the default resolver to identify this implementation as the correct one at run time. In this case it is a mime type).";
- opaque_data = " ";
- rom_only = 1;
- }
-
- };
- }
- };
- }
--- a/textrendering/textformatting/group/bld.inf Tue Feb 02 02:02:46 2010 +0200
+++ b/textrendering/textformatting/group/bld.inf Sat Feb 20 00:37:46 2010 +0200
@@ -37,8 +37,6 @@
#endif
../inc/FRMCONST_PARTNER.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(frmconst_partner.h)
-../inc/InlineText_Internal.h /epoc32/include/inlinetext_internal.h
-
../inc/FRMCONST.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(frmconst.h)
../inc/FRMFRAME.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(frmframe.h)
../inc/FRMLAYDT.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(frmlaydt.h)
--- a/textrendering/textformatting/inc/InlineText.h Tue Feb 02 02:02:46 2010 +0200
+++ b/textrendering/textformatting/inc/InlineText.h Sat Feb 20 00:37:46 2010 +0200
@@ -19,8 +19,13 @@
#ifndef INLINETEXT_H_
#define INLINETEXT_H_
+#include <e32std.h>
#include <tagma.h>
-#include <InlineText_Internal.h>
+
+/**
+@publishedPartner
+*/
+const TUid KInlineTextApiExtensionUid = { 0x101FD03D };
/**
--- a/textrendering/textformatting/tagma/TMINTERP.CPP Tue Feb 02 02:02:46 2010 +0200
+++ b/textrendering/textformatting/tagma/TMINTERP.CPP Sat Feb 20 00:37:46 2010 +0200
@@ -2124,8 +2124,7 @@
void RTmDrawingInterpreter::Draw()
{
- if (iClipRect.iBr.iY < TextLayoutTopLeft().iY
- || (iFlags & EInvisible))
+ if (iFlags & EInvisible)
return;
iGc.Reset();
--- a/textrendering/textformatting/tbox/LAYEMU.CPP Tue Feb 02 02:02:46 2010 +0200
+++ b/textrendering/textformatting/tbox/LAYEMU.CPP Sat Feb 20 00:37:46 2010 +0200
@@ -682,7 +682,7 @@
@return The y coordinate of the bottom of the last formatted line. */
EXPORT_C TInt CTextLayout::YBottomLastFormattedLine() const
{
- return iText->LayoutHeight() - iBandTop;
+ return Max(0, iText->LayoutHeight() - iBandTop );
}
/** Returns the height in pixels of the formatted text.