Cairo: A Vector Graphics Library | ||||
---|---|---|---|---|
#define CAIRO_HAS_WIN32_FONT cairo_font_face_t* cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont); cairo_font_face_t* cairo_win32_font_face_create_for_hfont (HFONT font); cairo_font_face_t* cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font); cairo_status_t cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font, HDC hdc); void cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font); double cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font); void cairo_win32_scaled_font_get_logical_to_device (cairo_scaled_font_t *scaled_font, cairo_matrix_t *logical_to_device); void cairo_win32_scaled_font_get_device_to_logical (cairo_scaled_font_t *scaled_font, cairo_matrix_t *device_to_logical);
The Microsoft Windows font backend is primarily used to render text on Microsoft Windows systems.
#define CAIRO_HAS_WIN32_FONT 1
Defined if the Microsoft Windows font backend is available. This macro can be used to conditionally compile backend-specific code.
cairo_font_face_t* cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
Creates a new font for the Win32 font backend based on a
LOGFONT. This font can then be used with
cairo_set_font_face()
or cairo_scaled_font_create()
.
The cairo_scaled_font_t
returned from cairo_scaled_font_create()
is also for the Win32 backend
and can be used with functions such as cairo_win32_scaled_font_select_font()
.
|
A LOGFONTW structure specifying the font to use. The lfHeight, lfWidth, lfOrientation and lfEscapement fields of this structure are ignored. |
Returns : |
a newly created cairo_font_face_t. Free with
cairo_font_face_destroy() when you are done using it.
|
cairo_font_face_t* cairo_win32_font_face_create_for_hfont (HFONT font);
Creates a new font for the Win32 font backend based on a
HFONT. This font can then be used with
cairo_set_font_face()
or cairo_scaled_font_create()
.
The cairo_scaled_font_t
returned from cairo_scaled_font_create()
is also for the Win32 backend
and can be used with functions such as cairo_win32_scaled_font_select_font()
.
|
An HFONT structure specifying the font to use. |
Returns : |
a newly created cairo_font_face_t. Free with
cairo_font_face_destroy() when you are done using it.
|
cairo_font_face_t* cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font);
Creates a new font for the Win32 font backend based on a
LOGFONT. This font can then be used with
cairo_set_font_face()
or cairo_scaled_font_create()
.
The cairo_scaled_font_t
returned from cairo_scaled_font_create()
is also for the Win32 backend
and can be used with functions such as cairo_win32_scaled_font_select_font()
.
|
A LOGFONTW structure specifying the font to use. If hfont is null then the lfHeight, lfWidth, lfOrientation and lfEscapement fields of this structure are ignored. Otherwise lfWidth, lfOrientation and lfEscapement must be zero. |
|
An HFONT that can be used when the font matrix is a scale by -lfHeight and the CTM is identity. |
Returns : |
a newly created cairo_font_face_t. Free with
cairo_font_face_destroy() when you are done using it.
|
cairo_status_t cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font, HDC hdc);
Selects the font into the given device context and changes the
map mode and world transformation of the device context to match
that of the font. This function is intended for use when using
layout APIs such as Uniscribe to do text layout with the
cairo font. After finishing using the device context, you must call
cairo_win32_scaled_font_done_font()
to release any resources allocated
by this function.
See cairo_win32_scaled_font_get_metrics_factor()
for converting logical
coordinates from the device context to font space.
Normally, calls to SaveDC()
and RestoreDC()
would be made around
the use of this function to preserve the original graphics state.
|
A cairo_scaled_font_t from the Win32 font backend. Such an
object can be created with cairo_win32_scaled_font_create_for_logfontw() .
|
|
a device context |
Returns : |
CAIRO_STATUS_SUCCESS if the operation succeeded.
otherwise an error such as CAIRO_STATUS_NO_MEMORY and
the device context is unchanged.
|
void cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font);
Releases any resources allocated by cairo_win32_scaled_font_select_font()
|
A scaled font from the Win32 font backend. |
double cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font);
Gets a scale factor between logical coordinates in the coordinate
space used by cairo_win32_scaled_font_select_font()
(that is, the
coordinate system used by the Windows functions to return metrics) and
font space coordinates.
|
a scaled font from the Win32 font backend |
Returns : |
factor to multiply logical units by to get font space coordinates. |
void cairo_win32_scaled_font_get_logical_to_device (cairo_scaled_font_t *scaled_font, cairo_matrix_t *logical_to_device);
Gets the transformation mapping the logical space used by scaled_font
to device space.
|
a scaled font from the Win32 font backend |
|
matrix to return |
Since 1.4
void cairo_win32_scaled_font_get_device_to_logical (cairo_scaled_font_t *scaled_font, cairo_matrix_t *device_to_logical);
Gets the transformation mapping device space to the logical space
used by scaled_font
.
|
a scaled font from the Win32 font backend |
|
matrix to return |
Since 1.4