![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Convert a font ID to a font name for backwards compatibility
#include <photon/Pf.h>
char *PfConvertFontID( FontID *ptsID );
#include <font_api.h>
char* PfConvertFontIDCx( struct _Pf_ctrl * context,
FontID * ptsID,
char * szTag );
These functions convert the font ID pointed to by ptsID into a font name. This function can be used for backwards compatibility with the older font API.
![]() |
These functions don't check to see if ptsID is NULL, due to the way this routine is used. |
A version of the font identifier that the older font API can understand.
![]() |
The return type/value could change in future releases of Photon. |
PfConvertFontID(): See PfFindFont().
PfConvertFontIDCx():
/* A FontID example. Demonstrates aspects of how to process
* FontIDs and legacy font stem names.
*/
#include <font_api.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main(int argc, char const * argv[])
{ struct _Pf_ctrl * pf;
fprintf(stderr, "POINT : FontID.\n");
if((pf = PfAttachCx(NULL, 0)) != NULL)
{ FontID * id;
if((id = PfFindFontCx(pf, "TextFont", 0L, 9)) != NULL)
{ FontName tag;
if(PfConvertFontIDCx(pf, id, tag) != NULL)
{ FontName tag2;
if(PfGenerateFontNameCx(pf, "TextFont", 0L, 9, tag2) != NULL)
{ if(!strcmp(tag, tag2))
{ char const * p;
if((p = PfFontBaseStemCx(pf, id)) != NULL)
{ fprintf(stderr, "NOTE : base stem is %s.\n", p);
if((p = PfFontDescriptionCx(pf, id)) != NULL)
{ uint32_t flags, size;
fprintf(stderr, "NOTE : descriptive foundry is %s.\n", p);
flags = PfFontFlagsCx(pf, id);
fprintf(stderr, "NOTE : flags are %x.\n", flags);
size = PfFontSizeCx(pf, id);
fprintf(stderr, "NOTE : point size is %d.\n", size);
fprintf(stderr, "PASS : FontID.\n");
}
else
{ fprintf(stderr,
"NOTE : PfFontDescriptionCx failed, errno %d.\n",
errno);
fprintf(stderr, "FAIL : FontID.\n");
}
}
else
{ fprintf(stderr, "NOTE : PfFontBaseStemCx failed, errno %d.\n",
errno);
fprintf(stderr, "FAIL : FontID.\n");
}
}
else
{ fprintf(stderr, "NOTE : tags are not equivalent.\n");
fprintf(stderr, "FAIL : FontID.\n");
}
}
else
{ fprintf(stderr, "NOTE : PfGenerateFontNameCx failed, errno %d.\n",
errno);
fprintf(stderr, "FAIL : FontID.\n");
}
}
else
{ fprintf(stderr, "NOTE : PfConvertFontIDCx failed, errno %d.\n", errno);
fprintf(stderr, "FAIL : FontID.\n");
}
if(PfFreeFontCx(pf, id) == -1L)
{ fprintf(stderr, "NOTE : PfFreeFontCx failed, errno %d.\n", errno);
}
}
else
{ fprintf(stderr, "NOTE : PfFindFontCx failed to create font id, errno %d.\n",
errno);
fprintf(stderr, "FAIL : FontID.\n");
}
PfDetachCx(pf);
}
else
{ fprintf(stderr, "UNRES : Unable to attach to fontserver, errno %d.\n", errno);
fprintf(stderr, "FAIL : FontID.\n");
}
return(0);
}
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PfAttach(), PfAttachCx(), PfAttachDllCx(), PfDecomposeStemToID(), PfDecomposeStemToIDCx(), PfFindFont(), PfFindFontCx(), PfFontDescription(), PfFontDescriptionCx(), PfFontFlags(), PfFontFlagsCx(), PfFontSize(), PfFontSizeCx(), PfFreeFont(), PfFreeFontCx(), PfGenerateFontName(), PfGenerateFontNameCx()
Fonts chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |