93 { |
93 { |
94 font_store = fbTop->FontStore(); |
94 font_store = fbTop->FontStore(); |
95 } |
95 } |
96 |
96 |
97 if (font_store) |
97 if (font_store) |
|
98 { |
98 font_store->DeleteSessionCache(iSessionHandle); |
99 font_store->DeleteSessionCache(iSessionHandle); |
99 |
100 font_store->CleanupCacheOnFbsSessionTermination(iSessionHandle); |
100 // If the font store doesn't exist, neither will the shared heap owned by FBSERV. |
101 |
101 if (font_store) |
102 // If the font store doesn't exist, neither will the shared heap owned by FBSERV. |
102 iHeap->Free(iOpenFontGlyphData); |
103 iHeap->Free(iOpenFontGlyphData); |
|
104 } |
103 |
105 |
104 // delete fonts hold by the client |
106 // delete fonts hold by the client |
105 delete iIx; |
107 delete iIx; |
106 |
108 |
107 // delete font files hold by the client |
109 // delete font files hold by the client |
108 if (iFontFileIndex) |
110 if (iFontFileIndex) |
109 { |
111 { |
110 TInt count = iFontFileIndex->Count(); |
112 TInt count = iFontFileIndex->Count(); |
111 for (TInt index = 0;index < count; index++) |
113 for (TInt index = 0;index < count; index++) |
112 { |
114 { |
113 if (font_store) |
115 if (font_store) |
114 font_store->RemoveFile(iFontFileIndex->At(0).iUid); |
116 font_store->RemoveFile(iFontFileIndex->At(0).iUid); |
115 iFontFileIndex->Delete(0); |
117 iFontFileIndex->Delete(0); |
116 } |
118 } |
117 delete iFontFileIndex; |
119 delete iFontFileIndex; |
118 } |
120 } |
119 |
121 |
120 // Close the buffer used to hold the text thats needs shaping. |
122 // Close the buffer used to hold the text thats needs shaping. |
121 iTextToShape.Close(); |
123 iTextToShape.Close(); |
122 } |
124 } |
123 |
125 |
790 |
796 |
791 bitmapFont->DeleteShape(iSessionHandle,shapeheader); |
797 bitmapFont->DeleteShape(iSessionHandle,shapeheader); |
792 return KErrNone; |
798 return KErrNone; |
793 } |
799 } |
794 |
800 |
|
801 TInt CFbClient::HandleMesgReleaseGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired) |
|
802 { |
|
803 TInt ret = KErrNone; |
|
804 CFbTop* fbtop = TopLevelStore(); |
|
805 TPckgBuf<TFBSGlyphOutlineParam> params; |
|
806 ret = aMessage.Read(0, params); |
|
807 if (KErrNone != ret) |
|
808 { |
|
809 aPanicRequired = ETrue; |
|
810 return ret; |
|
811 } |
|
812 CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(params().iHandle, fbtop->FontConUniqueID())); |
|
813 if(!fontptr) |
|
814 { |
|
815 aPanicRequired = ETrue; |
|
816 return KErrArgument; |
|
817 } |
|
818 CBitmapFont* bitmapFont = fontptr->iAddressPointer; |
|
819 |
|
820 TInt count = params().iCount; |
|
821 TUint *glyphCodes = (TUint *)User::Alloc(count * sizeof(TUint)); |
|
822 if (NULL == glyphCodes) |
|
823 { |
|
824 return KErrNoMemory; |
|
825 } |
|
826 // copy the glyph codes out of the IPC buffer... |
|
827 TPtr8 ptr((TUint8 *)glyphCodes, count * sizeof(TUint), count * sizeof(TUint)); |
|
828 ret = aMessage.Read(1, ptr); |
|
829 |
|
830 if (KErrNone == ret) |
|
831 { |
|
832 bitmapFont->ReleaseGlyphOutlines(count, glyphCodes, |
|
833 params().iHinted, iSessionHandle); |
|
834 } |
|
835 else |
|
836 { |
|
837 aPanicRequired = ETrue; |
|
838 } |
|
839 |
|
840 User::Free(glyphCodes); |
|
841 return ret; |
|
842 } |
|
843 |
|
844 TInt CFbClient::HandleMesgGetGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired) |
|
845 { |
|
846 TInt ret = KErrNone; |
|
847 CFbTop* fbtop = TopLevelStore(); |
|
848 TPckgBuf<TFBSGlyphOutlineParam> params; |
|
849 ret = aMessage.Read(0, params); |
|
850 if (KErrNone != ret) |
|
851 { |
|
852 aPanicRequired = ETrue; |
|
853 return ret; |
|
854 } |
|
855 CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(params().iHandle, fbtop->FontConUniqueID())); |
|
856 if(!fontptr) |
|
857 { |
|
858 aPanicRequired = ETrue; |
|
859 return KErrArgument; |
|
860 } |
|
861 CBitmapFont* bitmapFont = fontptr->iAddressPointer; |
|
862 |
|
863 TInt count = params().iCount; |
|
864 TUint* glyphCodes = (TUint *)User::Alloc(count * sizeof(TUint)); |
|
865 if (NULL == glyphCodes) |
|
866 { |
|
867 return KErrNoMemory; |
|
868 } |
|
869 // copy the glyph codes out of the IPC buffer... |
|
870 TPtr8 ptr((TUint8 *)glyphCodes, count * sizeof(TUint), count * sizeof(TUint)); |
|
871 ret = aMessage.Read(1, ptr); |
|
872 if (KErrNone != ret) |
|
873 { |
|
874 User::Free(glyphCodes); |
|
875 aPanicRequired = ETrue; |
|
876 return ret; |
|
877 } |
|
878 |
|
879 TOffsetLen* offsetLens = |
|
880 (TOffsetLen *)User::Alloc(count * sizeof(TOffsetLen)); |
|
881 if (NULL == offsetLens) |
|
882 { |
|
883 User::Free(glyphCodes); |
|
884 return KErrNoMemory; |
|
885 } |
|
886 |
|
887 TInt len = 0; |
|
888 TAny* outline = NULL; |
|
889 for (TInt i = 0; i < count; ++i) |
|
890 { |
|
891 bitmapFont->GetGlyphOutline(glyphCodes[i], |
|
892 params().iHinted, outline, len, iSessionHandle); |
|
893 |
|
894 offsetLens[i].iLen = len; |
|
895 offsetLens[i].iOffset = PointerToOffset((outline), fbtop->HeapBase()); |
|
896 } |
|
897 TPtr8 pkg2((TUint8 *)offsetLens, count * sizeof(TOffsetLen), |
|
898 count * sizeof(TOffsetLen)); |
|
899 ret = aMessage.Write(2, pkg2); |
|
900 if (KErrNone != ret) |
|
901 { |
|
902 aPanicRequired = ETrue; |
|
903 } |
|
904 |
|
905 User::Free(glyphCodes); |
|
906 User::Free(offsetLens); |
|
907 return ret; |
|
908 } |
|
909 |
|
910 TInt CFbClient::HandleMesgReleaseFontTable(const RMessage2& aMessage, TBool& aPanicRequired) |
|
911 { |
|
912 CFbTop* fbtop = TopLevelStore(); |
|
913 CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(aMessage.Int0(), fbtop->FontConUniqueID())); |
|
914 if(!fontptr) |
|
915 { |
|
916 aPanicRequired = ETrue; |
|
917 return KErrArgument; |
|
918 } |
|
919 CBitmapFont* bitmapFont = fontptr->iAddressPointer; |
|
920 |
|
921 TUint32 tag = aMessage.Int1(); |
|
922 |
|
923 bitmapFont->ReleaseFontTable(tag, iSessionHandle); |
|
924 |
|
925 return KErrNone; |
|
926 } |
|
927 |
|
928 TInt CFbClient::HandleMesgGetFontTable(const RMessage2& aMessage, TBool& aPanicRequired) |
|
929 { |
|
930 TInt ret = KErrNone; |
|
931 CFbTop* fbtop = TopLevelStore(); |
|
932 CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(aMessage.Int0(), fbtop->FontConUniqueID())); |
|
933 if(!fontptr) |
|
934 { |
|
935 aPanicRequired = ETrue; |
|
936 return KErrArgument; |
|
937 } |
|
938 CBitmapFont* bitmapFont = fontptr->iAddressPointer; |
|
939 |
|
940 TInt len = 0; |
|
941 TAny* tablePtr = NULL; |
|
942 ret = bitmapFont->GetFontTable((TUint32)aMessage.Int1(), tablePtr, len, iSessionHandle); |
|
943 |
|
944 if (KErrNone == ret) |
|
945 { |
|
946 TPckgBuf<TOffsetLen> params; |
|
947 params().iLen = len; |
|
948 params().iOffset = PointerToOffset(tablePtr, fbtop->HeapBase()); |
|
949 ret = aMessage.Write(2, params); |
|
950 aPanicRequired = (KErrNone != ret); |
|
951 } |
|
952 |
|
953 return ret; |
|
954 } |
795 |
955 |
796 void CFbClient::ProcFontMessage(const RMessage2& aMessage) |
956 void CFbClient::ProcFontMessage(const RMessage2& aMessage) |
797 { |
957 { |
798 TInt ret = KErrUnknown; |
958 TInt ret = KErrUnknown; |
799 TBool panicRequired = EFalse; |
959 TBool panicRequired = EFalse; |