我有一个类似的问题,我想要 postscript 名称并将字体转换为 postscript。该解决方案位于一个名为 ttf2pt1 的小库中,位于http://ttf2pt1.sourceforge.net/README.html
您需要的例程如下。该例程使用 OutlineTextMetrics 挖掘出字体的所有各种内部名称。nameFace 值是您想要的值。
short i;
short val;
long offset;
OUTLINETEXTMETRIC *otm;
UINT nSize;
UINT retVal;
char *sptr;
char *nameFamily;
char *nameFace;
char *nameStyle;
char *nameFull;
int fontType;
char otmBuffer[4096];
SelectObject(hdc, theFont);
nSize = GetOutlineTextMetrics(hdc, 0, NULL);
if(nSize){
otm = (OUTLINETEXTMETRIC *) otmBuffer;
retVal = GetOutlineTextMetrics(hdc, nSize, otm);
val = otm->otmTextMetrics.tmPitchAndFamily;
offset = (long) otm->otmpFamilyName;
sptr = &otmBuffer[offset];
nameFamily = sptr;
offset = (long) otm->otmpFaceName;
sptr = &otmBuffer[offset];
nameFace = sptr;
offset = (long) otm->otmpStyleName;
sptr = &otmBuffer[offset];
nameStyle = sptr;
offset = (long) otm->otmpFullName;
sptr = &otmBuffer[offset];
nameFull = sptr;
if(val & TMPF_TRUETYPE){
fontType = kFontTypeTrueType;
}
else{
if(val & TMPF_VECTOR){
fontType = kFontTypePostscript;
}
}
}
else{
fontType = kFontTypeUnknown;
}