Attempting to draw low-density text on a high-density display seems to be a
crufty, but workable solution to the problem of displaying small text.  What
I have written works partially - it renders low density text on an
off-screen window.  It doesn't do what I /need/ it to - it pixeldoubles the
result to the destination window, and that just looks fugly.  Anyone have
any ideas?

static void WinPaintCharsSmall (const Char *chars, Int16 len, Coord x, Coord
y) {
  WinHandle tempWind, oldWindow;
  Err       Error;
  BitmapPtr bmpP;
  RectangleType r;
  UInt16    oldCoord;

  // First, do some setup.
  oldCoord = WinSetCoordinateSystem(kCoordinatesStandard);
  RctSetRectangle (&r, 0, 0, FntCharsWidth(chars, len), FntLineHeight());

  // Step 1: Create an off-screen, low-density window.
  tempWind = WinCreateOffscreenWindow (r.extent.x, r.extent.y,
genericFormat, &Error);
  bmpP = WinGetBitmap (tempWind);
  BmpSetDensity (bmpP, kDensityLow); // nessicary?

  // Step 2: Switch to said window.
  oldWindow = WinSetDrawWindow (tempWind);

  // Step 3: Draw the text to our temporary window.
  WinPaintChars (chars, len, 0, 0);

  // Step 4: Switch back to the original window.
  WinSetDrawWindow (oldWindow);

  // Step 5: Change the density of the window to high density.
  BmpSetDensity (bmpP, kDensityDouble); // not working?

  // Step 6: Draw the temporary window to the active one.
  WinSetCoordinateSystem(oldCoord);
  WinCopyRectangle (tempWind, oldWindow, &r, x, y, winPaint);

  // Step 7: Free the temporary window.
  WinDeleteWindow (tempWind, false);
}



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to