Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
4.2 KiB

  1. #ifdef FE_SB
  2. /*********************************Class************************************\
  3. * class IFIOBJR: public IFIOBJ
  4. *
  5. * History:
  6. * Tue 22-Dec-1992 14:05:24 by Kirk Olynyk [kirko]
  7. * Wrote it.
  8. *
  9. * Copyright (c) 1992-1999 Microsoft Corporation
  10. \**************************************************************************/
  11. class IFIOBJR : public IFIOBJ
  12. {
  13. public:
  14. FONTDIFF fd;
  15. LONG lMaxCharWidth;
  16. LONG lAveCharWidth;
  17. LONG lInternalLeading;
  18. LONG lExternalLeading;
  19. LONG lDigitizedAspectX;
  20. LONG lDigitizedAspectY;
  21. IFIOBJR(const IFIMETRICS *pifi_, RFONTOBJ& rfo_, DCOBJ& dco) : IFIOBJ(pifi_)
  22. {
  23. FONTSIM *pfs = (FONTSIM*) (((BYTE*) pifi) + pifi->dpFontSim);
  24. switch (rfo_.pfo()->flFontType & (FO_SIM_BOLD+FO_SIM_ITALIC))
  25. {
  26. case 0:
  27. fd.bWeight = pifi->panose.bWeight ;
  28. fd.usWinWeight = pifi->usWinWeight ;
  29. fd.fsSelection = pifi->fsSelection ;
  30. fd.fwdAveCharWidth = pifi->fwdAveCharWidth ;
  31. fd.fwdMaxCharInc = pifi->fwdMaxCharInc ;
  32. fd.ptlCaret = pifi->ptlCaret ;
  33. break;
  34. case FO_SIM_BOLD:
  35. // If base (physical) font is already italic, emboldening yields
  36. // a bold-italic simulation.
  37. if (pifi->fsSelection & FM_SEL_ITALIC)
  38. fd = *((FONTDIFF*) (((BYTE*) pfs) + pfs->dpBoldItalic));
  39. else
  40. fd = *((FONTDIFF*) (((BYTE*) pfs) + pfs->dpBold));
  41. break;
  42. case FO_SIM_ITALIC:
  43. // If base (physical) font is already bold, italicization yields
  44. // a bold-italic simulation.
  45. if (pifi->fsSelection & FM_SEL_BOLD)
  46. fd = *((FONTDIFF*) (((BYTE*) pfs) + pfs->dpBoldItalic));
  47. else
  48. fd = *((FONTDIFF*) (((BYTE*) pfs) + pfs->dpItalic));
  49. break;
  50. case FO_SIM_BOLD+FO_SIM_ITALIC:
  51. fd = *((FONTDIFF*) (((BYTE*) pfs) + pfs->dpBoldItalic));
  52. break;
  53. }
  54. lAveCharWidth = (LONG) fd.fwdAveCharWidth;
  55. lMaxCharWidth = (LONG) fd.fwdMaxCharInc;
  56. lExternalLeading = (LONG) fwdExternalLeading();
  57. lInternalLeading = (LONG) fwdInternalLeading();
  58. if (!bContinuousScaling())
  59. {
  60. {
  61. const LONG lx = rfo_.pptlSim()->x;
  62. if (lx > 1)
  63. {
  64. lAveCharWidth *= lx;
  65. lMaxCharWidth *= lx;
  66. }
  67. }
  68. {
  69. const LONG ly = rfo_.pptlSim()->y;
  70. if (ly > 1)
  71. {
  72. lExternalLeading *= ly;
  73. lInternalLeading *= ly;
  74. }
  75. }
  76. }
  77. // [Windows 3.1 compatibility]
  78. // If TrueType font, then we need to substitute the device resolution for
  79. // the aspect ratio.
  80. if (bTrueType())
  81. {
  82. PDEVOBJ pdo(dco.hdev());
  83. ASSERTGDI(pdo.bValid(), "ctIFIOBJR(): bad HDEV in DC\n");
  84. // [Windows 3.1 compatibility]
  85. // Win 3.1 has these swapped. It puts VertRes in tmDigitizedAspectX
  86. // and HorzRes in tmDigitizedAspectY.
  87. lDigitizedAspectX = (LONG) pdo.ulLogPixelsY();
  88. lDigitizedAspectY = (LONG) pdo.ulLogPixelsX();
  89. }
  90. else
  91. {
  92. // [Windows 3.1 compatibility]
  93. // Win 3.1 has these swapped. It puts VertRes in tmDigitizedAspectX
  94. // and HorzRes in tmDigitizedAspectY.
  95. lDigitizedAspectX = pptlAspect()->y * rfo_.pptlSim()->y;
  96. lDigitizedAspectY = pptlAspect()->x * rfo_.pptlSim()->x;
  97. }
  98. }
  99. BYTE tmItalic()
  100. {
  101. return((BYTE) ((FM_SEL_ITALIC & fd.fsSelection)?255:0));
  102. }
  103. LONG tmMaxCharWidth()
  104. {
  105. return(lMaxCharWidth);
  106. }
  107. LONG tmAveCharWidth()
  108. {
  109. return(lAveCharWidth);
  110. }
  111. LONG tmInternalLeading()
  112. {
  113. return(lInternalLeading);
  114. }
  115. LONG tmExternalLeading()
  116. {
  117. return(lExternalLeading);
  118. }
  119. LONG tmWeight()
  120. {
  121. return((LONG) (fd.usWinWeight));
  122. }
  123. FSHORT fsSimSelection()
  124. {
  125. return(fd.fsSelection);
  126. }
  127. LONG tmDigitizedAspectX()
  128. {
  129. return lDigitizedAspectX;
  130. }
  131. LONG tmDigitizedAspectY()
  132. {
  133. return lDigitizedAspectY;
  134. }
  135. };
  136. #endif // FONTLINK