Annotation of mstools/samples/fontview/display.c, revision 1.1.1.4

1.1.1.4 ! 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: 
1.1       root       12: #include <windows.h>
                     13: #include <string.h>
1.1.1.2   root       14: #include <math.h>
1.1       root       15: 
1.1.1.2   root       16: #if defined (WIN32)
                     17: #define _MoveTo(hdc,x,y) MoveToEx(hdc,x,y,NULL)
                     18: #else
                     19: #define _MoveTo(hdc,x,y) MoveTo(hdc,x,y)
                     20: #endif
1.1       root       21: 
1.1.1.2   root       22: // These are the 'exported' functions from this file:
                     23: void DrawAscii (HDC hdc, RECT *pRect, WORD direction);
                     24: void DrawGlyph (HDC hdc, RECT *pRect, BYTE glyph, HFONT hfont);
                     25: BYTE FindChar (HDC hdc, RECT *pRect, int x, int y);
1.1       root       26: 
1.1.1.4 ! root       27: #pragma warning(4 : 4309)
1.1.1.2   root       28: // A data structure that DrawAscii will use:
1.1       root       29: char ascii[]=
1.1.1.2   root       30:     {
                     31:     // Low Ascii:
                     32: 
                     33:     1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
                     34:     20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
                     35: 
                     36:     // Standard Ascii:
                     37: 
                     38:     ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',',
                     39:     '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                     40:     ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F',
                     41:     'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
                     42:     'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`',
                     43:     'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
                     44:     'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
                     45:     '{', '|', '}', '~', '',
                     46: 
                     47:     // High Ascii:
                     48: 
                     49:     '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
                     50:     '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
                     51:     '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
                     52:     '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
                     53:     '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
                     54:     '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
                     55:     '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
                     56:     '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
                     57: 
1.1.1.3   root       58:     '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
                     59:     '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
                     60:     '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
                     61:     '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
                     62:     '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
                     63:     '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
                     64:     '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
                     65:     '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
                     66: 
                     67: 
1.1.1.2   root       68:     // End of the list:
                     69: 
                     70:     000, 000};
1.1.1.4 ! root       71: #pragma warning(3 : 4309)
1.1       root       72: 
                     73: /* A function that the CharSet window will use to display the text */
