예제 #1
0
CAMLprim value is_postscript(value f)
{
  CAMLparam1(f);
  FT_Face face;
  PS_PrivateRec p;

  face = *(FT_Face *)Data_custom_val(f);

  CAMLreturn(Val_bool(!FT_IS_SFNT(face) &&
                      (FT_Get_PS_Font_Private(face, &p) == 0)));
};
FreeTypeType1Wrapper::FreeTypeType1Wrapper(FT_Face inFace,const std::string& inFontFilePath,const std::string& inPFMFilePath)
{
	if(FT_Get_PS_Font_Info(inFace,&mPSFontInfo) != 0)
	{
		TRACE_LOG("Unexpected failure in FreeTypeType1Wrapper::FreeTypeType1Wrapper. could not retrieve PS font info");
		mPSavailable = false; // this is obviousy an exception
	}
	else
		mPSavailable = true; 


	if(FT_Get_PS_Font_Private(inFace,&mPrivateInfo) != 0)
	{
		TRACE_LOG("Unexpected failure in FreeTypeType1Wrapper::FreeTypeType1Wrapper. could not retrieve PS private font info");
		mPSPrivateAvailable = false; // this is obviousy an exception
	}
	else
		mPSPrivateAvailable = true;
    
    T1_EncodingType encodingType;
    FT_Get_PS_Font_Value(inFace, PS_DICT_ENCODING_TYPE, 0, (void*)&encodingType, sizeof(encodingType));
    mIsCustomEncoding = encodingType == T1_ENCODING_TYPE_ARRAY;

	mPFMFileInfoRelevant = 
		(inPFMFilePath.size() != 0 && mPFMReader.Read(inPFMFilePath) != PDFHummus::eFailure);
    
    // parse type 1 input file (my own parsing), to get extra info about encoding
    if(inFontFilePath.size() != 0)
    {
        InputFile type1File;
    
        type1File.OpenFile(inFontFilePath);
        mType1File.ReadType1File(type1File.GetInputStream());
    
        type1File.CloseFile();
    }
    
    mFace = inFace;
}