Esempio n. 1
0
int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind)
{
	int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset);
	if (nFontIndex >= 0) return nFontIndex;

//	nFontIndex = FindFont("", nCharset);
//	if (nFontIndex >= 0) return nFontIndex;

	CFX_ByteString sAlias;
	CPDF_Font* pFont = NULL;

	if (bFind)
		pFont = FindFontSameCharset(sAlias, nCharset);

	if (!pFont)
	{
		CFX_ByteString sTemp = sFontName;
		pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);

		/*
		if (FindFont(sAlias))
		{
			sAlias = EncodeFontAlias(sTemp, nCharset);
		}
		else
		*/
		{
			sAlias = EncodeFontAlias(sTemp, nCharset);
		}
	}

	AddedFont(pFont, sAlias);

	return AddFontData(pFont, sAlias, nCharset);
}
Esempio n. 2
0
int32_t CPWL_FontMap::GetPWLFontIndex(FX_WORD word, int32_t nCharset)
{
	int32_t nFind = -1;

	for (int32_t i=0,sz=m_aData.GetSize(); i<sz; i++)
	{
		if (CPWL_FontMap_Data* pData = m_aData.GetAt(i))
		{
			if (pData->nCharset == nCharset)
			{
				nFind = i;
				break;
			}
		}
	}

	CPDF_Font* pNewFont = GetPDFFont(nFind);

	if (!pNewFont) return -1;

	/*
	if (CPDF_Font* pFont = GetPDFFont(nFind))
	{
		PWLFont.AddWordToFontDict(pFontDict, word);
	}
	*/

	CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset);
	AddedFont(pNewFont, sAlias);

	return AddFontData(pNewFont, sAlias, nCharset);
}
Esempio n. 3
0
FX_INT32 CPWL_FontMap::GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset)
{
	FX_INT32 nFind = -1;

	for (FX_INT32 i=0,sz=m_aData.GetSize(); i<sz; i++)
	{
		if (CPWL_FontMap_Data* pData = m_aData.GetAt(i))
		{
			if (pData->nCharset == nCharset)
			{
				nFind = i;
				break;
			}
		}
	}

	CPDF_Font* pNewFont = GetPDFFont(nFind);

	if (!pNewFont) return -1;

	/*
	if (CPDF_Font* pFont = GetPDFFont(nFind))
	{
		PWLFont.AddWordToFontDict(pFontDict, word);
	}
	*/

#ifdef FOXIT_CHROME_BUILD
  CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset);
#else
	CFX_ByteString sAlias = EncodeFontAlias("Arial_Foxit", nCharset);
#endif
	AddedFont(pNewFont, sAlias);

	return AddFontData(pNewFont, sAlias, nCharset);
}
Esempio n. 4
0
CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName, int32_t nCharset)
{
	CFX_ByteString sPostfix;
	sPostfix.Format("_%02X", nCharset);
	return EncodeFontAlias(sFontName) + sPostfix;
}