1.1.1.2   root       74: void DrawAscii (HDC hdc, RECT *pRect, WORD direction)
                     75: {
                     76:     BYTE *pch;
                     77:     int h, w, incx, incy, width;
                     78:     unsigned int  wDisplay;
                     79:     POINT pt;
                     80:     TEXTMETRIC tm;
                     81:     BOOL bLineMode = FALSE;
                     82: 
                     83: 
                     84:     GetTextMetrics (hdc, &tm);
                     85:     h = tm.tmHeight;
                     86:     w = tm.tmMaxCharWidth;
                     87: 
                     88:     incx = 0;
                     89:     incy = h;
                     90:     pt.x = 0;
                     91:     pt.y = 0;
                     92: 
                     93:     //
                     94:     pt.y = tm.tmAscent + tm.tmExternalLeading;
                     95:     //
                     96: 
                     97:     pch = &(ascii[tm.tmFirstChar]);
                     98:     wDisplay = pRect->right -pRect->left;
                     99: 
                    100:     //
                    101:     SetTextAlign (hdc, TA_BASELINE | TA_CENTER);
                    102:     SetBkMode (hdc, TRANSPARENT);
                    103:     //
                    104: 
                    105:     while (pch[0] && (pch[0]<=tm.tmLastChar)) {
                    106: #if defined (WIN32)
                    107:         SIZE size;
                    108:         GetTextExtentPoint (hdc, pch, 1, &size);
                    109:         width = size.cx;
                    110: #else
                    111:         width = LOWORD (GetTextExtent (hdc, pch, 1));
                    112: #endif
                    113:         if ((unsigned)(pt.x + width) > wDisplay) {
                    114:             pt.x = 0;
                    115:             pt.y += incy;
                    116:         }
                    117:         TextOut (hdc, pt.x + (width/2), pt.y, pch, 1);
                    118:         pt.x += width;
                    119:         pch++;
                    120:     }
                    121:     return;
1.1       root      122: 
1.1.1.2   root      123:     direction;
                    124: }
                    125: 
                    126: // Return the character that was drawn at the provided location
                    127: // This allows us to 'click' on a character, and determined what
                    128: // it was we actually clicked on.
                    129: BYTE FindChar (HDC hdc, RECT *pRect, int x, int y)
                    130: {
                    131:     BYTE *pch;
                    132:     int h, w, incx, incy, width;
                    133:     unsigned int wDisplay;
                    134:     POINT pt;
                    135:     TEXTMETRIC tm;
                    136:     BOOL bLineMode = FALSE;
                    137: 
                    138: 
                    139:     GetTextMetrics (hdc, &tm);
                    140:     h = tm.tmHeight;
                    141:     w = tm.tmMaxCharWidth;
                    142: 
                    143:     incx = 0;
                    144:     incy = h;
                    145:     pt.x = 0;
                    146:     pt.y = 0;
                    147: 
                    148:     pch = &(ascii[tm.tmFirstChar]);
                    149:     wDisplay = pRect->right -pRect->left;
                    150: 
                    151:     while (pch[0] && (pch[0]<=tm.tmLastChar)) {
                    152: #if defined (WIN32)
                    153:         SIZE size;
                    154:         GetTextExtentPoint (hdc, pch, 1, &size);
                    155:         width = size.cx;
                    156: #else
                    157:         width = LOWORD (GetTextExtent (hdc, pch, 1));
                    158: #endif
                    159:         if ((unsigned)(pt.x + width) > wDisplay) {
                    160:             pt.x = 0;
                    161:             pt.y += incy;
                    162:         }
                    163:         if ((x>=pt.x) && (x <=(pt.x+width)) && (y>=pt.y) && (y<=pt.y+incy)) return pch[0];
                    164:         pt.x += width;
                    165:         pch++;
                    166:     }
                    167:     return 0;
                    168: }
                    169: 
                    170: // Essentially, a StretchBlt, but draws cicular pels.
                    171: BOOL CircleBlt (HDC hdcDest, int xDst, int yDst, int iWidthDst, int iHeightDst, HDC hdcSrc, int xSrc, int ySrc, int iWidthSrc, int iHeightSrc, DWORD dwROP)
                    172: {
                    173:     int x, y, x1, y1, x2, y2;
                    174:     DWORD rgb;
                    175:     float fXUnit, fYUnit;
                    176:     HBRUSH hbrush, hbrushOld;
                    177: 
                    178:     if (iWidthSrc != 0){
                    179:         fXUnit = (float)iWidthDst / (float)iWidthSrc;
                    180:     } else {
                    181:         fXUnit = (float)iWidthDst;
                    182:     }
                    183:     if (iHeightSrc != 0) {
                    184:         fYUnit = (float)iHeightDst / (float)iHeightSrc;
                    185:     } else {
                    186:         fYUnit = (float)iHeightDst;
                    187:     }
                    188: 
                    189:     for (y=ySrc; y<(ySrc+iHeightSrc); y++) {
                    190:         for (x=xSrc; x<(xSrc+iWidthSrc); x++) {
                    191: 
                    192:             rgb = GetPixel (hdcSrc, x, y);
                    193:             if (rgb != -1 && rgb != 0x00FFFFFF) {
                    194:                 hbrush = CreateSolidBrush (rgb);
                    195:                 hbrushOld = SelectObject (hdcDest, hbrush);
                    196:                 x1 = xDst + (int)((x-xSrc)*fXUnit);
                    197:                 y1 = yDst + (int)((y-ySrc)*fYUnit);
                    198:                 x2 = xDst + (int)(((x-xSrc)+1)*fXUnit)+1;
                    199:                 y2 = yDst + (int)(((y-ySrc)+1)*fYUnit)+1;
                    200:                 Ellipse (hdcDest, x1, y1, x2, y2);
                    201:                 DeleteObject(SelectObject(hdcDest, hbrushOld));
                    202:             }
                    203:         }
                    204:     }
1.1       root      205: 
1.1.1.2   root      206:     return TRUE;
                    207: 
                    208:     dwROP;
                    209: }
