Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 8
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 );
- context
- A pointer to the font context to use, returned by PfAttachCx() or PfAttachDllCx().
- description
- A foundry face, such as Swis721 BT or
PrimaSans BT.
- flags
- Flags that identify the requested font type. The following
can be ORed together:
- PF_STYLE_BOLD
- PF_STYLE_ITALIC
- PF_STYLE_ANTIALIAS
- PF_STYLE_ULINE
- PF_STYLE_DULINE
- pixel_height
- The height in pixels that the ascender and descender of the resultant
font must fit within.
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.
- A FontID
- Success
- NULL
- Failure (errno is
set).
- ESRCH
- Unable to match a point size to the provided pixel height.
#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
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 178
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pf/pfconvertpixelstopointsizecx.html on line 178