fontsupport/fontprovider/Src/FontProvider.cpp
changeset 1 ba33815114d6
parent 0 05e9090e2422
child 2 abcbdabaa4c5
equal deleted inserted replaced
0:05e9090e2422 1:ba33815114d6
    98 _LIT(KS60TCHKHRSANSRLF, "S60TCHKHRSANSRLF");
    98 _LIT(KS60TCHKHRSANSRLF, "S60TCHKHRSANSRLF");
    99 _LIT(KS60TCHKHRSANSSBLF, "S60TCHKHRSANSSBLF");
    99 _LIT(KS60TCHKHRSANSSBLF, "S60TCHKHRSANSSBLF");
   100 _LIT(KS60TCHKHRSANSTTLSMBLDLF, "S60TCHKHRSANSTTLSMBLDLF");
   100 _LIT(KS60TCHKHRSANSTTLSMBLDLF, "S60TCHKHRSANSTTLSMBLDLF");
   101 //end
   101 //end
   102 
   102 
       
   103 //browser link fonts start
       
   104 //Western Content Linked fonts
       
   105 _LIT(KS60LATAMTREG, "S60LATAMTREG");
       
   106 _LIT(KS60LATAMTBLD, "S60LATAMTBLD");
       
   107 _LIT(KS60LATTHOREG, "S60LATTHOREG");
       
   108 _LIT(KS60LATTHOBLD, "S60LATTHOBLD");
       
   109 _LIT(KS60LATCUMREG, "S60LATCUMREG");
       
   110 _LIT(KS60LATCUMBLD, "S60LATCUMBLD");
       
   111 //browser link fonts stop
   103 
   112 
   104 // Texts for measuring maximum ascents and descents:
   113 // Texts for measuring maximum ascents and descents:
   105 _LIT(KWesternFontMaxExtentText, "\x00C1\x00C7" );
   114 _LIT(KWesternFontMaxExtentText, "\x00C1\x00C7" );
   106 
   115 
   107 // Language support map
   116 // Language support map
   124 #define ELanguageSupportKorean                      0x00100000
   133 #define ELanguageSupportKorean                      0x00100000
   125 #define ELanguageSupportHangul                      0x00200000
   134 #define ELanguageSupportHangul                      0x00200000
   126 //chinese adaptation
   135 //chinese adaptation
   127 #define ELanguageSupportChineseFontLinking          0x00400000
   136 #define ELanguageSupportChineseFontLinking          0x00400000
   128 //end
   137 //end
       
   138 //additional browser fonts
       
   139 #define ELanguageAdditionalContentFonts             0x00800000
       
   140 //end
   129 #define ELanguageSupportDevanagari                  0x01000000
   141 #define ELanguageSupportDevanagari                  0x01000000
   130 #define ELanguageSupportS60PrivateUseArea1          0x10000000
   142 #define ELanguageSupportS60PrivateUseArea1          0x10000000
   131 
   143 
   132 // Test characters for language support
   144 // Test characters for language support
   133 // Latin uppercase A
   145 // Latin uppercase A
   214 #define EChineseLangsTaiwanHKHiResLF     ( EChineseLangs \
   226 #define EChineseLangsTaiwanHKHiResLF     ( EChineseLangs \
   215                                         | ELanguageSupportChineseTaiwanHK \
   227                                         | ELanguageSupportChineseTaiwanHK \
   216                                         | ELanguageSupportChineseHiRes \
   228                                         | ELanguageSupportChineseHiRes \
   217                                         | ELanguageSupportChineseFontLinking )
   229                                         | ELanguageSupportChineseFontLinking )
   218 //end                                    
   230 //end                                    
   219 
   231 //browser
       
   232 #define EElafLangsBrowserFonts ( EElafLangs \
       
   233                                    |ELanguageAdditionalContentFonts)
       
   234 //end
   220 
   235 
   221 // Wildcard value for langs (font is to be used for all languages)
   236 // Wildcard value for langs (font is to be used for all languages)
   222 #define EAnyLangs           0xffffffff
   237 #define EAnyLangs           0xffffffff
       
   238 const TInt KAknFontStylesSupported(3);
       
   239 const TInt KAknAdditionalBrowserFonts(6);
       
   240 
       
   241 enum TAknLinkedFontTypes
       
   242     {
       
   243     EAknSystemLinkedFonts,
       
   244     EAknContentLinkedFonts,
       
   245     EAknAllLinkedFonts
       
   246     };
   223 
   247 
   224 //chinese adaptation
   248 //chinese adaptation
   225 /**
   249 /**
   226 * For internal use only
   250 * For internal use only
   227 * Structure holds info about linked typeface info that needs to be created
   251 * Structure holds info about linked typeface info that needs to be created
   470 _LIT(KTimes, "times");
   494 _LIT(KTimes, "times");
   471 _LIT(KTimesNewRoman, "times new roman");
   495 _LIT(KTimesNewRoman, "times new roman");
   472 _LIT(KSerif, "serif");
   496 _LIT(KSerif, "serif");
   473 _LIT(KMonospace, "monospaced");
   497 _LIT(KMonospace, "monospaced");
   474 _LIT(KCourier, "courier");
   498 _LIT(KCourier, "courier");
       
   499 _LIT(KCourierNew, "courier new");
       
   500 _LIT(KBaskerville, "Baskerville");
       
   501 _LIT(KTrebuchet, "Trebuchet");
   475 
   502 
   476 // Group names
   503 // Group names
   477 _LIT(KS60Group, "S60Group");
   504 _LIT(KS60Group, "S60Group");
   478 
   505 //new browser fonts start
       
   506 _LIT(KArialGroup, "ArialGroup");
       
   507 _LIT(KTnrGroup, "TnrGroup");
       
   508 _LIT(KCourGroup, "CourGroup");
       
   509 //new browser fonts end
   479 // Default
   510 // Default
   480 _LIT(KDefaultGroupName, "S60Group");
   511 _LIT(KDefaultGroupName, "S60Group");
   481 
   512 
   482 /*
   513 /*
   483 * Language and typefaces combinations to use without regard to size and style
   514 * Language and typefaces combinations to use without regard to size and style
   519     { LIT_AS_DESC_PTR(KSystemOne) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   550     { LIT_AS_DESC_PTR(KSystemOne) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   520     { LIT_AS_DESC_PTR(KSansSerifHyphen) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   551     { LIT_AS_DESC_PTR(KSansSerifHyphen) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   521     { LIT_AS_DESC_PTR(KSansSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   552     { LIT_AS_DESC_PTR(KSansSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   522     { LIT_AS_DESC_PTR(KSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   553     { LIT_AS_DESC_PTR(KSerif) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   523     { LIT_AS_DESC_PTR(KMonospace) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   554     { LIT_AS_DESC_PTR(KMonospace) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, ETrue  },
   524     { LIT_AS_DESC_PTR(KArial) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   555     { LIT_AS_DESC_PTR(KTrebuchet) ,LIT_AS_DESC_PTR(KArialGroup), &languagesAndTypefaceTable, EFalse  },
       
   556     { LIT_AS_DESC_PTR(KArial) ,LIT_AS_DESC_PTR(KArialGroup), &languagesAndTypefaceTable, EFalse  },
   525     { LIT_AS_DESC_PTR(KVerdana),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   557     { LIT_AS_DESC_PTR(KVerdana),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   526     { LIT_AS_DESC_PTR(KHelvetica),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   558     { LIT_AS_DESC_PTR(KHelvetica),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   527     { LIT_AS_DESC_PTR(KGeorgia),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   559     { LIT_AS_DESC_PTR(KBaskerville),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
   528     { LIT_AS_DESC_PTR(KTimes),LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   560     { LIT_AS_DESC_PTR(KGeorgia),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
   529     { LIT_AS_DESC_PTR(KTimesNewRoman) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   561     { LIT_AS_DESC_PTR(KTimes),LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
   530     { LIT_AS_DESC_PTR(KCourier) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse  },
   562     { LIT_AS_DESC_PTR(KTimesNewRoman) ,LIT_AS_DESC_PTR(KTnrGroup), &languagesAndTypefaceTable, EFalse  },
       
   563     { LIT_AS_DESC_PTR(KCourier) ,LIT_AS_DESC_PTR(KCourGroup), &languagesAndTypefaceTable, EFalse  },
       
   564     { LIT_AS_DESC_PTR(KCourierNew) ,LIT_AS_DESC_PTR(KCourGroup), &languagesAndTypefaceTable, EFalse  },
   531     { LIT_AS_DESC_PTR(KNullDesC) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse }
   565     { LIT_AS_DESC_PTR(KNullDesC) ,LIT_AS_DESC_PTR(KS60Group), &languagesAndTypefaceTable, EFalse }
   532 };
   566 };
   533 
   567 
   534 // Product font table.
   568 // Product font table.
   535 
   569 
   646 
   680 
   647     { EAknFontCategorySecondary,    0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   681     { EAknFontCategorySecondary,    0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   648     { EAknFontCategoryPrimarySmall, 0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   682     { EAknFontCategoryPrimarySmall, 0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   649     { EAknFontCategoryPrimary,      0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   683     { EAknFontCategoryPrimary,      0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSSBLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   650     { EAknFontCategoryTitle,        0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSTTLSMBLDLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   684     { EAknFontCategoryTitle,        0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSTTLSMBLDLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
   651     { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL }
   685     { EAknFontCategoryAny,          0, EAny, EAny, EAny, EAny, ENotBold, EAntialiase, EChineseLangsTaiwanHKHiResLF, LIT_AS_DESC_PTR(KS60TCHKHRSANSRLF), LIT_AS_DESC_PTR(KS60Group), &apacVectorFontBaselineArray, NULL, NULL },
       
   686     
       
   687     //new browser fonts start
       
   688     //western tnr
       
   689     { 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) },
       
   690     { 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) },
       
   691     //western arial
       
   692     { 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) },
       
   693     { 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) },
       
   694     //western courier
       
   695     { 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)},
       
   696     { 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) }, 
       
   697         
       
   698     //new browser fonts end
   652 //end
   699 //end
   653     };
   700     };
   654 // ============================ GLOBAL FUNCTIONS ========================================
   701 // ============================ GLOBAL FUNCTIONS ========================================
   655 
   702 
   656 /**
   703 /**
   668 TInt IntializeLinkedFontL();
   715 TInt IntializeLinkedFontL();
   669 void PopulateFontFileNames(TFileText& tfile, RPointerArray<SLinkedFontDetails>& fontfiles, const TDesC& stop);
   716 void PopulateFontFileNames(TFileText& tfile, RPointerArray<SLinkedFontDetails>& fontfiles, const TDesC& stop);
   670 TInt CreateLinkFontsL(RPointerArray<SLinkedFontDetails>& fontfiles);
   717 TInt CreateLinkFontsL(RPointerArray<SLinkedFontDetails>& fontfiles);
   671 TBool ChineseLinkedFontPresent(const TDesC& newFaceName);
   718 TBool ChineseLinkedFontPresent(const TDesC& newFaceName);
   672 TInt DoPopulateAndCreateLinkFontsL(TFileText atfile,  TDesC& astartTok, TDesC& astopTok);
   719 TInt DoPopulateAndCreateLinkFontsL(TFileText atfile,  TDesC& astartTok, TDesC& astopTok);
   673 TBool LinkTypefacesInstalled();
   720 TBool LinkTypefacesInstalled(TAknLinkedFontTypes aFonttype = EAknAllLinkedFonts);
   674 //end
   721 //end
   675 LOCAL_C void Panic(TAknFontProviderPanicCodes aPanic)
   722 LOCAL_C void Panic(TAknFontProviderPanicCodes aPanic)
   676     {
   723     {
   677     _LIT( KFontProviderCategory, "Font Provider" );
   724     _LIT( KFontProviderCategory, "Font Provider" );
   678     User::Panic( KFontProviderCategory, aPanic );
   725     User::Panic( KFontProviderCategory, aPanic );
   717     TBool fChLinkedFonts = EFalse;
   764     TBool fChLinkedFonts = EFalse;
   718     //handling error here
   765     //handling error here
   719     //fontlinking unsuccessful, handle with normal font files as earlier
   766     //fontlinking unsuccessful, handle with normal font files as earlier
   720     if(fChLinkFlag)
   767     if(fChLinkFlag)
   721         {
   768         {
   722       if(!LinkTypefacesInstalled())
   769       if(!LinkTypefacesInstalled(EAknSystemLinkedFonts))
   723         fChLinkedFonts = EFalse;
   770         fChLinkedFonts = EFalse;
   724     else
   771     else
   725         fChLinkedFonts = ETrue;
   772         fChLinkedFonts = ETrue;
   726         }
   773         }
   727     //end
   774     //end
  1084 * This returns true if the typeface is in the list of typefaces that the system says are available
  1131 * This returns true if the typeface is in the list of typefaces that the system says are available
  1085 * It may leave.
  1132 * It may leave.
  1086 */
  1133 */
  1087 LOCAL_C TBool TypefaceAvailableL( 
  1134 LOCAL_C TBool TypefaceAvailableL( 
  1088     CGraphicsDevice& aDevice, 
  1135     CGraphicsDevice& aDevice, 
  1089     const TTypeface& aTypeface )
  1136     const TTypeface& aTypeface,
       
  1137     TInt aTypefaceType =EGulNoSymbolFonts )
  1090     {
  1138     {
  1091     TBool found(EFalse);
  1139     TBool found(EFalse);
  1092 
  1140 
  1093     CDesCArray* array = new(ELeave) CDesCArrayFlat( 6 );
  1141     CDesCArray* array = new(ELeave) CDesCArrayFlat( 6 );
  1094     CleanupStack::PushL( array );
  1142     CleanupStack::PushL( array );
  1095 
  1143 
  1096     FontUtils::GetAvailableFontsL(aDevice, *array, EGulNoSymbolFonts);
  1144     FontUtils::GetAvailableFontsL(aDevice, *array, aTypefaceType);
  1097     for ( TInt i = 0; i < array->Count(); i++ )
  1145     for ( TInt i = 0; i < array->Count(); i++ )
  1098         {       
  1146         {       
  1099         TPtrC fontName((*array)[i]);
  1147         TPtrC fontName((*array)[i]);
  1100 
  1148 
  1101         if ( fontName.MatchF(aTypeface.iName) == 0 )
  1149         if ( fontName.MatchF(aTypeface.iName) == 0 )
  1188     if ( aMetrics.Posture() == EPostureItalic )
  1236     if ( aMetrics.Posture() == EPostureItalic )
  1189         aFontSpec.iFontStyle.SetPosture(EPostureItalic);
  1237         aFontSpec.iFontStyle.SetPosture(EPostureItalic);
  1190     
  1238     
  1191     // Ensure proportionality flag is set. Assumes all S60 fonts are proportional
  1239     // Ensure proportionality flag is set. Assumes all S60 fonts are proportional
  1192     aFontSpec.iTypeface.SetIsProportional(ETrue);    
  1240     aFontSpec.iTypeface.SetIsProportional(ETrue);    
       
  1241     
       
  1242     TInt reqLangs = FontProviderRequiredLangs();
       
  1243     if((reqLangs == EChineseLangsPRC) || (reqLangs ==EChineseLangsTaiwanHK)|| 
       
  1244        (reqLangs ==EChineseLangsPRCLF) ||(reqLangs ==EChineseLangsTaiwanHKLF))
       
  1245         {
       
  1246         if((aFontSpec.iHeight > 21) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
       
  1247             aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
       
  1248         //stroke font files used, not to use bold
       
  1249         aFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal );
       
  1250         }
       
  1251     else if(reqLangs == EKoreanLangs)
       
  1252         {
       
  1253         if((aFontSpec.iHeight > 17) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
       
  1254             aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);        
       
  1255         }
       
  1256     else if((aFontSpec.iHeight > 16) && ( EAntiAliasedGlyphBitmap != aFontSpec.iFontStyle.BitmapType()))
       
  1257         aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
  1193     }
  1258     }
  1194 
  1259 
  1195 LOCAL_C TBool HasRequiredLanguages( 
  1260 LOCAL_C TBool HasRequiredLanguages( 
  1196     TUint aRequiredLanguages, 
  1261     TUint aRequiredLanguages, 
  1197     CGraphicsDevice* /*aDevice*/, 
  1262     CGraphicsDevice* /*aDevice*/, 
  1338         aFoundIndex = FindGroupAliasInTable( 
  1403         aFoundIndex = FindGroupAliasInTable( 
  1339             groupTypeface, aMetrics, aRequiredLanguages, aSizeInPixels, aNeedsExactMatch, aFellBack);
  1404             groupTypeface, aMetrics, aRequiredLanguages, aSizeInPixels, aNeedsExactMatch, aFellBack);
  1340         }
  1405         }
  1341 
  1406 
  1342     TBool specIsSetUp(EFalse);
  1407     TBool specIsSetUp(EFalse);
  1343 
  1408     
  1344     if ( aFoundIndex == KErrNotFound)
  1409 	//new browser fonts start
       
  1410     //checking whether the typeface is installed
       
  1411     TInt numberOfRows = sizeof( productFontTable )/ sizeof( SAknProductFontTableLine );
       
  1412     SAknProductFontTableLine line = productFontTable[aFoundIndex];
       
  1413     TTypeface pftTypeface;
       
  1414     TBool available(ETrue);
       
  1415     if(aFoundIndex>=0 && aFoundIndex<numberOfRows)
       
  1416         {
       
  1417     pftTypeface.iName = line.iTypefaceName->Left((KMaxTypefaceNameLength));
       
  1418     TRAP_IGNORE( available = TypefaceAvailableL( *aDevice, pftTypeface,EGulAllFonts ) );    
       
  1419         }
       
  1420     //end
       
  1421     if ( (aFoundIndex == KErrNotFound) || ((TInt)EFalse == available))
  1345         {
  1422         {
  1346         // Note that because the alias table has language matching, the direct typeface name should be 
  1423         // Note that because the alias table has language matching, the direct typeface name should be 
  1347         // appropriate at least for language.
  1424         // appropriate at least for language.
  1348         if ( haveDirectTypeface )
  1425         if ( haveDirectTypeface )
  1349             {
  1426             {
  1798 EXPORT_C void AknFontProvider::InitializeSystemL ( const CEikonEnv& aEnv )
  1875 EXPORT_C void AknFontProvider::InitializeSystemL ( const CEikonEnv& aEnv )
  1799     {
  1876     {
  1800     //chinese adaptation
  1877     //chinese adaptation
  1801     TBool fChLinkedFonts = FeatureManager::FeatureSupported(KFeatureIdFfLinkedFontsChinese);
  1878     TBool fChLinkedFonts = FeatureManager::FeatureSupported(KFeatureIdFfLinkedFontsChinese);
  1802     TBool fChinese = FeatureManager::FeatureSupported(KFeatureIdChinese);
  1879     TBool fChinese = FeatureManager::FeatureSupported(KFeatureIdChinese);
  1803     if(fChinese && fChLinkedFonts)
  1880     TBool fAdditionalFonts = FeatureManager::FeatureSupported(KFeatureIdFfAdditionalFonts);
       
  1881     if((fChinese && fChLinkedFonts) || fAdditionalFonts)
  1804       {
  1882       {
  1805       //attempt to create linked font only once
  1883       //attempt to create linked font only once
  1806       if(!LinkTypefacesInstalled())
  1884       if(!LinkTypefacesInstalled())
  1807 	    {
  1885 	    {
  1808 	     //TRAP call necessary
  1886 	     TRAP_IGNORE(IntializeLinkedFontL());
  1809 	     //not need to handle return value, hanled by LinkTypefacesInstalled()
       
  1810 	     TRAPD(errRet,IntializeLinkedFontL());
       
  1811       	}    	  
  1887       	}    	  
  1812       }
  1888       }
  1813     //end       
  1889     //end       
  1814     // This determines which languages are required
  1890     // This determines which languages are required
  1815     TUint langs = FontProviderRequiredLangs();
  1891     TUint langs = FontProviderRequiredLangs();
  2110     _LIT(KTCHKStop, "[TCHK_LINK_STOP]");
  2186     _LIT(KTCHKStop, "[TCHK_LINK_STOP]");
  2111     _LIT(KSCHRStart, "[SCHR_LINK_START]");
  2187     _LIT(KSCHRStart, "[SCHR_LINK_START]");
  2112     _LIT(KSCHRStop, "[SCHR_LINK_STOP]");
  2188     _LIT(KSCHRStop, "[SCHR_LINK_STOP]");
  2113     _LIT(KTCHKHRStart, "[TCHKHR_LINK_START]");
  2189     _LIT(KTCHKHRStart, "[TCHKHR_LINK_START]");
  2114     _LIT(KTCHKHRStop, "[TCHKHR_LINK_STOP]");
  2190     _LIT(KTCHKHRStop, "[TCHKHR_LINK_STOP]");
       
  2191     _LIT(KWESTBROWStart, "[WESTERN_BROWSER_START]");
       
  2192     _LIT(KWESTBROWStop, "[WESTERN_BROWSER_STOP]");
  2115 
  2193 
  2116     TInt ret = KErrNone;
  2194     TInt ret = KErrNone;
  2117     RPointerArray<SLinkedFontDetails> fontfiles;
  2195     RPointerArray<SLinkedFontDetails> fontfiles;
  2118     RFs fs;
  2196     RFs fs;
  2119     RFile rFile;
  2197     RFile rFile;
  2132             KFeatureIdChineseTaiwanHkFonts);
  2210             KFeatureIdChineseTaiwanHkFonts);
  2133     TBool fSCFonts = FeatureManager::FeatureSupported(
  2211     TBool fSCFonts = FeatureManager::FeatureSupported(
  2134             KFeatureIdChinesePrcFonts);
  2212             KFeatureIdChinesePrcFonts);
  2135     TBool fHiResFonts = FeatureManager::FeatureSupported(
  2213     TBool fHiResFonts = FeatureManager::FeatureSupported(
  2136             KFeatureIdChineseFontsHires);
  2214             KFeatureIdChineseFontsHires);
       
  2215     TBool fAdditionalFonts = FeatureManager::FeatureSupported(
       
  2216             KFeatureIdFfAdditionalFonts);
       
  2217     TBool fChinese = FeatureManager::FeatureSupported(
       
  2218             KFeatureIdChinese);
  2137 
  2219 
  2138     
  2220     
  2139     if (fChLinkedFonts)
  2221     if (fChLinkedFonts)
  2140         {
  2222         {
  2141 
  2223 
  2167             tfile.Seek(ESeekStart);
  2249             tfile.Seek(ESeekStart);
  2168             ret = DoPopulateAndCreateLinkFontsL(tfile, startTok, stopTok);
  2250             ret = DoPopulateAndCreateLinkFontsL(tfile, startTok, stopTok);
  2169             }
  2251             }
  2170         
  2252         
  2171         }
  2253         }
       
  2254     if(fAdditionalFonts)
       
  2255         {
       
  2256         if((!fChinese) && (!fSCFonts) && (!fTCHKFonts) && (!fHiResFonts))//must be western variant
       
  2257             {
       
  2258             startTok.Copy(KWESTBROWStart);
       
  2259             stopTok.Copy(KWESTBROWStop);
       
  2260             tfile.Seek(ESeekStart);
       
  2261             ret = DoPopulateAndCreateLinkFontsL(tfile, startTok, stopTok);            
       
  2262             }
       
  2263         }
  2172 
  2264 
  2173     
  2265     
  2174     rFile.Close();
  2266     rFile.Close();
  2175     fs.Close();
  2267     fs.Close();
  2176     return ret;
  2268     return ret;
  2191             }
  2283             }
  2192         }
  2284         }
  2193     fontfiles.Close();
  2285     fontfiles.Close();
  2194     return ret;
  2286     return ret;
  2195     }
  2287     }
  2196 TBool LinkTypefacesInstalled()
  2288 TBool LinkTypefacesInstalled(TAknLinkedFontTypes aFonttype)
  2197     {
  2289     {
  2198     CWsScreenDevice * screenDevice = CCoeEnv::Static()->ScreenDevice();
  2290     CWsScreenDevice * screenDevice = CCoeEnv::Static()->ScreenDevice();
  2199     TInt noOfTypefaces = screenDevice->NumTypefaces();
  2291     TInt noOfTypefaces = screenDevice->NumTypefaces();
  2200     TBool fTCHKFonts = FeatureManager::FeatureSupported(
  2292     TBool fTCHKFonts = FeatureManager::FeatureSupported(
  2201             KFeatureIdChineseTaiwanHkFonts);
  2293             KFeatureIdChineseTaiwanHkFonts);
  2202     TBool fSCFonts = FeatureManager::FeatureSupported(
  2294     TBool fSCFonts = FeatureManager::FeatureSupported(
  2203             KFeatureIdChinesePrcFonts);
  2295             KFeatureIdChinesePrcFonts);
  2204     TBool fHiResFonts = FeatureManager::FeatureSupported(
  2296     TBool fHiResFonts = FeatureManager::FeatureSupported(
  2205             KFeatureIdChineseFontsHires);
  2297             KFeatureIdChineseFontsHires);
       
  2298     TBool fAdditionalFonts = FeatureManager::FeatureSupported(
       
  2299             KFeatureIdFfAdditionalFonts);
  2206 
  2300 
  2207     
  2301     
  2208     TBool ret = EFalse;
  2302     TBool ret = EFalse;
  2209     TInt files = 0, ref = 0;
  2303     TInt files = 0, ref = 0;
  2210     if(fSCFonts)
  2304     if( (EAknAllLinkedFonts == aFonttype) || (EAknSystemLinkedFonts == aFonttype))
  2211         ref +=3;
  2305         {
  2212     if(fTCHKFonts)
  2306         if(fSCFonts)
  2213         ref +=3;
  2307            ref +=KAknFontStylesSupported;
       
  2308         if(fTCHKFonts)
       
  2309            ref +=KAknFontStylesSupported;
       
  2310         }
       
  2311     if( (EAknAllLinkedFonts == aFonttype) || (EAknContentLinkedFonts == aFonttype))
       
  2312         {
       
  2313         if(fAdditionalFonts)
       
  2314             {
       
  2315             if((!fSCFonts) && (!fTCHKFonts) &&(!fHiResFonts))
       
  2316                 ref +=KAknAdditionalBrowserFonts;
       
  2317             }
       
  2318         }
  2214     for (TInt i = 0; i < noOfTypefaces; i++)
  2319     for (TInt i = 0; i < noOfTypefaces; i++)
  2215         {
  2320         {
  2216         TTypefaceSupport typefaceInfo;
  2321         TTypefaceSupport typefaceInfo;
  2217         screenDevice->TypefaceSupport(typefaceInfo, i);
  2322         screenDevice->TypefaceSupport(typefaceInfo, i);
       
  2323         if( (EAknAllLinkedFonts == aFonttype) || (EAknSystemLinkedFonts == aFonttype))
       
  2324             {
  2218         if (fSCFonts && fHiResFonts)
  2325         if (fSCFonts && fHiResFonts)
  2219             {
  2326             {
  2220             if (typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSRLF)==0||
  2327             if (typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSRLF)==0||
  2221                 typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSSBLF)==0||
  2328                 typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSSBLF)==0||
  2222                 typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSTTLSMBLDLF)==0)
  2329                 typefaceInfo.iTypeface.iName.Compare(KS60SCHRSANSTTLSMBLDLF)==0)
  2254                 {
  2361                 {
  2255                 files++;
  2362                 files++;
  2256                 }
  2363                 }
  2257             }
  2364             }
  2258         }
  2365         }
       
  2366         if( (EAknAllLinkedFonts == aFonttype) || (EAknContentLinkedFonts == aFonttype))
       
  2367             {
       
  2368            if(fAdditionalFonts)
       
  2369                {
       
  2370                if( (!fSCFonts) && (!fTCHKFonts) && (!fHiResFonts))
       
  2371                    {
       
  2372                    if (typefaceInfo.iTypeface.iName.Compare(KS60LATAMTREG)==0||
       
  2373                        typefaceInfo.iTypeface.iName.Compare(KS60LATAMTBLD)==0||
       
  2374                        typefaceInfo.iTypeface.iName.Compare(KS60LATTHOREG)==0||
       
  2375                        typefaceInfo.iTypeface.iName.Compare(KS60LATTHOBLD)==0||
       
  2376                        typefaceInfo.iTypeface.iName.Compare(KS60LATCUMREG)==0||
       
  2377                        typefaceInfo.iTypeface.iName.Compare(KS60LATCUMBLD)==0)
       
  2378                        {
       
  2379                        files++;
       
  2380                        }
       
  2381                    }
       
  2382                }
       
  2383             }
       
  2384                
       
  2385              
       
  2386         }
  2259     if (ref == files)
  2387     if (ref == files)
  2260         ret = ETrue;
  2388         ret = ETrue;
  2261     return ret;
  2389     return ret;
  2262     }
  2390     }
  2263  
  2391