45 |
46 |
46 // Please note the following macros which enable helper functions, and are declared in the header. |
47 // Please note the following macros which enable helper functions, and are declared in the header. |
47 // SAVEGLYPHSTOMBMDURINGCOMPARISON and |
48 // SAVEGLYPHSTOMBMDURINGCOMPARISON and |
48 // SAVEGLYPHSTOMBMDEBUGFUNCTION |
49 // SAVEGLYPHSTOMBMDEBUGFUNCTION |
49 |
50 |
50 /* |
51 // Utility function declarations - utilities used by the tests |
51 Lookup table to convert from ascii code to |
|
52 glyph code for the Deja Vu family of fonts. |
|
53 */ |
|
54 const TUint DejaVuASCIIToGlyphCode[] = |
|
55 { |
|
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
59 0, 0, 3, 4, 5, 6, 7, 8, 9, 10, |
|
60 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
|
61 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
|
62 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
|
63 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, |
|
64 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, |
|
65 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, |
|
66 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, |
|
67 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
|
68 91, 92, 93, 94, 95, 96, 97, 98, |
|
69 }; |
|
70 |
|
71 // Utility function declations - utilities used by the tests |
|
72 static TFontSpec GenerateDejaVuFontSpec(TInt aSeed); |
52 static TFontSpec GenerateDejaVuFontSpec(TInt aSeed); |
73 static void CopyCharLine(TUint32*& aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth, TInt16 aRepeatCount); |
53 static void CopyCharLine(TUint32*& aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth, TInt16 aRepeatCount); |
74 static void DecodeBinaryData(const TSize& aDataSize, const TUint8* aData, TInt aStride, TUint32* aBinaryData); |
54 static void DecodeBinaryData(const TSize& aDataSize, const TUint8* aData, TInt aStride, TUint32* aBinaryData); |
75 static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage); |
55 static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage); |
76 static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage, TUint8* aBuffer1, TUint8* aBuffer2); |
56 static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage, TUint8* aBuffer1, TUint8* aBuffer2); |
511 iFbs = RFbsSession::GetSession(); |
491 iFbs = RFbsSession::GetSession(); |
512 iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL); |
492 iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL); |
513 User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15))); |
493 User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15))); |
514 User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont2, TFontSpec(KTypefaceName, 8))); |
494 User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont2, TFontSpec(KTypefaceName, 8))); |
515 |
495 |
|
496 CCharCodeConverter* converter = CCharCodeConverter::NewLC(); |
|
497 converter->UseFontL(iFont); |
516 iGlyphCodesLatin = new(ELeave) TUint[KNumGlyphCodesLatin]; |
498 iGlyphCodesLatin = new(ELeave) TUint[KNumGlyphCodesLatin]; |
517 for (TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii) |
499 for (TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii) |
518 { |
500 { |
519 TUint asciiCode = ii+0x20; // ASCII characters from 0020 to 007F |
501 TUint asciiCode = ii+0x20; // ASCII characters from 0020 to 007F |
520 iGlyphCodesLatin[ii] = DejaVuASCIIToGlyphCode[asciiCode]; |
502 iGlyphCodesLatin[ii] = converter->GlyphCodeL(asciiCode); |
521 } |
503 } |
|
504 CleanupStack::PopAndDestroy(1); // converter |
522 |
505 |
523 User::LeaveIfError(iSgDriver.Open()); |
506 User::LeaveIfError(iSgDriver.Open()); |
524 iEGL = CEGLHelper::NewL(); |
507 iEGL = CEGLHelper::NewL(); |
525 |
508 |
526 // Creating a CFbsBitmap will force the RFbsSession to allocate a scanline buffer |
509 // Creating a CFbsBitmap will force the RFbsSession to allocate a scanline buffer |