fbs/fontandbitmapserver/sfbs/FBSFONT.CPP
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 103 2717213c588a
child 110 7f25ef56562d
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
   634 	iFbs->SendCommand(EFbsMessShapeDelete,iHandle,PointerToOffset(aParam->iShapeHeader, iFbs->HeapBase()));
   634 	iFbs->SendCommand(EFbsMessShapeDelete,iHandle,PointerToOffset(aParam->iShapeHeader, iFbs->HeapBase()));
   635 	return KErrNone;
   635 	return KErrNone;
   636 	}
   636 	}
   637 
   637 
   638 
   638 
       
   639 TInt CFbsFont::DoGetFontTable(TGetFontTableParam* aParam) const
       
   640     {
       
   641     TInt ret = KErrGeneral;
       
   642 
       
   643     TPckgBuf<TOffsetLen> retBuf;
       
   644     ret = iFbs->SendCommand(EFbsMessGetFontTable, 
       
   645             TIpcArgs(iHandle, aParam->iTag, &retBuf));
       
   646     
       
   647     if (KErrNone == ret)
       
   648         {
       
   649         aParam->iLength = retBuf().iLen;
       
   650         aParam->iContent = OffsetToPointer(retBuf().iOffset, iFbs->HeapBase());
       
   651         }
       
   652     return ret;
       
   653     }
       
   654 
       
   655 
       
   656 TInt CFbsFont::DoGetGlyphOutline(TGetGlyphOutlineParam* aParam) const
       
   657     {
       
   658     TInt ret = KErrGeneral;
       
   659     
       
   660     TPckgBuf<TFBSGlyphOutlineParam> paramsBuf;
       
   661     TInt count = aParam->iCount;
       
   662     paramsBuf().iCount = aParam->iCount;
       
   663     paramsBuf().iHinted = aParam->iHinted;
       
   664     paramsBuf().iHandle = iHandle;
       
   665 
       
   666     TOffsetLen* offsetLen = (TOffsetLen *)User::Alloc(count * sizeof(TOffsetLen));
       
   667     if (NULL == offsetLen)
       
   668         {
       
   669         return KErrNoMemory;
       
   670         }
       
   671     TPtr8 retBuf((TUint8 *)offsetLen, count * sizeof(TOffsetLen),
       
   672             count * sizeof(TOffsetLen));
       
   673     TPtr8 codes((TUint8 *)(aParam->iCodes), count * sizeof(TUint), 
       
   674             count * sizeof(TUint));
       
   675     
       
   676     ret = iFbs->SendCommand( EFbsMessGetGlyphOutline, 
       
   677             TIpcArgs(&paramsBuf, &codes, &retBuf));
       
   678     
       
   679     if (KErrNone == ret)
       
   680         {
       
   681         // server writes the offsets back to client, convert them
       
   682         // to local pointers.
       
   683         for (TInt i = 0; i < aParam->iCount; ++i)
       
   684             {
       
   685             aParam->iOutlines[i] = OffsetToPointer(offsetLen[i].iOffset, 
       
   686                     iFbs->HeapBase());
       
   687             aParam->iLengths[i] = offsetLen[i].iLen;
       
   688             }
       
   689         }
       
   690     User::Free(offsetLen);
       
   691     return ret;
       
   692     }
       
   693 
       
   694 TInt CFbsFont::DoReleaseGlyphOutline(TReleaseGlyphOutlineParam* aParam) const 
       
   695     {
       
   696     TInt ret = KErrGeneral;
       
   697     
       
   698     TPckgBuf<TFBSGlyphOutlineParam> params;
       
   699     TInt count = aParam->iCount;
       
   700     params().iCount = count;
       
   701     params().iHinted = aParam->iHinted;
       
   702     params().iHandle = iHandle;
       
   703 
       
   704     TPtr8 codes((unsigned char *)aParam->iCodes, count * sizeof(TUint), count * sizeof(TUint));
       
   705     
       
   706     ret = iFbs->SendCommand(EFbsMessReleaseGlyphOutline, 
       
   707             TIpcArgs(&params, &codes));
       
   708         
       
   709     return ret;
       
   710     }   
       
   711 
       
   712 TInt CFbsFont::DoReleaseFontTable(TUint32* aParam) const 
       
   713     {
       
   714     TInt ret = KErrGeneral;
       
   715     
       
   716     ret = iFbs->SendCommand(EFbsMessReleaseFontTable, 
       
   717             TIpcArgs(iHandle, *aParam));
       
   718         
       
   719     return ret;
       
   720     }   
   639 /** API extension system that enables the caller to access a particular API
   721 /** API extension system that enables the caller to access a particular API
   640 extension function. As an overload of this function in a derived class
   722 extension function. As an overload of this function in a derived class
   641 it calls its immediate parent implementation for any extension function Uid
   723 it calls its immediate parent implementation for any extension function Uid
   642 that it does not recognize and handle.
   724 that it does not recognize and handle.
   643 @param aInterfaceId UID of the required extension function
   725 @param aInterfaceId UID of the required extension function
   672 		else if (aFunctionId == KTextInContextWidthInPixelsUid)
   754 		else if (aFunctionId == KTextInContextWidthInPixelsUid)
   673 			{
   755 			{
   674 			TTextWidthInternal* contextParam = (TTextWidthInternal*)aParam;
   756 			TTextWidthInternal* contextParam = (TTextWidthInternal*)aParam;
   675 			return DoTextWidthInPixels(contextParam->iText,&contextParam->iParam);
   757 			return DoTextWidthInPixels(contextParam->iText,&contextParam->iParam);
   676 			}
   758 			}
       
   759 		else if (aFunctionId == KFontGetFontTable) 
       
   760 		    {
       
   761             return DoGetFontTable(reinterpret_cast<TGetFontTableParam *>(aParam));
       
   762 		    }
       
   763 		else if (aFunctionId == KFontGetGlyphOutline)
       
   764 		    {
       
   765 		    return DoGetGlyphOutline(reinterpret_cast<TGetGlyphOutlineParam *>(aParam));
       
   766 		    }
       
   767 		else if (aFunctionId == KFontReleaseGlyphOutline)
       
   768 		    {
       
   769 		    return DoReleaseGlyphOutline(reinterpret_cast<TReleaseGlyphOutlineParam *>(aParam));
       
   770 		    }
       
   771 		else if (aFunctionId == KFontReleaseFontTable)
       
   772             {
       
   773             return DoReleaseFontTable(reinterpret_cast<TUint32 *>(aParam));
       
   774             }
   677 		}
   775 		}
   678 	return CFont::DoExtendedFunction(aFunctionId, aParam);
   776 	return CFont::DoExtendedFunction(aFunctionId, aParam);
   679 	}
   777 	}