Commit d1b09fa2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wineps: Introduce PSDRV_GET_GLYPH_NAME escape to obtain builtin glyph name from unixlib.

parent 9e95b9e6
......@@ -31,6 +31,7 @@
#include "winternl.h"
#include "psdrv.h"
#include "unixlib.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
......@@ -244,14 +245,12 @@ BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev)
BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count)
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
char name[32];
int i;
LPCSTR name;
for (i = 0; i < count; ++i)
{
name = PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->N->sz;
ExtEscape(dev->hdc, PSDRV_GET_GLYPH_NAME, sizeof(str[i]), (const char *)&str[i], sizeof(name), name);
PSDRV_WriteGlyphShow(dev, name);
}
......
......@@ -518,6 +518,34 @@ static BOOL CDECL reset_dc(PHYSDEV dev, const DEVMODEW *devmode)
return TRUE;
}
static int metrics_by_uv(const void *a, const void *b)
{
return (int)(((const AFMMETRICS *)a)->UV - ((const AFMMETRICS *)b)->UV);
}
const AFMMETRICS *uv_metrics(LONG uv, const AFM *afm)
{
const AFMMETRICS *needle;
AFMMETRICS key;
/*
* Ugly work-around for symbol fonts. Wine is sending characters which
* belong in the Unicode private use range (U+F020 - U+F0FF) as ASCII
* characters (U+0020 - U+00FF).
*/
if ((afm->Metrics->UV & 0xff00) == 0xf000 && uv < 0x100)
uv |= 0xf000;
key.UV = uv;
needle = bsearch(&key, afm->Metrics, afm->NumofMetrics, sizeof(AFMMETRICS), metrics_by_uv);
if (!needle)
{
WARN("No glyph for U+%.4X in '%s'\n", (int)uv, afm->FontName);
needle = afm->Metrics;
}
return needle;
}
static int CDECL ext_escape(PHYSDEV dev, int escape, int input_size, const void *input,
int output_size, void *output)
{
......@@ -770,6 +798,17 @@ static int CDECL ext_escape(PHYSDEV dev, int escape, int input_size, const void
case CLIP_TO_PATH:
return 1;
case PSDRV_GET_GLYPH_NAME:
{
PSDRV_PDEVICE *pdev = get_psdrv_dev(dev);
WCHAR *uv = (WCHAR *)input;
const char *name = uv_metrics(*uv, pdev->font.fontinfo.Builtin.afm)->N->sz;
lstrcpynA(output, name, output_size);
return 1;
}
default:
FIXME("Unimplemented code %d\n", escape);
return 0;
......@@ -1135,34 +1174,6 @@ static BOOL CDECL enum_fonts(PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LP
return ret;
}
static int metrics_by_uv(const void *a, const void *b)
{
return (int)(((const AFMMETRICS *)a)->UV - ((const AFMMETRICS *)b)->UV);
}
const AFMMETRICS *uv_metrics(LONG uv, const AFM *afm)
{
const AFMMETRICS *needle;
AFMMETRICS key;
/*
* Ugly work-around for symbol fonts. Wine is sending characters which
* belong in the Unicode private use range (U+F020 - U+F0FF) as ASCII
* characters (U+0020 - U+00FF).
*/
if ((afm->Metrics->UV & 0xff00) == 0xf000 && uv < 0x100)
uv |= 0xf000;
key.UV = uv;
needle = bsearch(&key, afm->Metrics, afm->NumofMetrics, sizeof(AFMMETRICS), metrics_by_uv);
if (!needle)
{
WARN("No glyph for U+%.4X in '%s'\n", (int)uv, afm->FontName);
needle = afm->Metrics;
}
return needle;
}
static BOOL CDECL get_char_width(PHYSDEV dev, UINT first, UINT count, const WCHAR *chars, INT *buffer)
{
PSDRV_PDEVICE *pdev = get_psdrv_dev(dev);
......
......@@ -19,6 +19,8 @@
#include "ntuser.h"
#include "wine/unixlib.h"
#define PSDRV_GET_GLYPH_NAME 0x10000
enum wineps_funcs
{
unix_init_dc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment