I found a post from Matthew Bevan at
http://www.escribe.com/computing/pcpqa/m75497.html that looked a bit easier.
I was able to further simplify his code to the following. Can anyone poke
holes at this code? - it appears to work for me :-)

void WinDrawCharsSmall(const Char *chars, Int16 len, Coord x, Coord y)
{
  WinHandle     tempWindow;
  WinHandle     oldWindow;
  Err           err;
  BitmapPtr     bmpP;
  BitmapTypeV3 *bmpHDP;

  // Step 1: Create an off-screen, low-density window.
  tempWindow =
    WinCreateOffscreenWindow(FntCharsWidth(chars, len),
                             FntCharHeight(),
                             genericFormat, &err);
  bmpP = WinGetBitmap(tempWindow);

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

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

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

  // Step 5: Create a HD bitmap from the window.
  bmpHDP = BmpCreateBitmapV3(bmpP, kDensityDouble,
                             BmpGetBits(bmpP), NULL);

  // Step 6: Draw the temporary bitmap to the active window.
  WinDrawBitmap((BitmapPtr)bmpHDP, x, y);

  // Step 7: Free the temporary window and bitmap.
  WinDeleteWindow (tempWindow, false);
  BmpDelete ((BitmapPtr)bmpHDP);
}


Thanks...

Dave

> "Dave Lasker" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > I am in the process of figuring out how to use high-density mode
> myself,
> so
> > maybe we can help each other. Here's what I've found so far:
> >
> > Go to http://kb.palmsource.com and search on "tiny". You will find an
> > article titled "Creating Teeny Tiny Fonts in OS 5". At the bottom of
> the
> > article is a link to download example code. The example includes
> 1/2-size
> > versions of the 4 standard PalmOS fonts that you can add to your app.
> >
> > Option 2: in the palm-dev-forum are a couple of postings that explain
> how
> to
> > shrink the built-in fonts by writing them to an off-screen window,
> then
> > reading back the resulting bits. Take a look at
> > http://www.escribe.com/computing/pcpqa/m68206.html
> >
> > Caveat: I've not tried to use either of these yet. I'm leaning towards
> the
> > 2nd approach as it should use less memory. However, the first method
> of
> > adding the new fonts is much more general and easy to use.
> >
> > Hope that helps...
> >
> > Dave
> > "Richard Coutts" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > >
> > > Codewarrior 8.2 & Constructor 1.8
> > >
> > > I need a tiny font for my application.  I just read up on custom
> fonts
> in
> > > The Bible and have a couple of questions.  As far as I can tell, the
> > > smallest font native to the Palm is the stdFont.  I'd like something
> much
> > > smaller.  E.g., I see AvantGo has a couple small fonts, one of which
> is
> > > tiny, but still very legible.
> > >
> > > Are any of these small fonts publicly available?  Also, I've never
> worked
> > > with custom fonts before, so if there's any pitfalls or tips, I'd
> > appreciate
> > > hearing about them.
> > >
> > > Thanks!
> > > Rich
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
>
>
>
>



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

Reply via email to