programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: changing fonts and sizes II

From: Glenn Dixon <dixong_at_networld.com>
Date: Fri, 30 May 2003 08:47:31 -0600

HTML may be a good choice. There are lots of things out there that
understand HTML, so you aren't necessarily restricted to something
like Internet Explorer. I don't think it's too time-efficient and it
certainly is a pain to put in all those tags.

The reason the Forth window changes all text to the new font is simply
because it reprints the whole screen in whatever font is selected
every time the screen is scrolled (I think). Your program need not do
this. If you wish different fonts on a per-cell basis for example,
keep the handle of the desired font in each cell's data structure, and
invoke SelectObject with the font handle just before printing that
cell. Just remember to do this every time you repaint your window and
it should come out just fine: you will be able to display many fonts
simultaneously in a single window.

This is a fairly common technique regardless of programming language,
along with setting justification of text with SetTextAlign just before
it is printed. So common, in fact, that you may wish to write a
special word that takes a font, text string and justification flags
and prints the proper stuff.

Also remember that some fonts have a fixed width for each character,
such as the SYSTEM_FIXED_FONT (used in the Forth window), but most
don't, meaning you can't easily predict how long your displayed sring
will be if you use proportionally spaced fonts. You must also
remember to erase the cell space somehow before printing, or you may
see leftovers of a previous string to the right of a newer, shorter
one.

I have also seen each cell of a (simple) system implemented with a
separate child window, each with its own device context, font, etc.
This seems a bit high overhead to me, but it is done, and makes mouse
events and other stuff easier.

Good luck,
Glenn

-----Original Message-----
From: "Allen Anway" <allen_at_a2d2.com>
To: <sftalk_at_forth.com>
Date: Thu, 29 May 2003 14:25:00 -0500
Subject: [sftalk] changing fonts and sizes II

> Thanks to Glenn Dixon for his help. I tried his program on the
> SwiftForth window and observed that it changed the font and made it
> smaller. Also the active width for the window became smaller along
> with the characters. Characters emitted in the past before the font
> change became smaller also.
> My ultimate goal, which may be too complex, is to make an invoicing
> program. My desire is to be able to print any font anywhere just as
> my cheap CAD/CAM program does, and maybe a horizontal or vertical
> line or two. Other people skilled in the art tell me that the only
> language that can do this is unreadable. I was hoping SwiftForth
> could save the day.
>
> Best wishes to all
>
> ---------------------------------------------------------------------
> -
> sftalk_at_forth.com The SwiftForth programming discussion email
> list
> To unsubscribe, send subject "unsubscribe" to
> sftalk-request_at_forth.com
> For list command help, send subject "help" to
> sftalk-request_at_forth.com
> Message archives are located at http://www.forth.com/archive/sftalk
> ---------------------------------------------------------------------
> -
> This list is a forum for SwiftForth users. For product support and
> bug
> reports, please send email to support_at_forth.com
> ---------------------------------------------------------------------
> -
>

*********************************
Get your free E-Mail and Homepage
Go to http://www.networld.com
*********************************

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri May 30 2003 - 08:21:12 PDT

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:32 PST