| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) | 
Convert pixel height to point size
#include <font_api.h>
FontID*
PfConvertPixelsToPointSizeCx( struct _Pf_ctrl * context,
                              char const * description,
                              int flags,
                              uint32_t pixel_height );
font
This function locates a point size for the provided foundry face (description) that has an ascender and descender that fit within the provided pixel height. If the provided foundry face represents a bitmap font, then the ID for the closest point size available that fits within the pixel height is returned. You must release the returned FontID.
#include <font_api.h>
#include <stdio.h>
#define PIXEL_HEIGHT 33
int main(int argc, char *argv[])
{  struct _Pf_ctrl * pf;
   if((pf = PfAttachCx(NULL, 0)) != NULL)
   {  FontName font;
      if(PfGenerateFontNameCx(pf, "PrimaSans BT", 0, 9, font) != NULL)
      {  if(PfLoadMetricsCx(pf, font) == 0)
         {  FontID * id;
            if((id = PfConvertPixelsToPointSizeCx(pf, "PrimaSans BT", 0,
                                                  PIXEL_HEIGHT))
                != NULL)
            {  FontName font2;
               printf("Font stem %s fits in a height of %d pixels.\n",
                       PfConvertFontIDCx(pf, id, font2), PIXEL_HEIGHT);
               PfFreeFontCx(pf, id);
            }
            PfUnloadMetricsCx(pf, font);
         }
      }
      PfDetachCx(pf);
   }
   return(0);
}
Photon
| Safety: | |
|---|---|
| Cancellation point | No | 
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | Yes | 
PfAttachCx(), PfAttachDllCx().
Fonts chapter of the Photon Programmer's Guide
| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) |