1.1       root      210: 
1.1.1.2   root      211: double Radian(double ang)
                    212: {
1.1.1.4 ! root      213:         return ang * (double)3.1415926535 / (double)180.0;
1.1.1.2   root      214: }
                    215: 
                    216: void CalcRot (double x, double y, double ang, double* x1, double* y1)
                    217: {
1.1.1.4 ! root      218:         ang = Radian(-ang);
        !           219:         *x1 = (x * cos(ang)) - (y * sin(ang));
        !           220:         *y1 = (x * sin(ang)) + (y * cos(ang));
1.1.1.2   root      221: }
                    222: 
                    223: void DrawGlyph (HDC hdc, RECT *pRect, BYTE glyph, HFONT hfont)
                    224: {
                    225:     TEXTMETRIC tm;
                    226:     LOGFONT lf;
                    227:     int wChar, h1, h2, w1, w2, x, y;
                    228:     double xTL, yTL, xTR, yTR, xBL, yBL, xBR, yBR, xML, yML, xMR, yMR;
                    229:     int cWidth, cExtentW, cExtentH;
                    230:     int unit, margin;
                    231:     RECT rect, rectChar;
                    232:     HDC hdcMem;
                    233:     HBITMAP hbitmap, hbitmapOld;
                    234:     HFONT hfontOld, hfontTmp;
                    235:     char szText[80];
                    236:     double fAng, fWa, fWb, fHa, fHb, fHeight, fWidth;
                    237:     BOOL bRotateable;
                    238:     double fxOff, fyOff;
                    239: #if defined(TT_AVAILABLE)
                    240:     ABC abc;
                    241: #endif
                    242: 
                    243:     GetTextMetrics (hdc, &tm);
                    244:     hfontTmp = SelectObject (hdc, GetStockObject(SYSTEM_FONT));
                    245:     GetObject (hfontTmp, sizeof(LOGFONT), &lf);
                    246: 
                    247: // Some fields of 'lf' need to be whacked out depending on the type of
                    248: // font involved. For instance, lfEscapement should only be non-zero for
                    249: // rotatable fonts.
                    250:         bRotateable = FALSE;
                    251: #if defined (TMPF_VECTOR)
1.1.1.4 ! root      252:         bRotateable = (tm.tmPitchAndFamily & TMPF_VECTOR);
1.1.1.2   root      253: #endif
                    254: #if defined (TMPF_TRUETYPE)
1.1.1.4 ! root      255:         bRotateable |= (tm.tmPitchAndFamily & TMPF_TRUETYPE);
1.1.1.2   root      256: #endif
1.1.1.4 ! root      257:         if (!bRotateable) {
        !           258:                 lf.lfEscapement = 0;
        !           259:         }
1.1       root      260: 
1.1.1.2   root      261:     SelectObject (hdc, hfontTmp);
                    262:     GetCharWidth (hdc, glyph, glyph, &cWidth);
                    263: 
                    264: #if defined (WIN32)
                    265:     {
                    266:         SIZE size;
                    267:         GetTextExtentPoint (hdc, (LPSTR)&glyph, 1, &size);
                    268:         cExtentW = size.cx;
                    269:         cExtentH = size.cy;
                    270:     }
                    271: #else
                    272:     cExtentW = LOWORD (GetTextExtent (hdc, (LPSTR)&glyph, 1));
                    273:     cExtentH = HIWORD (GetTextExtent (hdc, (LPSTR)&glyph, 1));
                    274: #endif
                    275: 
                    276:     wChar = max(cWidth, cExtentW);
                    277: 
                    278: #if defined(TT_AVAILABLE)
                    279:     if (GetCharABCWidths (hdc, (UINT)glyph, (UINT)glyph, &abc)) {
1.1.1.4 ! root      280:         wChar = abc.abcA + abc.abcB + abc.abcC;
        !           281:         wChar = max(abc.abcA,0) + max (abc.abcB,0) + max (abc.abcC,0);
1.1.1.2   root      282:     } else {
1.1.1.4 ! root      283:         abc.abcA = 0;
        !           284:         abc.abcB = wChar;
        !           285:         abc.abcC = 0;
1.1.1.2   root      286:     }
                    287: #endif
                    288: 
                    289: // ****
1.1.1.4 ! root      290:         // Lets figure out how large of a bitmap we need to draw this character into.
        !           291:         // This will take lfEscapement into account.
1.1.1.2   root      292: 
1.1.1.4 ! root      293:         // Turn the 'escapement' value into a valid angle
1.1.1.2   root      294:     fAng = 90.0 - ((double)lf.lfEscapement/10.0);
                    295: 
                    296:     // We now need to calculate two values for height and width. These
                    297:     // represent the bases of the triangles that are formed as the
                    298:     // character cell rotates. Thus fWa+fWb is the 'width' of the space
                    299:     // required by the given character at the current rotation.
                    300:     // At 0, 90, 180, 270 and 360, one of the two values will be '0'.
                    301:     fWa = (double)cExtentW * sin(Radian(fAng));
                    302:     fHa = (double)cExtentW * sin(Radian((double)lf.lfEscapement/10.0));
                    303:     fHb = (double)cExtentH * sin(Radian(fAng));
                    304:     fWb = (double)cExtentH * sin(Radian((double)lf.lfEscapement/10.0));
                    305: 
                    306:     // This gives us a width/height of:
                    307:     fHeight = fabs(fHa) + fabs(fHb);
                    308:     fWidth = fabs(fWa) + fabs(fWb);
                    309: // ****
                    310: 
                    311:     h1 = pRect->bottom - pRect->top;
                    312:     h2 = tm.tmHeight + tm.tmExternalLeading;
                    313:     h2 = (int)fHeight;
                    314:     if (h2 == 0) {
                    315:         MessageBeep (0);
                    316:         h2 = 10;
                    317:     }
                    318: 
                    319:     w1 = pRect->right - pRect->left;
                    320:     w2 = (int)fWidth;
                    321: 
                    322:     unit = (h1 / h2);
                    323: 
                    324:     margin = (h1 - (unit * h2)) / 2;
                    325:     margin = 0;
                    326:     // Define a rectangle that will enclose our drawing area
                    327:     SetRect (&rect, 0, 0, wChar*unit, (tm.tmHeight*unit) + (tm.tmExternalLeading*unit));
                    328:     OffsetRect (&rect, margin, margin);
                    329:     // Define a rectangle that will define the bounding box of the character
                    330:     SetRect (&rectChar, 0, 0, wChar*unit, tm.tmHeight*unit);
                    331:     OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));
                    332: 
                    333: 
                    334: // ****
                    335:     // These are floating point values.
                    336:     SetRect (&rect, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit) + (tm.tmExternalLeading*unit));
                    337:     OffsetRect (&rect, margin, margin);
                    338:     // Define a rectangle that will define the bounding box of the character
                    339:     SetRect (&rectChar, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit));
                    340:     OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));
                    341: 
                    342:     // Calculate the points of the 'character cell'. This will take full
                    343:     // rotation into consideration.
