Patch level : nopatch

Files correlati     : librerie
Ricompilazione Demo : [ ]
Commento            :
Migliorato calcolo dimensioni caratteri


git-svn-id: svn://10.65.10.50/trunk@9670 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2001-05-07 13:26:46 +00:00
parent c096a02061
commit 37b244b135
5 changed files with 10 additions and 6 deletions

View File

@ -449,6 +449,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
WINDOW win = xvt_win_create(wt, &r, (char*)caption, NULL, parent, wsf,
EM_ALL, (EVENT_HANDLER)xi_event, (long)msk);
CHECK(win, "Can't create an XVT window for an interface");
xvt_set_font(win, NULL, 0, 0);
set_default_palette(win);
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &r, (char*)caption, (long)msk);

View File

@ -206,7 +206,6 @@ real& real::round (
// @flag <gt> 0 | Arrotonda al decimale
// @flag = 0 | Arrotonda all'intero
// @flag <lt> 0 | Arrotonda al valore passato (es. -3 arrotonda alle mille)
<<<<<<< real.cpp
{
if (abs(prec) < 20)
{

View File

@ -778,7 +778,7 @@ TPoint TWindow::size() const
xvt_vobj_get_client_rect(win() ? win() : TASK_WIN, &r);
// return TPoint(r.right / CHARX, r.bottom / CHARY);
TPoint pnt;
pnt.x = int(128L * r.right / char2pixel(128));
pnt.x = int(80L * r.right / char2pixel(80));
pnt.y = r.bottom / CHARY;
return pnt;
}
@ -1014,13 +1014,14 @@ void TWindow::set_font(
int TWindow::char2pixel(int len) const
{
const int quantem = 80;
if (_base_char_width == 0L)
{
const TString emme(128, 'm');
const TString emme(quantem, 'M');
long& bcw = (long&)_base_char_width;
bcw = xvt_dwin_get_text_width(win(), (char*)(const char*)emme, 128);
bcw = xvt_dwin_get_text_width(win(), (char*)(const char*)emme, quantem);
}
const int pix = int(len * _base_char_width / 128L);
const int pix = int(len * _base_char_width / quantem);
return pix;
}

View File

@ -318,7 +318,7 @@ public:
// @cmember Sceglie il pennello da utilizzare nella finestra (vedi <mf TWindow::set_pen>)
void set_brush(COLOR color, PAT_STYLE = PAT_SOLID);
// @cmember Sceglie il font da utilizzare nella finestra
void set_font(const char* family = XVT_FFN_FIXED, int style = 0, int dim = 0);
void set_font(const char* family = NULL, int style = 0, int dim = 0);
// @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
virtual PNT log2dev(long x, long y) const;

View File

@ -518,6 +518,9 @@ WINDOW xvt_create_window(
flags,
EM_ALL, eh,
app_data);
// Utile per migliorare il calcolo delle dimensioni dei caratteri
xvt_dwin_set_font(win, xvt_default_font());
CHECK(win, "Can't create a window: XVT error");
return win;