fbs/fontandbitmapserver/tfbs/tfbsglyphdata.cpp
changeset 136 62bb7c97884c
parent 121 d72fc2aace31
--- a/fbs/fontandbitmapserver/tfbs/tfbsglyphdata.cpp	Tue Jul 20 13:27:44 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdata.cpp	Fri Jul 30 11:41:40 2010 +0300
@@ -18,6 +18,7 @@
  @internalComponent - Internal Symbian test code
 */
 
+#include <test/graphicsfontutils.h>
 #include <EGL/egl.h>
 #include <VG/openvg.h>
 #include <graphics/fbsglyphmetricsarray.h> 
@@ -47,28 +48,7 @@
 // SAVEGLYPHSTOMBMDURINGCOMPARISON and
 // SAVEGLYPHSTOMBMDEBUGFUNCTION
 
-/*
-Lookup table to convert from ascii code to
-glyph code for the Deja Vu family of fonts.
- */
-const TUint DejaVuASCIIToGlyphCode[] = 
-	{
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 3, 4, 5, 6, 7, 8, 9, 10,
-	11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-	21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
-	31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-	41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
-	51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
-	61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
-	71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
-	81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
-	91, 92, 93, 94, 95, 96, 97, 98,
-	};
-
-// Utility function declations - utilities used by the tests
+// Utility function declarations - utilities used by the tests
 static TFontSpec GenerateDejaVuFontSpec(TInt aSeed);
 static void CopyCharLine(TUint32*& aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth, TInt16 aRepeatCount);
 static void DecodeBinaryData(const TSize& aDataSize, const TUint8* aData, TInt aStride,	TUint32* aBinaryData);
@@ -513,12 +493,15 @@
 	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15)));
 	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont2, TFontSpec(KTypefaceName, 8)));
 	
+	CCharCodeConverter* converter = CCharCodeConverter::NewLC();
+	converter->UseFontL(iFont);
 	iGlyphCodesLatin = new(ELeave) TUint[KNumGlyphCodesLatin];
 	for (TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii)
 		{
 		TUint asciiCode = ii+0x20; // ASCII characters from 0020 to 007F
-		iGlyphCodesLatin[ii] = DejaVuASCIIToGlyphCode[asciiCode];
+		iGlyphCodesLatin[ii] = converter->GlyphCodeL(asciiCode);
 		}
+	CleanupStack::PopAndDestroy(1); // converter
 	
 	User::LeaveIfError(iSgDriver.Open());
 	iEGL = CEGLHelper::NewL();
@@ -2049,7 +2032,7 @@
 	INFO_PRINTF1(_L("White box test - Ensure that the same RSgImage is used for repeated requests for the same glyph in the same call to Open()"));
 	__UHEAP_MARK;
 
-	const TUint KSameRepeatedGlyphCode = DejaVuASCIIToGlyphCode[0x004B]; // 'K'
+	const TUint KSameRepeatedGlyphCode = iGlyphCodesLatin['A' - 0x20];
 	const TInt KNumGlyphs = 10;
 	TUint* sameRepeatedGlyphCodes = new TUint[KNumGlyphs];
 	for (TInt ii = 0; ii < KNumGlyphs; ++ii)