Annotation of mstools/samples/ttfonts/dialogs.c, revision 1.1.1.1

1.1       root        1: 
                      2: /******************************************************************************\
                      3: *       This is a part of the Microsoft Source Code Samples. 
                      4: *       Copyright (C) 1993 Microsoft Corporation.
                      5: *       All rights reserved. 
                      6: *       This source code is only intended as a supplement to 
                      7: *       Microsoft Development Tools and/or WinHelp documentation.
                      8: *       See these sources for detailed information regarding the 
                      9: *       Microsoft samples programs.
                     10: \******************************************************************************/
                     11: 
                     12: /**************************************************************************\
                     13: *  dialogs.c -- module for the two dialogs (LOGFONT & TEXTMETRIC)
                     14: *   Includes the window procedure and an initialization routine.
                     15: *  the LogFontWndProc is actually used for multiple dialogs.
                     16: \**************************************************************************/
                     17: #define UNICODE
                     18: 
                     19: #include <windows.h>
                     20: #include <string.h>
                     21: #include <stdio.h>
                     22: #include "ttfonts.h"
                     23: 
                     24: 
                     25: 
                     26: int initDlg(HWND hwndMain)
                     27: {
                     28:   /*  load three dialogs and position them. Set the minimize icon for
                     29:    *   this CLASS and it affects all dialog windows.
                     30:    */
                     31: 
                     32:   hwndDlgLF = CreateDialog (hInst, TEXT("logfontDlg"), hwndMain,
                     33:                 (DLGPROC)LogFontWndProc);
                     34:   if (hwndDlgLF == NULL) return FALSE;
                     35: 
                     36:   SetWindowPos (hwndDlgLF, NULL,
                     37:                 CHILDLEFT(1), CHILDTOP,
                     38:                 0,0, SWP_NOZORDER | SWP_NOSIZE);
                     39: 
                     40: 
                     41:   hwndDlgTM = CreateDialog (hInst, TEXT("textmetricDlg"), hwndMain,
                     42:                 (DLGPROC)LogFontWndProc);
                     43:   if (hwndDlgTM == NULL) return FALSE;
                     44: 
                     45:   SetWindowPos (hwndDlgTM, NULL,
                     46:                 CHILDLEFT(0), CHILDTOP,
                     47:                 0,0, SWP_NOZORDER | SWP_NOSIZE);
                     48: 
                     49: 
                     50: 
                     51:   hwndDlgOLTM = CreateDialog (hInst, TEXT("oltextmetricDlg"), hwndMain,
                     52:                 (DLGPROC)LogFontWndProc);
                     53:   if (hwndDlgOLTM == NULL) return FALSE;
                     54:   ShowWindow (hwndDlgOLTM, SW_MINIMIZE);
                     55: 
                     56: 
                     57: 
                     58: 
                     59:   hwndDlgFD = CreateDialog (hInst, TEXT("getfontdataDlg"), hwndMain,
                     60:                 (DLGPROC)FontDataWndProc);
                     61:   if (hwndDlgFD == NULL) return FALSE;
                     62:   ShowWindow (hwndDlgFD, SW_MINIMIZE);
                     63:   SetWindowPos (hwndDlgFD, HWND_TOP,
                     64:                 0, 0,
                     65:                 0,0, SWP_NOSIZE );
                     66: 
                     67: 
                     68: 
                     69:   SetClassLong (hwndDlgLF, GCL_HICON, (LONG)LoadIcon(hInst, TEXT("ttfontsIcon")));
                     70: 
                     71: 
                     72:   return TRUE;
                     73: }
                     74: 
                     75: 
                     76: /* first and last string IDs from string table in RC file */
                     77: #define FIRSTSTRING 1
                     78: #define LASTSTRING  20
                     79: 
                     80: 
                     81: 
                     82: /**************************************************************************\
                     83: *
                     84: *  function:  FontDataWndProc
                     85: *
                     86: *  input parameters:  normal window procedure parameters.
                     87: *
                     88: *  Allow the user to select a table, an offset, and a byte count.
                     89: *   on command message, post self a user message (allows the user
                     90: *   message to come in from other sources too).  On the user message,
                     91: *   just call GetFontData and display the results.
                     92: *
                     93: *
                     94:   // UNICODE NOTICE
                     95:   //  Parts of this are held as ANSI because the dwTable
                     96:   //  in the fontdata is stored with four 8 bit chars.
                     97:   //  And because there is not yet a wide char version of sscanf().
                     98: *
                     99: *
                    100: \**************************************************************************/
                    101: LRESULT CALLBACK FontDataWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    102: {
                    103: #define NCHAR 255
                    104: TCHAR buffer[NCHAR];
                    105: HDC hdc;
                    106: int nBytes, nStrings, i;
                    107: 
                    108: 
                    109:   switch (message) {
                    110: 
                    111:     /* fill combo box w/ table names, and
                    112:      *  entry fields w/ meaningful initial values.
                    113:      */
                    114:     case WM_INITDIALOG:
                    115:       SetDlgItemInt (hwnd, DID_DWOFFSET, 0, TRUE);
                    116:       SetDlgItemInt (hwnd, DID_CBDATA, 50, TRUE);
                    117:       for (i = FIRSTSTRING; i<= LASTSTRING; i++) {
                    118:         LoadString (GetModuleHandle (NULL), i, buffer, NCHAR);
                    119:         SendDlgItemMessage (hwnd, DID_DWTABLE, CB_ADDSTRING, 0, (LPARAM)buffer);
                    120:       }
                    121: 
                    122:     return TRUE;
                    123: 
                    124:     /* If the user hits the DOIT button, post message back to the
                    125:      *  main window.  It will get an HDC and then post us the proper
                    126:      *  user message.
                    127:      */
                    128:     case WM_COMMAND:
                    129:       if (wParam == DID_DOIT)
                    130:         PostMessage (hwndMain, WM_COMMAND, TBID_GETFONTDATA, 0);
                    131:     break;  /* end WM_COMMAND */
                    132: 
                    133: 
                    134: 
                    135:     /**********************************************************************\
                    136:     *  WMU_GETFONTDATA
                    137:     *
                    138:     *  lParam - HDC.
                    139:     *
                    140:     * User message.  Parse the contents of the entry fields, and make the
                    141:     *  GetFontData() call.  Put results in the listbox.
                    142:     \**********************************************************************/
                    143:     case WMU_GETFONTDATA: {
                    144:         DWORD dwTable, dwOffset, cbData;
                    145:         LPBYTE   lpDataBuffer;
                    146:         DWORD dwNBytes;
                    147: 
                    148:         hdc = (HDC) lParam;
                    149:         SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
                    150: 
                    151: 
                    152:         {
                    153:           // UNICODE NOTICE.  GetDlgItemTextA returns ANSI strings.
                    154:           //  we are doing manipulation on a byte by byte basis
                    155: 
                    156:           CHAR  fourbytes[5];
                    157:           CHAR  sbBuffer[NCHAR];
                    158: 
                    159:           nBytes = GetDlgItemTextA (hwnd, DID_DWTABLE, fourbytes, 5);
                    160:           if (nBytes == 0) {
                    161:             dwTable = 0;
                    162:           } else {
                    163:             dwTable = (DWORD) ((fourbytes[3] << 24)
                    164:                             +  (fourbytes[2] << 16)
                    165:                             +  (fourbytes[1] <<  8)
                    166:                             +  (fourbytes[0]));
                    167:           }
                    168: 
                    169: 
                    170:           // UNICODE NOTICE.  GetDlgItemTextA returns ANSI strings.
                    171:           //  sscanf expects single byte strings.
                    172: 
                    173:           GetDlgItemTextA (hwnd, DID_DWOFFSET, sbBuffer, NCHAR);
                    174:           sscanf (sbBuffer, "%x", &dwOffset);
                    175:           GetDlgItemTextA (hwnd, DID_CBDATA  , sbBuffer, NCHAR);
                    176:           sscanf (sbBuffer, "%x", &cbData);
                    177:         }
                    178: 
                    179: 
                    180:         lpDataBuffer = (LPBYTE) LocalAlloc (LPTR, cbData);
                    181:         if (lpDataBuffer == NULL) {
                    182:           MessageBox (NULL, TEXT("alloc failed"), MBERROR, MBERRORFLAGS);
                    183:           return 0;
                    184:         }
                    185: 
                    186:         dwNBytes = GetFontData (hdc, dwTable, dwOffset, (LPVOID) lpDataBuffer, cbData);
                    187: 
                    188:         if (dwNBytes == -1) {
                    189:           MessageBox (NULL, MBGETFONTDATAERR, MBERROR, MBERRORFLAGS);
                    190:         } else {
                    191: 
                    192:           nStrings = dwNBytes / 16;
                    193:           for (i = 0; i< nStrings; i++) {
                    194:             wsprintf (buffer,
                    195:                       TEXT("%02x%02x %02x%02x  %02x%02x %02x%02x  %02x%02x %02x%02x  %02x%02x %02x%02x"),
                    196:                       (int)lpDataBuffer[i*16+0],
                    197:                       (int)lpDataBuffer[i*16+1],
                    198:                       (int)lpDataBuffer[i*16+2],
                    199:                       (int)lpDataBuffer[i*16+3],
                    200:                       (int)lpDataBuffer[i*16+4],
                    201:                       (int)lpDataBuffer[i*16+5],
                    202:                       (int)lpDataBuffer[i*16+6],
                    203:                       (int)lpDataBuffer[i*16+7],
                    204:                       (int)lpDataBuffer[i*16+8],
                    205:                       (int)lpDataBuffer[i*16+9],
                    206:                       (int)lpDataBuffer[i*16+10],
                    207:                       (int)lpDataBuffer[i*16+11],
                    208:                       (int)lpDataBuffer[i*16+12],
                    209:                       (int)lpDataBuffer[i*16+13],
                    210:                       (int)lpDataBuffer[i*16+14],
                    211:                       (int)lpDataBuffer[i*16+15]);
                    212:             SendDlgItemMessage (hwnd, DID_LISTBOX, LB_ADDSTRING, 0, (LONG) buffer);
                    213:           }
                    214:         }
                    215: 
                    216:         LocalFree ( LocalHandle ((LPVOID)lpDataBuffer));
                    217:     } return TRUE;  /* end WMU_GETFONTDATA */
                    218: 
                    219:   } /* end switch */
                    220:   return 0;
                    221: }
                    222: 
                    223: 
                    224: 
                    225: 
                    226: 
                    227: 
                    228: /**************************************************************************\
                    229: *
                    230: *  function:  LogFontWndProc
                    231: *
                    232: *  input parameters:  normal window procedure parameters.
                    233: *  global variables:
                    234: *
                    235: * This window procedure is used for two completely different dialog boxes.
                    236: \**************************************************************************/
                    237: LRESULT CALLBACK LogFontWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    238: {
                    239: static LPLOGFONT    lplf;
                    240: static LPTEXTMETRIC lptm;
                    241: 
                    242:   switch (message) {
                    243: 
                    244: 
                    245:     /**********************************************************************\
                    246:     *  WMU_DEMOTOLF
                    247:     *
                    248:     *  lParam - pointer to LOGFONT structure.
                    249:     *
                    250:     * User message.  Take the input LOGFONT and fill the edit fields of the
                    251:     *  dialog box.
                    252:     \**********************************************************************/
                    253:     case WMU_DEMOTOLF: {
                    254:       lplf = (LPLOGFONT) lParam;
                    255: 
                    256:       SetDlgItemInt (hwnd, DIDHEIGHT , lplf->lfHeight,        TRUE);
                    257:       SetDlgItemInt (hwnd, DIDWIDTH  , lplf->lfWidth,         TRUE);
                    258:       SetDlgItemInt (hwnd, DIDESCAPE , lplf->lfEscapement,    TRUE);
                    259:       SetDlgItemInt (hwnd, DIDORIENT , lplf->lfOrientation,   TRUE);
                    260:       SetDlgItemInt (hwnd, DIDWEIGHT , lplf->lfWeight,        TRUE);
                    261:       SetDlgItemInt (hwnd, DIDITALIC , lplf->lfItalic,        FALSE);
                    262:       SetDlgItemInt (hwnd, DIDUNDERL , lplf->lfUnderline,     FALSE);
                    263:       SetDlgItemInt (hwnd, DIDSTRIKE , lplf->lfStrikeOut,     FALSE);
                    264:       SetDlgItemInt (hwnd, DIDCHARSE , lplf->lfCharSet,       FALSE);
                    265:       SetDlgItemInt (hwnd, DIDOUTPRE , lplf->lfOutPrecision,  FALSE);
                    266:       SetDlgItemInt (hwnd, DIDCLIPPR , lplf->lfClipPrecision, FALSE);
                    267:       SetDlgItemInt (hwnd, DIDQUALIT , lplf->lfQuality,       FALSE);
                    268:       SetDlgItemInt (hwnd, DIDPITCHA , lplf->lfPitchAndFamily,FALSE);
                    269:       SetDlgItemText (hwnd, DIDFACENA, lplf->lfFaceName);
                    270: 
                    271:     } break;
                    272: 
                    273: 
                    274:     /**********************************************************************\
                    275:     *  WMU_LFTODEMO
                    276:     *
                    277:     *  lParam - pointer to LOGFONT structure.
                    278:     *
                    279:     * User message.  Fill the input LOGFONT with the contents of the
                    280:     *  edit fields of dialog box.
                    281:     \**********************************************************************/
                    282:     case WMU_LFTODEMO: {
                    283:       BOOL  success;
                    284:       lplf = (LPLOGFONT) lParam;
                    285: 
                    286: 
                    287:       lplf->lfHeight =        GetDlgItemInt (hwnd, DIDHEIGHT, &success , TRUE);
                    288:       lplf->lfWidth  =        GetDlgItemInt (hwnd, DIDWIDTH , &success , TRUE);
                    289:       lplf->lfEscapement =    GetDlgItemInt (hwnd, DIDESCAPE, &success , TRUE);
                    290:       lplf->lfOrientation =   GetDlgItemInt (hwnd, DIDORIENT, &success , TRUE);
                    291:       lplf->lfWeight =        GetDlgItemInt (hwnd, DIDWEIGHT, &success , TRUE);
                    292:       lplf->lfItalic =        (BYTE) GetDlgItemInt (hwnd, DIDITALIC, &success , FALSE);
                    293:       lplf->lfUnderline =     (BYTE) GetDlgItemInt (hwnd, DIDUNDERL, &success , FALSE);
                    294:       lplf->lfStrikeOut =     (BYTE) GetDlgItemInt (hwnd, DIDSTRIKE, &success , FALSE);
                    295:       lplf->lfCharSet =       (BYTE) GetDlgItemInt (hwnd, DIDCHARSE, &success , FALSE);
                    296:       lplf->lfOutPrecision =  (BYTE) GetDlgItemInt (hwnd, DIDOUTPRE, &success , FALSE);
                    297:       lplf->lfClipPrecision = (BYTE) GetDlgItemInt (hwnd, DIDCLIPPR, &success , FALSE);
                    298:       lplf->lfQuality =       (BYTE) GetDlgItemInt (hwnd, DIDQUALIT, &success , FALSE);
                    299:       lplf->lfPitchAndFamily =(BYTE) GetDlgItemInt (hwnd, DIDPITCHA, &success , FALSE);
                    300:       GetDlgItemText (hwnd, DIDFACENA, lplf->lfFaceName, LF_FACESIZE);
                    301: 
                    302:     } break;
                    303: 
                    304: 
                    305: 
                    306:     /**********************************************************************\
                    307:     *  WMU_DEMOTOTM
                    308:     *
                    309:     *  lParam - pointer to TEXTMETRIC structure.
                    310:     *
                    311:     * User message.  Take the input LOGFONT and fill the list box with
                    312:     *  strings.  Turn off update before hand, then reenable when complete.
                    313:     \**********************************************************************/
                    314:     case WMU_DEMOTOTM: {
                    315:       TCHAR buffer[100];
                    316: 
                    317:       lptm = (LPTEXTMETRIC) lParam;
                    318: 
                    319:       SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETREDRAW, FALSE, 0);
                    320:       SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
                    321: 
                    322: #define LBPUT SendDlgItemMessage (hwnd, DID_LISTBOX, LB_ADDSTRING, 0, (LONG) buffer);
                    323: 
                    324:       wsprintf (buffer, TEXT("tmHeight        \t%d")  ,(int) lptm->tmHeight           ); LBPUT
                    325:       wsprintf (buffer, TEXT("tmAscent        \t%d")  ,(int) lptm->tmAscent           ); LBPUT
                    326:       wsprintf (buffer, TEXT("tmDescent       \t%d")  ,(int) lptm->tmDescent          ); LBPUT
                    327:       wsprintf (buffer, TEXT("tmInternalLeading\t%d") ,(int) lptm->tmInternalLeading  ); LBPUT
                    328:       wsprintf (buffer, TEXT("tmExternalLeading\t%d") ,(int) lptm->tmExternalLeading  ); LBPUT
                    329:       wsprintf (buffer, TEXT("tmAveCharWidth  \t%d")  ,(int) lptm->tmAveCharWidth     ); LBPUT
                    330:       wsprintf (buffer, TEXT("tmMaxCharWidth  \t%d")  ,(int) lptm->tmMaxCharWidth     ); LBPUT
                    331:       wsprintf (buffer, TEXT("tmWeight        \t%d")  ,(int) lptm->tmWeight           ); LBPUT
                    332:       wsprintf (buffer, TEXT("tmOverhang      \t%d")  ,(int) lptm->tmOverhang         ); LBPUT
                    333:       wsprintf (buffer, TEXT("tmDigitizedAspectX\t%d"),(int) lptm->tmDigitizedAspectX ); LBPUT
                    334:       wsprintf (buffer, TEXT("tmDigitizedAspectY\t%d"),(int) lptm->tmDigitizedAspectY ); LBPUT
                    335:       wsprintf (buffer, TEXT("tmItalic        \t%d")  ,(int) lptm->tmItalic           ); LBPUT
                    336:       wsprintf (buffer, TEXT("tmUnderlined    \t%d")  ,(int) lptm->tmUnderlined       ); LBPUT
                    337:       wsprintf (buffer, TEXT("tmStruckOut     \t%d")  ,(int) lptm->tmStruckOut        ); LBPUT
                    338:       wsprintf (buffer, TEXT("tmFirstChar     \t%d")  ,(int) lptm->tmFirstChar        ); LBPUT
                    339:       wsprintf (buffer, TEXT("tmLastChar      \t%d")  ,(int) lptm->tmLastChar         ); LBPUT
                    340:       wsprintf (buffer, TEXT("tmDefaultChar   \t%d")  ,(int) lptm->tmDefaultChar      ); LBPUT
                    341:       wsprintf (buffer, TEXT("tmBreakChar     \t%d")  ,(int) lptm->tmBreakChar        ); LBPUT
                    342:       wsprintf (buffer, TEXT("tmPitchAndFamily\t%d")  ,(int) lptm->tmPitchAndFamily   ); LBPUT
                    343:       wsprintf (buffer, TEXT("tmCharSet       \t%d")  ,(int) lptm->tmCharSet          ); LBPUT
                    344: 
                    345:       SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETREDRAW, TRUE, 0);
                    346:       InvalidateRect (hwnd, NULL, TRUE);
                    347:       UpdateWindow (hwnd);
                    348: 
                    349:     } break;
                    350: 
                    351: 
                    352:     /**********************************************************************\
                    353:     *  WMU_DEMOTOOLTM
                    354:     *
                    355:     *  lParam - HDC.
                    356:     *
                    357:     * User message.  With the input HDC, allocate space for OUTLINETEXTMETRIC
                    358:     *  structure, query it from the HDC, and fill the listbox.  (Allocate the
                    359:     *  OUTLINETEXTMETRIC structure dynamically since it is variable size.)
                    360:     \**********************************************************************/
                    361:     case WMU_DEMOTOOLTM: {
                    362:       HDC hdc;
                    363:       TCHAR buffer[100];
                    364:       UINT cbData;
                    365:       LPOUTLINETEXTMETRIC lpoltm;
                    366:       LPBYTE lptStr;
                    367: 
                    368:       hdc = (HDC) lParam;
                    369: 
                    370: 
                    371:       /* figure out how large the structure is, alloc, and re-query
                    372:        *  unless cbData ==0, then post no-op string and exit.
                    373:        */
                    374:       cbData = GetOutlineTextMetrics (hdc, 0, NULL);
                    375:       if (cbData == 0) {
                    376:         SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
                    377:         wsprintf (buffer, TEXT("cbData == 0")); LBPUT
                    378:         return 0;
                    379:       }
                    380:       lpoltm = (LPOUTLINETEXTMETRIC)LocalAlloc (LPTR, cbData);
                    381:       GetOutlineTextMetrics (hdc, cbData, lpoltm);
                    382: 
                    383: 
                    384:       /* freeze redraw of listbox, and clear contents. */
                    385:       SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETREDRAW, FALSE, 0);
                    386:       SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
                    387: 
                    388: 
                    389:       wsprintf (buffer, TEXT("otmSize                \t%d"),(int) lpoltm->otmSize               );            LBPUT
                    390:       wsprintf (buffer, TEXT("otmTextMetrics { }"));                                                      LBPUT
                    391:       wsprintf (buffer, TEXT("otmFiller              \t%d"),(int)(BYTE) lpoltm->otmFiller             );      LBPUT
                    392: 
                    393:       wsprintf (buffer, TEXT("otmPanoseNumber           "));                                                  LBPUT
                    394: // removed for beta 2.      wsprintf (buffer, TEXT("\t ulCulture        \t%d"),   (int) lpoltm->otmPanoseNumber.ulCulture        ); LBPUT
                    395:       wsprintf (buffer, TEXT("\t bFamilyType      \t0x%lx"),(int) lpoltm->otmPanoseNumber.bFamilyType      ); LBPUT
                    396:       wsprintf (buffer, TEXT("\t bSerifStyle      \t0x%lx"),(int) lpoltm->otmPanoseNumber.bSerifStyle      ); LBPUT
                    397:       wsprintf (buffer, TEXT("\t bWeight          \t0x%lx"),(int) lpoltm->otmPanoseNumber.bWeight          ); LBPUT
                    398:       wsprintf (buffer, TEXT("\t bProportion      \t0x%lx"),(int) lpoltm->otmPanoseNumber.bProportion      ); LBPUT
                    399:       wsprintf (buffer, TEXT("\t bContrast        \t0x%lx"),(int) lpoltm->otmPanoseNumber.bContrast        ); LBPUT
                    400:       wsprintf (buffer, TEXT("\t bStrokeVariation \t0x%lx"),(int) lpoltm->otmPanoseNumber.bStrokeVariation ); LBPUT
                    401:       wsprintf (buffer, TEXT("\t bArmStyle        \t0x%lx"),(int) lpoltm->otmPanoseNumber.bArmStyle        ); LBPUT
                    402:       wsprintf (buffer, TEXT("\t bLetterform      \t0x%lx"),(int) lpoltm->otmPanoseNumber.bLetterform      ); LBPUT
                    403:       wsprintf (buffer, TEXT("\t bMidline         \t0x%lx"),(int) lpoltm->otmPanoseNumber.bMidline         ); LBPUT
                    404:       wsprintf (buffer, TEXT("\t bXHeight         \t0x%lx"),(int) lpoltm->otmPanoseNumber.bXHeight         ); LBPUT
                    405: 
                    406: 
                    407:       wsprintf (buffer, TEXT("otmfsSelection         \t%d"),(UINT) lpoltm->otmfsSelection        ); LBPUT
                    408:       wsprintf (buffer, TEXT("otmfsType              \t%d"),(UINT) lpoltm->otmfsType             ); LBPUT
                    409:       wsprintf (buffer, TEXT("otmsCharSlopeRise      \t%d"),(UINT) lpoltm->otmsCharSlopeRise     ); LBPUT
                    410:       wsprintf (buffer, TEXT("otmsCharSlopeRun       \t%d"),(UINT) lpoltm->otmsCharSlopeRun      ); LBPUT
                    411:       wsprintf (buffer, TEXT("otmItalicAngle         \t%d"),(UINT) lpoltm->otmItalicAngle        ); LBPUT
                    412:       wsprintf (buffer, TEXT("otmEMSquare            \t%d"),(UINT) lpoltm->otmEMSquare           ); LBPUT
                    413:       wsprintf (buffer, TEXT("otmAscent              \t%d"),(UINT) lpoltm->otmAscent             ); LBPUT
                    414:       wsprintf (buffer, TEXT("otmDescent             \t%d"),(int) lpoltm->otmDescent             ); LBPUT
                    415:       wsprintf (buffer, TEXT("otmLineGap             \t%d"),(int) lpoltm->otmLineGap             ); LBPUT
                    416:       wsprintf (buffer, TEXT("otmsCapEmHeight        \t%d"),(UINT) lpoltm->otmsCapEmHeight        ); LBPUT
                    417:       wsprintf (buffer, TEXT("otmsXHeight            \t%d"),(UINT) lpoltm->otmsXHeight            ); LBPUT
                    418:       wsprintf (buffer, TEXT("otmrcFontBox           \t (%d, %d, %d, %d)"),
                    419:                                                       (int) lpoltm->otmrcFontBox.left,
                    420:                                                       (int) lpoltm->otmrcFontBox.top,
                    421:                                                       (int) lpoltm->otmrcFontBox.right,
                    422:                                                       (int) lpoltm->otmrcFontBox.bottom   ); LBPUT
                    423:       wsprintf (buffer, TEXT("otmMacAscent           \t%d"),(int) lpoltm->otmMacAscent          ); LBPUT
                    424:       wsprintf (buffer, TEXT("otmMacDescent          \t%d"),(int) lpoltm->otmMacDescent         ); LBPUT
                    425:       wsprintf (buffer, TEXT("otmMacLineGap          \t%d"),(UINT) lpoltm->otmMacLineGap         ); LBPUT
                    426:       wsprintf (buffer, TEXT("otmusMinimumPPEM       \t%d"),(UINT) lpoltm->otmusMinimumPPEM      ); LBPUT
                    427: 
                    428:       wsprintf (buffer, TEXT("otmptSubscriptSize     \t(%d, %d)"),
                    429:                                                       (int) lpoltm->otmptSubscriptSize.x,
                    430:                                                       (int) lpoltm->otmptSubscriptSize.y    ); LBPUT
                    431:       wsprintf (buffer, TEXT("otmptSubscriptOffset   \t(%d, %d)"),
                    432:                                                       (int) lpoltm->otmptSubscriptOffset.x,
                    433:                                                       (int) lpoltm->otmptSubscriptOffset.y  ); LBPUT
                    434:       wsprintf (buffer, TEXT("otmptSuperscriptSize   \t(%d, %d)"),
                    435:                                                       (int) lpoltm->otmptSuperscriptSize.x,
                    436:                                                       (int) lpoltm->otmptSuperscriptSize.y  ); LBPUT
                    437:       wsprintf (buffer, TEXT("otmptSuperscriptOffset \t(%d, %d)"),
                    438:                                                       (int) lpoltm->otmptSuperscriptOffset.x,
                    439:                                                       (int) lpoltm->otmptSuperscriptOffset.y); LBPUT
                    440: 
                    441:       wsprintf (buffer, TEXT("otmsStrikeoutSize      \t%d"),(UINT) lpoltm->otmsStrikeoutSize     ); LBPUT
                    442:       wsprintf (buffer, TEXT("otmsStrikeoutPosition  \t%d"),(int) lpoltm->otmsStrikeoutPosition );  LBPUT
                    443:       wsprintf (buffer, TEXT("otmsUnderscoreSize     \t%d"),(int) lpoltm->otmsUnderscoreSize    );  LBPUT
                    444:       wsprintf (buffer, TEXT("otmsUnderscorePosition \t%d"),(UINT) lpoltm->otmsUnderscorePosition); LBPUT
                    445: 
                    446:       /* the last 4 fields are incorrectly typed as PSTR,
                    447:        *  they are in fact offsets from the top of the
                    448:        *  OUTLINETEXTMETRIC structure, to the location of the string.
                    449:        */
                    450:       lptStr = (LPBYTE)lpoltm;
                    451:       lptStr += (UINT) (PBYTE) lpoltm->otmpFamilyName;
                    452:       wsprintf (buffer, TEXT("otmpFamilyName:   %s"),lptStr); LBPUT
                    453: 
                    454:       lptStr = (LPBYTE)lpoltm;
                    455:       lptStr += (UINT) (PBYTE) lpoltm->otmpFaceName;
                    456:       wsprintf (buffer, TEXT("otmpFaceName:   %s"),lptStr);   LBPUT
                    457: 
                    458:       lptStr = (LPBYTE)lpoltm;
                    459:       lptStr += (UINT) (PBYTE) lpoltm->otmpStyleName;
                    460:       wsprintf (buffer, TEXT("otmpStyleName:   %s"),lptStr);  LBPUT
                    461: 
                    462:       wsprintf (buffer, TEXT("otmpFullName:"));               LBPUT
                    463:       lptStr = (LPBYTE)lpoltm;
                    464:       lptStr += (UINT) (PBYTE) lpoltm->otmpFullName;
                    465:       wsprintf (buffer, TEXT("  %s"),lptStr);                 LBPUT
                    466: 
                    467: 
                    468:       SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETREDRAW, TRUE, 0);
                    469:       InvalidateRect (hwnd, NULL, TRUE);
                    470:       UpdateWindow (hwnd);
                    471: 
                    472:       /* balance LocalAlloc(), release memory. */
                    473:       LocalFree (LocalHandle (lpoltm));
                    474: 
                    475:     } break;
                    476: 
                    477: 
                    478: 
                    479:   } /* end switch */
                    480:   return 0;
                    481: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.