calcolo dimensione font per stampa fogli libri bollati

git-svn-id: svn://10.65.10.50/trunk@4173 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1997-03-03 15:21:16 +00:00
parent 5861624bfc
commit 096c06329a

View File

@ -2204,25 +2204,30 @@ BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
// Create pint window
WINDOW win = xvt_print_create_win(printer().get_printrcd(), "Calcolo font");
// Set print font
xvt_set_font(win, fd._name, XVT_FS_NONE, fd._size);
if (win != NULL_WIN)
{
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, printer().get_printrcd(), &ph, &pw, &pvr, &phr);
TString test(fd._columns);
test.fill('M', fd._columns);
for (int size = fd._size; size > 0; size--)
{
// Set print font
xvt_set_font(win, fd._name, XVT_FS_NONE, size);
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, printer().get_printrcd(), &ph, &pw, &pvr, &phr);
TString test(fd._columns);
test.fill('M', fd._columns);
for (int size = fd._size; size > 0; size--)
{
const int w = xvt_dwin_get_text_width(win, (char*)(const char*)test, fd._columns);
if (w <= phr)
break;
}
xvt_vobj_destroy(win);
if (size > 0)
fd._size = size;
return FALSE;
const int w = xvt_dwin_get_text_width(win, (char*)(const char*)test, fd._columns);
if (w <= ph)
break;
}
if (size > 0)
fd._size = size;
xvt_vobj_destroy(win);
}
return win != NULL_WIN;
}
int TPrinter::calc_font_size(int columns) const