fontsupport/fontprovider/Src/FontProvider.cpp
changeset 2 abcbdabaa4c5
parent 1 ba33815114d6
child 32 d9c996538b26
child 42 2398a337fa76
--- a/fontsupport/fontprovider/Src/FontProvider.cpp	Thu Jan 07 13:25:09 2010 +0200
+++ b/fontsupport/fontprovider/Src/FontProvider.cpp	Mon Jan 18 21:12:52 2010 +0200
@@ -100,15 +100,6 @@
 _LIT(KS60TCHKHRSANSTTLSMBLDLF, "S60TCHKHRSANSTTLSMBLDLF");
 //end
 
-//browser link fonts start
-//Western Content Linked fonts
-_LIT(KS60LATAMTREG, "S60LATAMTREG");
-_LIT(KS60LATAMTBLD, "S60LATAMTBLD");
-_LIT(KS60LATTHOREG, "S60LATTHOREG");
-_LIT(KS60LATTHOBLD, "S60LATTHOBLD");
-_LIT(KS60LATCUMREG, "S60LATCUMREG");
-_LIT(KS60LATCUMBLD, "S60LATCUMBLD");
-//browser link fonts stop
 
 // Texts for measuring maximum ascents and descents:
 _LIT(KWesternFontMaxExtentText, "\x00C1\x00C7" );
@@ -135,9 +126,6 @@
 //chinese adaptation
 #define ELanguageSupportChineseFontLinking          0x00400000
 //end
-//additional browser fonts
-#define ELanguageAdditionalContentFonts             0x00800000
-//end
 #define ELanguageSupportDevanagari                  0x01000000
 #define ELanguageSupportS60PrivateUseArea1          0x10000000
 
@@ -228,16 +216,11 @@
                                         | ELanguageSupportChineseHiRes \
                                         | ELanguageSupportChineseFontLinking )
 //end                                    
-//browser
-#define EElafLangsBrowserFonts ( EElafLangs \
-                                   |ELanguageAdditionalContentFonts)
-//end
+
 
 // Wildcard value for langs (font is to be used for all languages)
 #define EAnyLangs           0xffffffff
 const TInt KAknFontStylesSupported(3);