1.1.1.4 ! root      344:         CalcRot (0, 0, (double)lf.lfEscapement/10.0, &xTL, &yTL);
        !           345:         CalcRot ((double)cExtentW, 0, (double)lf.lfEscapement/10.0, &xTR, &yTR);
        !           346:         CalcRot (0, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBL, &yBL);
        !           347:         CalcRot ((double)cExtentW, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBR, &yBR);
        !           348:         CalcRot (0, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xML, &yML);
        !           349:         CalcRot ((double)cExtentW, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xMR, &yMR);
1.1.1.2   root      350: 
1.1.1.4 ! root      351:         fxOff = min(xTL, min(xTR, min(xBL, xBR)));
        !           352:         fyOff = min(yTL, min(yTR, min(yBL, yBR)));
1.1.1.2   root      353: 
                    354: // Draw a rectangle around the drawing limits of the character.
                    355:     _MoveTo (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit));
                    356:     LineTo (hdc, (int)((xTR-fxOff)*(double)unit), (int)((yTR-fyOff)*(double)unit));
                    357:     LineTo (hdc, (int)((xBR-fxOff)*(double)unit), (int)((yBR-fyOff)*(double)unit));
                    358:     LineTo (hdc, (int)((xBL-fxOff)*(double)unit), (int)((yBL-fyOff)*(double)unit));
                    359:     LineTo (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit));
                    360: 
                    361: // Draw the baseline, which indicates the advance width of the character
                    362:     _MoveTo (hdc, (int)((xML-fxOff)*(double)unit), (int)((yML-fyOff)*(double)unit));
                    363:     LineTo (hdc, (int)((xMR-fxOff)*(double)unit), (int)((yMR-fyOff)*(double)unit));
                    364: 
                    365:     hdcMem = CreateCompatibleDC (hdc);
                    366:     if (hdcMem) {
                    367:         hbitmap = CreateCompatibleBitmap (hdc, (int)(fWidth), (int)(fHeight));
                    368:         if (hbitmap) {
                    369:             hbitmapOld = SelectObject (hdcMem, hbitmap);
                    370:             BitBlt (hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), NULL, 0, 0, WHITENESS);
                    371:             hfontOld = SelectObject (hdcMem, hfont);
                    372: 
                    373:             SetTextAlign (hdcMem, TA_LEFT | TA_BASELINE);
                    374:             if (TextOut (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), (LPSTR)&glyph, 1)) {
                    375: 
                    376: 
1.1.1.4 ! root      377:                                 /*
1.1.1.2   root      378:                 // Just for debugging, lets mark some special pixels
1.1.1.4 ! root      379:                         SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
        !           380:                         SetPixel (hdcMem, (int)(xTL-fxOff), (int)(yTL-fyOff), 0x808080); // Top Left
        !           381:                         SetPixel (hdcMem, (int)(xTR-fxOff), (int)(yTR-fyOff), 0x808080); // Top Right
        !           382:                         SetPixel (hdcMem, (int)(xBL-fxOff), (int)(yBL-fyOff), 0x808080); // Btm Left
        !           383:                         SetPixel (hdcMem, (int)(xBR-fxOff), (int)(yBR-fyOff), 0x808080); // Btm Right
        !           384:                         SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
        !           385:                         SetPixel (hdcMem, (int)(xMR-fxOff), (int)(yMR-fyOff), 0x808080); // Base Rt
1.1.1.2   root      386:                 */
                    387: 
                    388:                 CircleBlt(hdc, margin, margin,
                    389:                     rectChar.right-rectChar.left, rectChar.bottom-rectChar.top,
                    390:                     hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), SRCPAINT);
                    391: 
                    392:             } else {
                    393:                 MessageBox (GetFocus(),
1.1.1.4 ! root      394:                         "Unable to perform TextOut", "DisplayGlyph", MB_OK);
1.1.1.2   root      395:             }
                    396:             SelectObject (hdcMem, hbitmapOld);
                    397:             SelectObject (hdcMem, hfontOld);
                    398:             DeleteObject (hbitmap);
                    399:         } else {
                    400:             MessageBox (GetFocus(), "Unable To create Bitmap", "DisplayGlyph", MB_OK);
                    401:         }
                    402:         DeleteDC (hdcMem);
                    403:     } else {
                    404:         MessageBox (GetFocus(), "Unable to create DC", "DisplayGlyph", MB_OK);
                    405:     }
                    406: 
                    407:     hfontTmp = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "");
                    408: 
                    409:     if (hfontTmp) {
                    410:         hfontOld = SelectObject (hdc, hfontTmp);
                    411:         x = rect.right + 10;
                    412:         GetTextMetrics (hdc, &tm);
                    413: 
                    414:         y = tm.tmHeight + tm.tmExternalLeading;
                    415: 
                    416:         y += tm.tmHeight + tm.tmExternalLeading;
                    417:         wsprintf (szText, "Character = '%c' %u (0x%X)", (char)glyph, (int)glyph, (int)glyph);
                    418:         TextOut (hdc, x, y, szText, lstrlen(szText));
                    419: 
                    420:         y += tm.tmHeight + tm.tmExternalLeading;
                    421:         wsprintf (szText, "CharWidth = %i", cWidth);
                    422:         TextOut (hdc, x, y, szText, lstrlen(szText));
                    423: 
1.1.1.4 ! root      424:                 // ABC Width - Eventually, I want to 'draw' this into the character
        !           425:                 // cell, but for now, this at least makes the information easily
        !           426:                 // available:
1.1.1.2   root      427: #if defined (TT_AVAILABLE)
                    428:         y += tm.tmHeight + tm.tmExternalLeading;
                    429:         wsprintf (szText, "A|B|C = %i | %u | %i", abc.abcA, abc.abcB, abc.abcC);
                    430:         TextOut (hdc, x, y, szText, lstrlen(szText));
                    431: #endif
                    432: 
                    433:         y += tm.tmHeight + tm.tmExternalLeading;
                    434:         wsprintf (szText, "CharExtentW = %i", cExtentW);
                    435:         TextOut (hdc, x, y, szText, lstrlen(szText));
                    436: 
                    437:         y += tm.tmHeight + tm.tmExternalLeading;
                    438:         wsprintf (szText, "CharExtentH = %i", cExtentH);
                    439:         TextOut (hdc, x, y, szText, lstrlen(szText));
                    440: 
1.1.1.4 ! root      441:                 // These are for some values I was using to debug the character
        !           442:                 // cell rotation calculation:
1.1.1.2   root      443: 
                    444:         //y += tm.tmHeight + tm.tmExternalLeading;
                    445:         //wsprintf (szText, "(%i,%i) : (%i,%i) [%i]", (int)xTL, (int)yTL, (int)xTR, (int)yTR,(int)(((double)lf.lfEscapement/10.0)*10));
                    446:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    447: 
                    448:         //y += tm.tmHeight + tm.tmExternalLeading;
                    449:         //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xML, (int)yML, (int)xMR, (int)yMR);
                    450:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    451: 
                    452:         //y += tm.tmHeight + tm.tmExternalLeading;
                    453:         //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xBL, (int)yBL, (int)xBR, (int)yBR);
                    454:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    455: 
                    456:         //y += tm.tmHeight + tm.tmExternalLeading;
                    457:         //wsprintf (szText, "fAng = %i", (int)(fAng));
                    458:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    459: 
                    460:         //y += tm.tmHeight + tm.tmExternalLeading;
                    461:         //wsprintf (szText, "fHa = %i", (int)(fHa));
                    462:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    463: 
                    464:         //y += tm.tmHeight + tm.tmExternalLeading;
                    465:         //wsprintf (szText, "fHb = %i", (int)(fHb));
                    466:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    467: 
                    468:         //y += tm.tmHeight + tm.tmExternalLeading;
                    469:         //wsprintf (szText, "fWa = %i", (int)(fWa));
                    470:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    471: 
                    472:         //y += tm.tmHeight + tm.tmExternalLeading;
                    473:         //wsprintf (szText, "fWb = %i", (int)(fWb));
                    474:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    475: 
                    476:         //y += tm.tmHeight + tm.tmExternalLeading;
                    477:         //wsprintf (szText, "fWd = %i", (int)(fWd));
                    478:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    479: 
                    480:         //y += tm.tmHeight + tm.tmExternalLeading;
                    481:         //wsprintf (szText, "fHd = %i", (int)(fHd));
                    482:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    483: 
                    484:         //y += tm.tmHeight + tm.tmExternalLeading;
                    485:         //wsprintf (szText, "fHeight = %i", (int)(fHeight));
                    486:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    487: 
                    488:         //y += tm.tmHeight + tm.tmExternalLeading;
                    489:         //wsprintf (szText, "fWidth = %i", (int)(fWidth));
                    490:         //TextOut (hdc, x, y, szText, lstrlen(szText));
                    491: 
                    492:         SelectObject (hdc, hfontOld);
                    493:         DeleteObject (hfontTmp);
                    494:     }
1.1       root      495: }

unix.superglobalmegacorp.com

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