Changeset 342 for branches


Ignore:
Timestamp:
Apr 2, 2010, 12:40:15 AM (12 years ago)
Author:
dmik
Message:

branches/kmk: Use Helvetica for text input fields and set the font size to match the height of the field on resize.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/kmk/Lucide/gui/docViewer.cpp

    r341 r342  
    12831283
    12841284    positionTextField( r );
     1285
     1286    // @todo uncomment this once it returns anything useful
     1287    // int maxLen = textField->getMaximumLength( ev );
     1288    WinSendMsg( hWndText, EM_SETTEXTLIMIT, MPFROMLONG( 65520 ), NULL );
     1289
    12851290    const char *contents = textField->getContents( ev );
    12861291    WinSetWindowText( hWndText, contents );
     
    13061311                     r->yTop - r->yBottom - 6,
    13071312                     SWP_MOVE | SWP_SIZE | SWP_ZORDER );
     1313
     1314    static LONG ulDpi = 0;
     1315    if ( ulDpi == 0 ) {
     1316        // DPI is constant beteen reboots
     1317        HPS hps = WinGetScreenPS( HWND_DESKTOP );
     1318        DevQueryCaps( GpiQueryDevice( hps ), CAPS_HORIZONTAL_FONT_RES,
     1319                      1, &ulDpi );
     1320        WinReleasePS( hps );
     1321    }
     1322
     1323    LONG points = ( r->yTop - r->yBottom - 6 ) * 72 / 120 - 2;
     1324    if ( points <= 0 )
     1325        points = 1;
     1326
     1327    char font[ 32 ];
     1328    sprintf( font, "%d.Helvetica", points );
     1329    WinSetPresParam( hWndText, PP_FONTNAMESIZE, strlen( font ) + 1, font );
    13081330}
    13091331
Note: See TracChangeset for help on using the changeset viewer.