|
发表于 2007-2-28 18:41:18
|
显示全部楼层
你是问这支Function吗?
PixcomFontEngine.c (plutommi\mmi\miscframework\miscframeworksrc) 168285 2007-1-29
/**************************************************************
FUNCTION NAME : GetFontdata()
PURPOSE : To get the font information.
INPUT PARAMETERS : U32 Ch, stFontAttribute Font, U8 *CharData
OUTPUT PARAMETERS : nil
RETURNS : UNIT32
REMARKS : This is used to get the font information
**************************************************************/
#ifdef __MMI_HINDI_ALG__
static U32 GetFontdata(U32 Ch, stFontAttribute Font, U8 **ppCharData, U16 *pnWidth, U16 *pnDWidth, U16 *pnHeight)
#else
static U32 GetFontdata(U32 Ch, stFontAttribute Font, U8 **ppCharData, U16 *pnWidth, U16 *pnHeight)
#endif
{
U8 count;
S32 NumChar = 0;
S32 index = -1;
S32 nFontIndex = -1;
U32 nIndexInList;
U32 nBase;
U32 nHashKey = 0;
CharHashTable *charHashTable;
#ifdef __MMI_HINDI_ALG__
sCustFontData *CurrentFont = gpCurrentFont;
*pnDWidth = 0;
#endif /* __MMI_HINDI_ALG__ */
if (Ch & 0xFF00)
{
charHashTable = charHashTableOthers;
nHashKey = Ch & OTHERS_CHAR_HT_MASK;
}
else
{
charHashTable = charHashTableLatin;
nHashKey = Ch & LATIN_CHAR_HT_MASK;
}
if (charHashTable[nHashKey].unicode == Ch && charHashTable[nHashKey].gnCurrentFont == gnCurrentFont)
{
*ppCharData = charHashTable[nHashKey].CharData;
*pnWidth = charHashTable[nHashKey].Width;
*pnHeight = charHashTable[nHashKey].Height;
#ifdef __MMI_HINDI_ALG__
*pnDWidth = charHashTable[nHashKey].DWidth;
#endif
return charHashTable[nHashKey].NumChar;
}
charHashTable[nHashKey].unicode = Ch;
GetLangIndex(&count, &nFontIndex, &index, Ch, &nBase);
charHashTable[nHashKey].count = count;
charHashTable[nHashKey].gnCurrentFont = gnCurrentFont;
charHashTable[nHashKey].index = index;
if (index > -1)
{
/* Comments : No error handling is being done if some characters come that is not
currently supported then nothing can be displayed */
SetFontValues(gnCurrentFont, count);
charHashTable[nHashKey].Width = *pnWidth = gpCurrentFont->nWidth;
charHashTable[nHashKey].Height = *pnHeight = gpCurrentFont->nHeight;
if (gpCurrentFont->nEquiDistant)
{
charHashTable[nHashKey].NumChar = NumChar = gpCurrentFont->nCharBytes;
nIndexInList = index + (NumChar * (Ch - nBase));
charHashTable[nHashKey].CharData = *ppCharData = (gpCurrentFont->pDataArray + nIndexInList);
}
else
{
nIndexInList = index + (Ch - nBase);
charHashTable[nHashKey].Width = *pnWidth = gpCurrentFont->pWidthArray[nIndexInList];
charHashTable[nHashKey].NumChar = NumChar =
(gpCurrentFont->pOffsetArray[nIndexInList + 1] - gpCurrentFont->pOffsetArray[nIndexInList]);
charHashTable[nHashKey].CharData = *ppCharData =
(gpCurrentFont->pDataArray + gpCurrentFont->pOffsetArray[nIndexInList]);
}
#ifdef __MMI_HINDI_ALG__
if (gpCurrentFont->pDWidthArray)
charHashTable[nHashKey].DWidth = *pnDWidth = gpCurrentFont->pDWidthArray[nIndexInList];
gpCurrentFont = CurrentFont;
#endif /* __MMI_HINDI_ALG__ */
return NumChar;
}
else
{
/* MTK Add Steven 2005.06.03 */
#if defined(__MMI_ZI__)
index = SearchInZiExtraFont(Ch, &nBase);
#else
index = SearchInPropFont(Ch, &nBase);
#endif
if (index == -1)
{
#if defined(__MMI_ZI__)
index = SearchInPropFont(Ch, &nBase);
if (index == -1)
{
#endif /* defined(__MMI_ZI__) */
Ch = 65515; /* 0x4E01;//0x000F; */
index = SearchInPropFont(Ch, &nBase);
if (index == -1)
{
#ifdef __MMI_HINDI_ALG__
gpCurrentFont = CurrentFont;
#endif
return NumChar;
}
#if defined(__MMI_ZI__)
}
charHashTable[nHashKey].Height = *pnHeight = gMTKProprietaryFont.nHeight;
nIndexInList = index + (Ch - nBase);
charHashTable[nHashKey].Width = *pnWidth = gMTKProprietaryFont.pWidthArray[nIndexInList];
charHashTable[nHashKey].NumChar = NumChar =
(gMTKProprietaryFont.pOffsetArray[nIndexInList + 1] - gMTKProprietaryFont.pOffsetArray[nIndexInList]);
charHashTable[nHashKey].CharData = *ppCharData =
(gMTKProprietaryFont.pDataArray + gMTKProprietaryFont.pOffsetArray[nIndexInList]);
goto label_out;
#endif /* defined(__MMI_ZI__) */
}
#if defined(__MMI_ZI__)
charHashTable[nHashKey].Height = *pnHeight = gZiExtraCharacter.nHeight;
nIndexInList = index + (Ch - nBase);
charHashTable[nHashKey].Width = *pnWidth = gZiExtraCharacter.pWidthArray[nIndexInList];
charHashTable[nHashKey].NumChar = NumChar =
(gZiExtraCharacter.pOffsetArray[nIndexInList + 1] - gZiExtraCharacter.pOffsetArray[nIndexInList]);
charHashTable[nHashKey].CharData = *ppCharData =
(gZiExtraCharacter.pDataArray + gZiExtraCharacter.pOffsetArray[nIndexInList]);
label_out:;
#else /* defined(__MMI_ZI__) */
charHashTable[nHashKey].Height = *pnHeight = gMTKProprietaryFont.nHeight;
nIndexInList = index + (Ch - nBase);
charHashTable[nHashKey].Width = *pnWidth = gMTKProprietaryFont.pWidthArray[nIndexInList];
charHashTable[nHashKey].NumChar = NumChar =
(gMTKProprietaryFont.pOffsetArray[nIndexInList + 1] - gMTKProprietaryFont.pOffsetArray[nIndexInList]);
charHashTable[nHashKey].CharData = *ppCharData =
(gMTKProprietaryFont.pDataArray + gMTKProprietaryFont.pOffsetArray[nIndexInList]);
#endif /* defined(__MMI_ZI__) */
/* MTK End */
}
#ifdef __MMI_HINDI_ALG__
gpCurrentFont = CurrentFont;
#endif
return NumChar;
}
上面是06B W07.04 版中该函数的实现 |
|