home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Nuntius 1.2 / src / Nuntius / FontTools.cp < prev    next >
Encoding:
Text File  |  1994-02-20  |  769 b   |  34 lines  |  [TEXT/MPS ]

  1. // Copyright © 1992 Peter Speck, speck@dat.ruc.dk. All rights reserved.
  2. // FontTools.cp
  3.  
  4. #include "FontTools.h"
  5.  
  6. #include <Script.h>
  7.  
  8. #pragma segment MyTools
  9.  
  10. void CalcStandardGridViewFont(StandardGridViewTextStyle &gvts)
  11. {
  12.     GrafPtr savePort;
  13.     GetPort(savePort);
  14.     SetPort(gWorkPort);
  15.     SetPortTextStyle(gvts.fTextStyle);
  16.     FontInfo info;
  17.     GetFontInfo(info);
  18.     gvts.fRowHeight = info.ascent + info.descent + info.leading;
  19.     gvts.fHorzOffset = 2 * CharWidth(' ');
  20.     gvts.fVertOffset = info.leading + info.ascent;
  21.     SetPort(savePort);
  22. }
  23.  
  24. void TruncSystemFontString(short width,CStr255& theString, short truncWhere)
  25. {
  26.     GrafPtr savePort;
  27.     GetPort(savePort);
  28.     SetPort(gWorkPort);
  29.     SetPortTextStyle(gSystemStyle);
  30.     TruncString(width, theString, truncWhere);
  31.     SetPort(savePort);    
  32. }
  33.  
  34.