-const TInt KAknAdditionalBrowserFonts(6);
-
 enum TAknLinkedFontTypes
     {
     EAknSystemLinkedFonts,
@@ -496,17 +479,10 @@
 _LIT(KSerif, "serif");
 _LIT(KMonospace, "monospaced");
 _LIT(KCourier, "courier");
-_LIT(KCourierNew, "courier new");
-_LIT(KBaskerville, "Baskerville");
-_LIT(KTrebuchet, "Trebuchet");
 
 // Group names
 _LIT(KS60Group, "S60Group");
-//new browser fonts start
-_LIT(KArialGroup, "ArialGroup");
-_LIT(KTnrGroup, "TnrGroup");
-_LIT(KCourGroup, "CourGroup");
-//new browser fonts end
+
 // Default
 _LIT(KDefaultGroupName, "S60Group");
 
@@ -552,16 +528,13 @@
     { LIT_AS_DESC_PTR(KSansSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
     { LIT_AS_DESC_PTR(KSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
     { LIT_AS_DESC_PTR(KMonospace) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
-    { LIT_AS_DESC_PTR(KTrebuchet) ,LIT_AS_DESC_PTR(KArialGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KArial) ,LIT_AS_DESC_PTR(KArialGroup), &languagesAndTypefaceTable, EFalse  },
+    { LIT_AS_DESC_PTR(KArial) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
     { LIT_AS_DESC_PTR(KVerdana),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
     { LIT_AS_DESC_PTR(KHelvetica),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KBaskerville),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KGeorgia),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KTimes),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KTimesNewRoman) ,LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KCourier) ,LIT_AS_DESC_PTR(KCourGroup), &languagesAndTypefaceTable, EFalse  },
-    { LIT_AS_DESC_PTR(KCourierNew) ,LIT_AS_DESC_PTR(KCourGroup), &languagesAndTypefaceTable, EFalse  },
+    { LIT_AS_DESC_PTR(KGeorgia),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
+    { LIT_AS_DESC_PTR(KTimes),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
+    { LIT_AS_DESC_PTR(KTimesNewRoman) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
+    { LIT_AS_DESC_PTR(KCourier) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
     { LIT_AS_DESC_PTR(KNullDesC) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse }
 };
 
@@ -682,20 +655,7 @@
     { EAknFontCategoryPrimarySmall, 0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
     { EAknFontCategoryPrimary,      0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
     { EAknFontCategoryTitle,        0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSTTLSMBLDLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
-    { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
-    
-    //new browser fonts start
-    //western tnr
-    { EAknFontCategoryAny,          0, EAny, EStrokeWeightBold, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATTHOBLD), LIT_AS_DESC_PTR(KTnrGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText) },
-    { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATTHOREG), LIT_AS_DESC_PTR(KTnrGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText) },
-    //western arial
-    { EAknFontCategoryAny,          0, EAny, EStrokeWeightBold, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATAMTBLD), LIT_AS_DESC_PTR(KArialGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText) },
-    { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATAMTREG), LIT_AS_DESC_PTR(KArialGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText) },
-    //western courier
-    { EAknFontCategoryAny,          0, EAny, EStrokeWeightBold, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATCUMBLD), LIT_AS_DESC_PTR(KCourGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText)},
-    { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EElafLangsBrowserFonts, LIT_AS_DESC_PTR(KS60LATCUMREG), LIT_AS_DESC_PTR(KCourGroup), NULL, &latinHeightRequestArray, LIT_AS_DESC_PTR(KWesternFontMaxExtentText) }, 
-        
-    //new browser fonts end
+    { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL }
 //end
     };
 // ============================ GLOBAL FUNCTIONS ========================================
@@ -1133,15 +1093,14 @@
 */
 LOCAL_C TBool TypefaceAvailableL( 
     CGraphicsDevice& aDevice, 
-    const TTypeface& aTypeface,
-    TInt aTypefaceType =EGulNoSymbolFonts )
+    const TTypeface& aTypeface )
     {
     TBool found(EFalse);
 
     CDesCArray* array = new(ELeave) CDesCArrayFlat( 6 );
     CleanupStack::PushL( array );
 
-    FontUtils::GetAvailableFontsL(aDevice, *array, aTypefaceType);
+    FontUtils::GetAvailableFontsL(aDevice, *array, EGulNoSymbolFonts);
     for ( TInt i = 0; i < array->Count(); i++ )
         {       
         TPtrC fontName((*array)[i]);
@@ -1238,23 +1197,6 @@
     
     // Ensure proportionality flag is set. Assumes all S60 fonts are proportional
     aFontSpec.iTypeface.SetIsProportional(ETrue);    
-    
-    TInt reqLangs = FontProviderRequiredLangs();
-    if((reqLangs == EChineseLangsPRC) || (reqLangs ==EChineseLangsTaiwanHK)|| 
-       (reqLangs ==EChineseLangsPRCLF) ||(reqLangs ==EChineseLangsTaiwanHKLF))
-        {
-        if((aFontSpec.iHeight > 21) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
-            aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
-        //stroke font files used, not to use bold
-        aFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal );
-        }
-    else if(reqLangs == EKoreanLangs)
-        {
-        if((aFontSpec.iHeight > 17) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
-            aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);        
-        }
-    else if((aFontSpec.iHeight > 16) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
-        aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
     }
 
 LOCAL_C TBool HasRequiredLanguages( 
@@ -1405,20 +1347,8 @@
         }
 
     TBool specIsSetUp(EFalse);
-    
-	//new browser fonts start
-    //checking whether the typeface is installed
-    TInt numberOfRows = sizeof( productFontTable )/ sizeof( SAknProductFontTableLine );
-    SAknProductFontTableLine line = productFontTable[aFoundIndex];
-    TTypeface pftTypeface;
-    TBool available(ETrue);
-    if(aFoundIndex>=0 && aFoundIndex<numberOfRows)
-        {
-    pftTypeface.iName = line.iTypefaceName->Left((KMaxTypefaceNameLength));
-    TRAP_IGNORE( available = TypefaceAvailableL( *aDevice, pftTypeface,EGulAllFonts ) );    
-        }
-    //end
-    if ( (aFoundIndex == KErrNotFound) || ((TInt)EFalse == available))
+
+    if ( aFoundIndex == KErrNotFound)
         {
         // Note that because the alias table has language matching, the direct typeface name should be 
         // appropriate at least for language.
@@ -1877,12 +1807,13 @@
     //chinese adaptation
     TBool fChLinkedFonts = FeatureManager::FeatureSupported(KFeatureIdFfLinkedFontsChinese);
     TBool fChinese = FeatureManager::FeatureSupported(KFeatureIdChinese);
-    TBool fAdditionalFonts = FeatureManager::FeatureSupported(KFeatureIdFfAdditionalFonts);
-    if((fChinese && fChLinkedFonts) || fAdditionalFonts)
+    if(fChinese && fChLinkedFonts)
       {
       //attempt to create linked font only once
       if(!LinkTypefacesInstalled())
 	    {
+	     //TRAP call necessary
+	     //not need to handle return value, hanled by LinkTypefacesInstalled()
 	     TRAP_IGNORE(IntializeLinkedFontL());
       	}    	  
       }
@@ -2188,8 +2119,6 @@
     _LIT(KSCHRStop, "[SCHR_LINK_STOP]");
     _LIT(KTCHKHRStart, "[TCHKHR_LINK_START]");
     _LIT(KTCHKHRStop, "[TCHKHR_LINK_STOP]");
-    _LIT(KWESTBROWStart, "[WESTERN_BROWSER_START]");
-    _LIT(KWESTBROWStop, "[WESTERN_BROWSER_STOP]");
 
     TInt ret = KErrNone;
     RPointerArray<SLinkedFontDetails> fontfiles;
@@ -2212,10 +2141,6 @@
             KFeatureIdChinesePrcFonts);
     TBool fHiResFonts = FeatureManager::FeatureSupported(
             KFeatureIdChineseFontsHires);
-    TBool fAdditionalFonts = FeatureManager::FeatureSupported(
-            KFeatureIdFfAdditionalFonts);
-    TBool fChinese = FeatureManager::FeatureSupported(
-            KFeatureIdChinese);
 
     
     if (fChLinkedFonts)
@@ -2251,16 +2176,6 @@
             }
         
         }
-    if(fAdditionalFonts)
-        {
-        if((!fChinese) && (!fSCFonts) && (!fTCHKFonts) && (!fHiResFonts))//must be western variant
-            {
-            startTok.Copy(KWESTBROWStart);
-            stopTok.Copy(KWESTBROWStop);
-            tfile.Seek(ESeekStart);
-            ret = DoPopulateAndCreateLinkFontsL(tfile, startTok, stopTok);            
-            }
-        }
 
     
     rFile.Close();
@@ -2295,8 +2210,6 @@
             KFeatureIdChinesePrcFonts);
     TBool fHiResFonts = FeatureManager::FeatureSupported(
             KFeatureIdChineseFontsHires);
-    TBool fAdditionalFonts = FeatureManager::FeatureSupported(
-            KFeatureIdFfAdditionalFonts);
 
     
     TBool ret = EFalse;
@@ -2308,14 +2221,6 @@
         if(fTCHKFonts)
            ref +=KAknFontStylesSupported;
         }
-    if( (EAknAllLinkedFonts == aFonttype) || (EAknContentLinkedFonts == aFonttype))
-        {
-        if(fAdditionalFonts)
-            {
-            if((!fSCFonts) && (!fTCHKFonts) &&(!fHiResFonts))
-                ref +=KAknAdditionalBrowserFonts;
-            }
-        }
     for (TInt i = 0; i < noOfTypefaces; i++)
         {
         TTypefaceSupport typefaceInfo;
@@ -2363,27 +2268,7 @@
                 }
             }
         }
-        if( (EAknAllLinkedFonts == aFonttype) || (EAknContentLinkedFonts == aFonttype))
-            {
-           if(fAdditionalFonts)
-               {
-               if( (!fSCFonts) && (!fTCHKFonts) && (!fHiResFonts))
-                   {
-                   if (typefaceInfo.iTypeface.iName.Compare(KS60LATAMTREG)==0||
-                       typefaceInfo.iTypeface.iName.Compare(KS60LATAMTBLD)==0||
-                       typefaceInfo.iTypeface.iName.Compare(KS60LATTHOREG)==0||
-                       typefaceInfo.iTypeface.iName.Compare(KS60LATTHOBLD)==0||
-                       typefaceInfo.iTypeface.iName.Compare(KS60LATCUMREG)==0||
-                       typefaceInfo.iTypeface.iName.Compare(KS60LATCUMBLD)==0)
-                       {
-                       files++;
-                       }
-                   }
-               }
-            }
-               
-             
-        }
+      }
     if (ref == files)
         ret = ETrue;
     return ret;