fbs/fontandbitmapserver/sfbs/FBSFONT.CPP
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 103 2717213c588a
child 110 7f25ef56562d
--- a/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Tue Feb 02 01:47:50 2010 +0200
+++ b/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Fri Apr 16 16:21:04 2010 +0300
@@ -636,6 +636,88 @@
 	}
 
 
+TInt CFbsFont::DoGetFontTable(TGetFontTableParam* aParam) const
+    {
+    TInt ret = KErrGeneral;
+
+    TPckgBuf<TOffsetLen> retBuf;
+    ret = iFbs->SendCommand(EFbsMessGetFontTable, 
+            TIpcArgs(iHandle, aParam->iTag, &retBuf));
+    
+    if (KErrNone == ret)
+        {
+        aParam->iLength = retBuf().iLen;
+        aParam->iContent = OffsetToPointer(retBuf().iOffset, iFbs->HeapBase());
+        }
+    return ret;
+    }
+
+
+TInt CFbsFont::DoGetGlyphOutline(TGetGlyphOutlineParam* aParam) const
+    {
+    TInt ret = KErrGeneral;
+    
+    TPckgBuf<TFBSGlyphOutlineParam> paramsBuf;
+    TInt count = aParam->iCount;
+    paramsBuf().iCount = aParam->iCount;
+    paramsBuf().iHinted = aParam->iHinted;
+    paramsBuf().iHandle = iHandle;
+
+    TOffsetLen* offsetLen = (TOffsetLen *)User::Alloc(count * sizeof(TOffsetLen));
+    if (NULL == offsetLen)
+        {
+        return KErrNoMemory;
+        }
+    TPtr8 retBuf((TUint8 *)offsetLen, count * sizeof(TOffsetLen),
+            count * sizeof(TOffsetLen));
+    TPtr8 codes((TUint8 *)(aParam->iCodes), count * sizeof(TUint), 
+            count * sizeof(TUint));
+    
+    ret = iFbs->SendCommand( EFbsMessGetGlyphOutline, 
+            TIpcArgs(&paramsBuf, &codes, &retBuf));
+    
+    if (KErrNone == ret)
+        {
+        // server writes the offsets back to client, convert them
+        // to local pointers.
+        for (TInt i = 0; i < aParam->iCount; ++i)
+            {
+            aParam->iOutlines[i] = OffsetToPointer(offsetLen[i].iOffset, 
+                    iFbs->HeapBase());
+            aParam->iLengths[i] = offsetLen[i].iLen;
+            }
+        }
+    User::Free(offsetLen);
+    return ret;
+    }
+
+TInt CFbsFont::DoReleaseGlyphOutline(TReleaseGlyphOutlineParam* aParam) const 
+    {
+    TInt ret = KErrGeneral;
+    
+    TPckgBuf<TFBSGlyphOutlineParam> params;
+    TInt count = aParam->iCount;
+    params().iCount = count;
+    params().iHinted = aParam->iHinted;
+    params().iHandle = iHandle;
+
+    TPtr8 codes((unsigned char *)aParam->iCodes, count * sizeof(TUint), count * sizeof(TUint));
+    
+    ret = iFbs->SendCommand(EFbsMessReleaseGlyphOutline, 
+            TIpcArgs(&params, &codes));
+        
+    return ret;
+    }   
+
+TInt CFbsFont::DoReleaseFontTable(TUint32* aParam) const 
+    {
+    TInt ret = KErrGeneral;
+    
+    ret = iFbs->SendCommand(EFbsMessReleaseFontTable, 
+            TIpcArgs(iHandle, *aParam));
+        
+    return ret;
+    }   
 /** API extension system that enables the caller to access a particular API
 extension function. As an overload of this function in a derived class
 it calls its immediate parent implementation for any extension function Uid
@@ -674,6 +756,22 @@
 			TTextWidthInternal* contextParam = (TTextWidthInternal*)aParam;
 			return DoTextWidthInPixels(contextParam->iText,&contextParam->iParam);
 			}
+		else if (aFunctionId == KFontGetFontTable) 
+		    {
+            return DoGetFontTable(reinterpret_cast<TGetFontTableParam *>(aParam));
+		    }
+		else if (aFunctionId == KFontGetGlyphOutline)
+		    {
+		    return DoGetGlyphOutline(reinterpret_cast<TGetGlyphOutlineParam *>(aParam));
+		    }
+		else if (aFunctionId == KFontReleaseGlyphOutline)
+		    {
+		    return DoReleaseGlyphOutline(reinterpret_cast<TReleaseGlyphOutlineParam *>(aParam));
+		    }
+		else if (aFunctionId == KFontReleaseFontTable)
+            {
+            return DoReleaseFontTable(reinterpret_cast<TUint32 *>(aParam));
+            }
 		}
 	return CFont::DoExtendedFunction(aFunctionId, aParam);
 	}