home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!mumbo.apple.com!gallant.apple.com!mtdew.apple.com!alexr
- From: alexr@apple.com (Alexander M. Rosenberg)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: popup menus in non-system font
- Message-ID: <1992Sep11.171032.18624@gallant.apple.com>
- Date: 11 Sep 92 17:10:32 GMT
- References: <1992Sep10.214027.7936@dcs.qmw.ac.uk>
- Sender: news@gallant.apple.com
- Organization: Hackers Anonymous
- Lines: 58
- X-Useragent: Nuntius v1.1.1d8
- X-Xxdate: Fri, 11 Sep 92 18:12:17 GMT
- X-Xxmessage-Id: <A6D6218197010C7C@mtdew.apple.com>
-
- In article <1992Sep10.214027.7936@dcs.qmw.ac.uk> Jeremy Roussak,
- jeremyr@dcs.qmw.ac.uk writes:
- >Now, this works a treat. Until, that is, I run an app like
- >MSWord (are there any?) or even, I am told, MacWrite IIJ. Then
- >(and sometimes for no apparent reason), although the font
- >changes for the popup, the size doesn't: it stays at 12 point.
- >Checking with MacsBug, SysFontSize is set to 9.
- >
- >The problem persists after running MSWord, even after quitting
- >it. Sometimes it will then go away again, but more often it
- >persists until I reboot.
-
- This is the result of some _very_ sloppy programming on the parts
- of Claris, Microsoft, etc.
-
- They have a custom MDEF that draws their cute little up-shift arrow
- symbol and the like. MDEFs draw in the Window Manager port. They
- change some values in that port and don't restore them.
-
- In particular, the text size field is frequently changed to 12.
- What was wrong:
-
- 1.) They changed the value of a system-wide structure for a specific
- purpose and didn't restore it.
-
- 1A.) (Only in some applications) Instead of using a trap to change these
- values, they slam them directly into the structure, despite years of
- Apple recommending otherwise.
-
- 2.) They typically set the font to 0 and the size to 12. This is incorrect.
- The system font is 0, and the system font size is 0. Size 12 is not correct
- for a Kanji system, for one.
-
- 3.) Your pop-up is drawn in the Window Manager Port by the sytem supplied
- MDEF. You've temporarily changed the system font and size to be the font
- and size you want. It ends up being drawn in the correct font at the size
- that the application slammed in in step 2, typically 12.
-
- What have we learned?
-
- 1.) Don't be a bad dog!
-
- 2.) Save and restore all system-wide things you change unless the intent
- is for the change to affect others.
-
- 3.) Listen carefully to the statements that DTS has to say.
-
- 4.) Save the current Window Manager port font and size and set them, via
- the correct _TextFont and _TextSize traps to 0 around your call to
- PopUpMenuSelect.
-
- 5.) The pop-up control in System 7 was fixed this way in System 7 Release 7.1.
- ---------------------------------------------------------------------------
- - Alexander M. Rosenberg - INTERNET: alexr@apple.com - Yoyodyne -
- - 330 Waverley St., Apt B - UUCP:ucbvax!apple!alexr - Propulsion -
- - Palo Alto, CA 94301 - - Systems -
- - (415) 329-8463 - Nobody is my employer so - :-) -
- - (408) 974-3110 - nobody cares what I say. - -
-