Add uniscribe font getters

This commit is contained in:
Behdad Esfahbod 2011-08-10 22:08:36 +02:00
parent 01ec13a1d9
commit d6660356dd
2 changed files with 29 additions and 3 deletions

View File

@ -146,6 +146,7 @@ _hb_uniscribe_face_get_data (hb_face_t *face)
static struct hb_uniscribe_font_data_t {
HDC hdc;
LOGFONTW log_font;
HFONT hfont;
SCRIPT_CACHE script_cache;
} _hb_uniscribe_font_data_nil = {NULL, NULL, NULL};
@ -176,11 +177,10 @@ _hb_uniscribe_font_get_data (hb_font_t *font)
data->hdc = GetDC (NULL);
LOGFONTW log_font;
if (unlikely (!populate_log_font (&log_font, data->hdc, font)))
if (unlikely (!populate_log_font (&data->log_font, data->hdc, font)))
DEBUG_MSG (UNISCRIBE, font, "Font populate_log_font() failed");
else {
data->hfont = CreateFontIndirectW (&log_font);
data->hfont = CreateFontIndirectW (&data->log_font);
if (unlikely (!data->hfont))
DEBUG_MSG (UNISCRIBE, font, "Font CreateFontIndirectW() failed");
if (!SelectObject (data->hdc, data->hfont))
@ -202,6 +202,24 @@ _hb_uniscribe_font_get_data (hb_font_t *font)
return data;
}
LOGFONTW *
hb_uniscribe_font_get_logfontw (hb_font_t *font)
{
hb_uniscribe_font_data_t *font_data = _hb_uniscribe_font_get_data (font);
if (unlikely (!font_data))
return NULL;
return &font_data->log_font;
}
HFONT
hb_uniscribe_font_get_hfont (hb_font_t *font)
{
hb_uniscribe_font_data_t *font_data = _hb_uniscribe_font_get_data (font);
if (unlikely (!font_data))
return 0;
return font_data->hfont;
}
hb_bool_t
hb_uniscribe_shape (hb_font_t *font,

View File

@ -30,6 +30,8 @@
#include "hb-common.h"
#include "hb-shape.h"
#define _WIN32_WINNT 0x0500
#include <windows.h>
HB_BEGIN_DECLS
@ -41,6 +43,12 @@ hb_uniscribe_shape (hb_font_t *font,
unsigned int num_features,
const char * const *shaper_options);
LOGFONTW *
hb_uniscribe_font_get_logfontw (hb_font_t *font);
HFONT
hb_uniscribe_font_get_hfont (hb_font_t *font);
HB_END_DECLS