Fix for bug 547
Reduce length of wchar_t strings to the minimum required for conversion Check if Bold or Italic is given in the font name, set corresponding variable
This commit is contained in:
parent
897d4c598b
commit
c9a19c7569
|
|
@ -1079,10 +1079,10 @@ int WIN_Text(const char *text, int x, int y, int angle)
|
|||
lfw.lfEscapement = angle * 10;
|
||||
lfw.lfOrientation = angle * 10;
|
||||
lfw.lfWeight = 500;
|
||||
lfw.lfItalic = 0;
|
||||
lfw.lfItalic = FALSE;
|
||||
lfw.lfUnderline = 0;
|
||||
lfw.lfStrikeOut = 0;
|
||||
lfw.lfCharSet = 0;
|
||||
lfw.lfCharSet = DEFAULT_CHARSET;
|
||||
lfw.lfOutPrecision = 0;
|
||||
lfw.lfClipPrecision = 0;
|
||||
lfw.lfQuality = 0;
|
||||
|
|
@ -1096,6 +1096,10 @@ int WIN_Text(const char *text, int x, int y, int angle)
|
|||
wchar_t wface[32];
|
||||
swprintf(wface, 32, L"%S", facename);
|
||||
(void)lstrcpyW(lfw.lfFaceName, wface);
|
||||
if (strstr(facename, "Bold"))
|
||||
lfw.lfWeight = 700;
|
||||
if (strstr(facename, "Italic"))
|
||||
lfw.lfItalic = TRUE;
|
||||
}
|
||||
if (!cp_getvar("wfont_size", CP_NUM, &(lfw.lfHeight), 0)) {
|
||||
lfw.lfHeight = 18;
|
||||
|
|
@ -1113,8 +1117,9 @@ int WIN_Text(const char *text, int x, int y, int angle)
|
|||
#ifdef EXT_ASC
|
||||
TextOut(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, (int)strlen(text));
|
||||
#else
|
||||
const int n_byte_wide = 2 * (int) strlen(text) + 1;
|
||||
const int n_byte_wide = (int) strlen(text);
|
||||
wchar_t * const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||
/* wtext needs not to be NULL-terminated */
|
||||
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, n_byte_wide);
|
||||
TextOutW(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight,
|
||||
wtext, n_byte_wide);
|
||||
|
|
|
|||
|
|
@ -305,7 +305,8 @@ int WPRINT_NewViewport(GRAPH * graph)
|
|||
TextOut(PrinterDC, PrinterWidth - graph->fontwidth, -1*yoffset, graph->plotname,
|
||||
(int)strlen(graph->plotname));
|
||||
#else
|
||||
const int n_byte_wide = 2 * (int) strlen(graph->plotname) + 1;
|
||||
/* wtext needs not to be NULL-terminated */
|
||||
const int n_byte_wide = (int) strlen(graph->plotname);
|
||||
wchar_t * const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||
MultiByteToWideChar(CP_UTF8, 0, graph->plotname, -1, wtext,
|
||||
n_byte_wide);
|
||||
|
|
@ -458,7 +459,8 @@ int WPRINT_Text(char * text, int x, int y, int degrees)
|
|||
#ifdef EXT_ASC
|
||||
TextOut(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight, text, (int)strlen(text));
|
||||
#else
|
||||
const int n_byte_wide = 2 * (int) strlen(text) + 1;
|
||||
/* wtext needs not to be NULL-terminated */
|
||||
const int n_byte_wide = (int) strlen(text);
|
||||
wchar_t * const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, n_byte_wide);
|
||||
TextOutW(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight,
|
||||
|
|
|
|||
Loading…
Reference in New Issue