static BOOL g_b_init_get_text_metrics_w;
static BOOL g_b_init_get_glyph_outline_w;
static BOOL g_b_init_get_glyph_outline_w;
+static BOOL g_b_init_get_char_width_32_w;
typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) (
HDC hdc,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2);
+typedef BOOL (WINAPI * GetCharWidth32W_Proc) (
+ HDC hdc,
+ UINT uFirstChar,
+ UINT uLastChar,
+ LPINT lpBuffer);
/* Several "wide" functions we use to support the font backends are
unavailable on Windows 9X, unless UNICOWS.DLL is installed (their
lpvBuffer, lpmat2);
}
+static DWORD WINAPI get_char_width_32_w (HDC hdc, UINT uFirstChar,
+ UINT uLastChar, LPINT lpBuffer)
+{
+ static GetCharWidth32W_Proc s_pfn_Get_Char_Width_32W = NULL;
+ HMODULE hm_unicows = NULL;
+ if (g_b_init_get_char_width_32_w == 0)
+ {
+ g_b_init_get_char_width_32_w = 1;
+ hm_unicows = w32_load_unicows_or_gdi32 ();
+ if (hm_unicows)
+ s_pfn_Get_Char_Width_32W = (GetCharWidth32W_Proc)
+ GetProcAddress (hm_unicows, "GetCharWidth32W");
+ }
+ eassert (s_pfn_Get_Char_Width_32W != NULL);
+ return s_pfn_Get_Char_Width_32W (hdc, uFirstChar, uLastChar, lpBuffer);
+}
+
static int
memq_no_quit (Lisp_Object elt, Lisp_Object list)
{
/* Free all the cached metrics. */
if (w32_font->cached_metrics)
{
+ int i;
+
for (i = 0; i < w32_font->n_cache_blocks; i++)
xfree (w32_font->cached_metrics[i]);
xfree (w32_font->cached_metrics);
= DECODE_SYSTEM (build_string (logfont.lfFaceName));
}
+ font->frame = f;
font->max_width = w32_font->metrics.tmMaxCharWidth;
/* Parts of Emacs display assume that height = ascent + descent...
so height is defined later, after ascent and descent.
font->baseline_offset = 0;
font->relative_compose = 0;
font->default_ascent = w32_font->metrics.tmAscent;
- font->font_encoder = NULL;
font->pixel_size = size;
font->driver = &w32font_driver;
/* Use format cached during list, as the information we have access to
GLYPHMETRICS gm;
MAT2 transform;
unsigned int options = GGO_METRICS;
+ INT width;
if (w32_font->glyph_idx)
options |= GGO_GLYPH_INDEX;
metrics->width = gm.gmCellIncX;
metrics->status = W32METRIC_SUCCESS;
}
+ else if (get_char_width_32_w (dc, code, code, &width) != 0)
+ {
+ metrics->lbearing = 0;
+ metrics->rbearing = width;
+ metrics->width = width;
+ metrics->status = W32METRIC_SUCCESS;
+ }
else
metrics->status = W32METRIC_FAIL;
}
g_b_init_get_outline_metrics_w = 0;
g_b_init_get_text_metrics_w = 0;
g_b_init_get_glyph_outline_w = 0;
+ g_b_init_get_char_width_32_w = 0;
}