Exemplo n.º 1
0
EStatusCode FreeTypeFaceWrapper::GetGlyphsForUnicodeText(const ULongList& inUnicodeCharacters,UIntList& outGlyphs)
{
	if(mFace)
	{
		FT_UInt glyphIndex;
		EStatusCode status = PDFHummus::eSuccess;

		outGlyphs.clear();

		ULongList::const_iterator it = inUnicodeCharacters.begin();
		for(; it != inUnicodeCharacters.end(); ++it)
		{
      if ( mFormatParticularWrapper && mFormatParticularWrapper->HasPrivateEncoding() ) {
			  glyphIndex = mFormatParticularWrapper->GetGlyphForUnicodeChar(*it);
        // glyphIndex == 0 is allowed in some Type1 fonts with custom encoding
      }
      else
      {
        glyphIndex =  FT_Get_Char_Index(mFace,*it);
        if(0 == glyphIndex)
        {
          TRACE_LOG1("FreeTypeFaceWrapper::GetGlyphsForUnicodeText, failed to find glyph for charachter 0x%04x",*it);
          status = PDFHummus::eFailure;
        }
      }
			outGlyphs.push_back(glyphIndex);
		}

		return status;
	}
	else
		return PDFHummus::eFailure;
}
Exemplo n.º 2
0
EStatusCode FreeTypeFaceWrapper::GetGlyphsForUnicodeText(const ULongList& inUnicodeCharacters,UIntList& outGlyphs)
{
	if(mFace)
	{
		FT_UInt glyphIndex;
		EStatusCode status = PDFHummus::eSuccess;

		outGlyphs.clear();

		ULongList::const_iterator it = inUnicodeCharacters.begin();
		for(; it != inUnicodeCharacters.end() && PDFHummus::eSuccess == status; ++it)
		{
			glyphIndex = FT_Get_Char_Index(mFace,*it);
			outGlyphs.push_back(glyphIndex);
			if(0 == glyphIndex)
			{
				TRACE_LOG1("FreeTypeFaceWrapper::GetGlyphsForUnicodeText, failed to find glyph for charachter 0x%04x",*it);
				status = PDFHummus::eFailure;
			}
		}

		return status;
	}
	else
		return PDFHummus::eFailure;
}
Exemplo n.º 3
0
EStatusCode PDFUsedFont::TranslateStringToGlyphs(const std::string& inText,GlyphUnicodeMappingList& outGlyphsUnicodeMapping)
{
	UIntList glyphs;
	UnicodeString unicode;

	EStatusCode status = unicode.FromUTF8(inText);
	if(status != PDFHummus::eSuccess)
		return status;


	status = mFaceWrapper.GetGlyphsForUnicodeText(unicode.GetUnicodeList(),glyphs);

	ULongList::const_iterator itUnicode = unicode.GetUnicodeList().begin();
	UIntList::iterator itGlyphs = glyphs.begin();

	for(; itUnicode != unicode.GetUnicodeList().end(); ++itUnicode,++itGlyphs)
		outGlyphsUnicodeMapping.push_back(GlyphUnicodeMapping(*itGlyphs,*itUnicode));

	return status;
}
Exemplo n.º 4
0
EStatusCode FreeTypeFaceWrapper::GetGlyphsForUnicodeText(const ULongList& inUnicodeCharacters,UIntList& outGlyphs)
{
	if(mFace)
	{
		FT_UInt glyphIndex;
		EStatusCode status = PDFHummus::eSuccess;

		outGlyphs.clear();

		ULongList::const_iterator it = inUnicodeCharacters.begin();
		for(; it != inUnicodeCharacters.end(); ++it)
		{
			if ( mFormatParticularWrapper && mFormatParticularWrapper->HasPrivateEncoding() ) {
					glyphIndex = mFormatParticularWrapper->GetGlyphForUnicodeChar(*it);
				// glyphIndex == 0 is allowed in some Type1 fonts with custom encoding
			}
			else
			{
				FT_ULong charCode = *it;
				if (mUsePUACodes &&  charCode <= 0xff) // move charcode to pua are in case we should use pua and they are in plain ascii range
					charCode = 0xF000 | charCode;
				glyphIndex =  FT_Get_Char_Index(mFace,charCode);
				if(0 == glyphIndex)
				{
					TRACE_LOG1("FreeTypeFaceWrapper::GetGlyphsForUnicodeText, failed to find glyph for charachter 0x%04x",*it);
					status = PDFHummus::eFailure;
				}
			}
			outGlyphs.push_back(glyphIndex);
		}

		return status;
	}
	else
		return PDFHummus::eFailure;
}