equal
deleted
inserted
replaced
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 #include <fbs.h> |
17 #include <fbs.h> |
18 #include <openfont.h> |
18 #include <openfont.h> |
19 #include <graphics/shapeimpl.h> |
19 #include <graphics/shapeimpl.h> |
20 #include "UTILS.H" |
20 #include "UTILS.H" |
21 #include <graphics/shaperparams.h> |
21 #include <graphics/shaperparams.h> |
22 #include "fbsmessage.h" |
22 #include "FbsMessage.H" |
23 #include <graphics/gdi/gdiconsts.h> |
23 #include <graphics/gdi/gdiconsts.h> |
24 #include <graphics/gdi/gdistructs.h> |
24 #include <graphics/gdi/gdistructs.h> |
25 |
25 |
26 GLREF_C void Panic(TFbsPanic aPanic); |
26 GLREF_C void Panic(TFbsPanic aPanic); |
27 |
27 |
36 */ |
36 */ |
37 LOCAL_C TInt PointerToOffset(const TAny* aAny, TUint8* aHeapBase) |
37 LOCAL_C TInt PointerToOffset(const TAny* aAny, TUint8* aHeapBase) |
38 { |
38 { |
39 if (aAny && aHeapBase) |
39 if (aAny && aHeapBase) |
40 { |
40 { |
41 return (TInt)aAny - (TInt)aHeapBase; |
41 return reinterpret_cast<TInt>(aAny) - reinterpret_cast<TInt>(aHeapBase); |
42 } |
42 } |
43 return 0; |
43 return 0; |
44 } |
44 } |
45 |
45 |
46 /** Helper function for converting an offset (that was calculated using |
46 /** Helper function for converting an offset (that was calculated using |
48 @param aOffset The offset to be converted to a pointer. |
48 @param aOffset The offset to be converted to a pointer. |
49 @param aHeapBase A pointer to the heap base of the current process. |
49 @param aHeapBase A pointer to the heap base of the current process. |
50 @return A pointer relative to the passed heap base. |
50 @return A pointer relative to the passed heap base. |
51 @see PointerToOffset() |
51 @see PointerToOffset() |
52 */ |
52 */ |
53 LOCAL_C TAny* OffsetToPointer(const TInt aOffset, TUint8* aHeapBase) |
53 LOCAL_C TAny* OffsetToPointer(TInt aOffset, TUint8* aHeapBase) |
54 { |
54 { |
55 if (aOffset && aHeapBase) |
55 if (aOffset && aHeapBase) |
56 { |
56 { |
57 return (TAny*)(aOffset + (TInt)aHeapBase); |
57 return reinterpret_cast<TAny*>(aOffset + reinterpret_cast<TInt>(aHeapBase)); |
58 } |
58 } |
59 return NULL; |
59 return NULL; |
60 } |
60 } |
61 |
61 |
62 EXPORT_C CFbsFont::CFbsFont(): |
62 EXPORT_C CFbsFont::CFbsFont(): |
467 |
467 |
468 if(iFbs->SendCommand(EFbsMessRasterize, args)) |
468 if(iFbs->SendCommand(EFbsMessRasterize, args)) |
469 { |
469 { |
470 // Translate the offsets sent to the server back to pointers relative to |
470 // Translate the offsets sent to the server back to pointers relative to |
471 // the heap base of the current process |
471 // the heap base of the current process |
472 const TOpenFontCharMetrics* temp = (const TOpenFontCharMetrics*)OffsetToPointer(paramsBuf().iMetricsOffset, iFbs->HeapBase()); |
472 const TOpenFontCharMetrics* metrics = (const TOpenFontCharMetrics*)OffsetToPointer(paramsBuf().iMetricsOffset, iFbs->HeapBase()); |
473 if (temp) |
473 if (metrics) |
474 { |
474 { |
475 aMetrics = *temp; |
475 aMetrics = *metrics; |
476 } |
476 } |
477 aBitmap = static_cast<TUint8*>(OffsetToPointer(paramsBuf().iBitmapPointerOffset, iFbs->HeapBase())); |
477 aBitmap = static_cast<TUint8*>(OffsetToPointer(paramsBuf().iBitmapPointerOffset, iFbs->HeapBase())); |
478 } |
478 } |
479 else |
479 else |
480 { |
480 { |
585 @released |
585 @released |
586 */ |
586 */ |
587 EXPORT_C TBool CFbsFont::HasCharacter(TInt aCode) const |
587 EXPORT_C TBool CFbsFont::HasCharacter(TInt aCode) const |
588 { |
588 { |
589 if (iHandle) |
589 if (iHandle) |
590 { |
590 { |
591 return iFbs->SendCommand(EFbsMessHasCharacter,iHandle,aCode); |
591 return iFbs->SendCommand(EFbsMessHasCharacter,iHandle,aCode); |
592 } |
592 } |
593 return EFalse; |
593 return EFalse; |
594 } |
594 } |
595 |
595 |
619 } |
619 } |
620 |
620 |
621 |
621 |
622 /** help DoExtendedFunction to perform KFontDeleteShaping function |
622 /** help DoExtendedFunction to perform KFontDeleteShaping function |
623 @param aParam Input parameter block |
623 @param aParam Input parameter block |
624 @return KErrNone if successful, KErrBadHandle if the font does not have a valid handle. |
624 @return KErrNone if successful, KErrGeneral if the font does not have a valid handle. |
625 */ |
625 */ |
626 TInt CFbsFont::DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const |
626 TInt CFbsFont::DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const |
627 { |
627 { |
628 if (!iHandle) |
628 if (!iHandle) |
629 { |
629 { |
773 return DoReleaseFontTable(reinterpret_cast<TUint32 *>(aParam)); |
773 return DoReleaseFontTable(reinterpret_cast<TUint32 *>(aParam)); |
774 } |
774 } |
775 } |
775 } |
776 return CFont::DoExtendedFunction(aFunctionId, aParam); |
776 return CFont::DoExtendedFunction(aFunctionId, aParam); |
777 } |
777 } |
|
778 |