#include "freetype/freetype.h" #include "freetype/internal/ftobjs.h" #include "freetype/internal/t1types.h" #include "freetype/ftmodule.h" #include "fthack.h" #define FACE_TYPE(face) ((face)->driver->clazz->root.module_name) static int mystrcmp(char *p, char *q) { while(*p != '\0' || *q != '\0') { if(*p != *q) return 0; p++; q++; } return 1; } static int isType1(FT_Face face) { return mystrcmp(FACE_TYPE(face), "type1"); } int FT_Face_Prefers_Names(FT_Face face) { return isType1(face); } char * FT_Face_Font_Type(FT_Face face) { /* The names "Type 1" and "TrueType" are sanctioned by XLFD, and should not be changed. For other formats, anything goes. */ if(mystrcmp(FACE_TYPE(face), "type1") == 0) return "Type 1"; else if(mystrcmp(FACE_TYPE(face), "truetype") == 0) return "TrueType"; else /* XXX */ return FACE_TYPE(face); } void * FT_Get_Type1_Table(FT_Face face, FT_Type1_Tag tag) { if(!isType1(face)) return NULL; switch(tag) { case ft_type1_info: return (void*)(&((T1_FaceRec*)face)->type1.font_info); default: return NULL; } }