Article View: comp.sys.mac
Article #39391Re: New Mac Programmer -- HELP! *Commentary added
From: Matt Mora
Date: Wed, 15 Mar 1989 19:21
Date: Wed, 15 Mar 1989 19:21
63 lines
2454 bytes
2454 bytes
In article <67@sppy00.UUCP> jmv@sppy00.UUCP (Jim Vickroy) writes:
>In article <3949@ece-csc.UUCP> jnh@ece-csc.UUCP (Joseph Nathan Hall) writes:
>=>beginning Mac programmer. If someone doesn't post a step-by-step
>=>description of how to do this in the next couple of days, I will.
>
>I have received several replys to this problem but haven't had a chance to
>try them yet. I will post what works when I get that chance.
>
>=>
>=>>2. Change the font of text in a window?
>=>>
>=>Easy. Use TextFont(fontnumber). See the QuickDraw chapter in IM I.
>
>I tried this but the font didn't change. I think, however, the problem is
>mine because I pass to TextFont what I get from LoWord. Probably wrong.
>
>[ commentary deleted for space ]
>
>I can't agree with you more. I feel I'm a fairly accomplished programmer
>(6+ years professionally on mainframes to micros) but I haven't been more
>frustrated than trying to figure out these two seemingly simple procedures.
>
If you are tring to get the fontnumber from a menu
to change the textfont of a grafport then
here is an example:
menuitem:=LoWord(the_menu_item_selected)
GetItem(menuhandle, menuitem, fontname);
GetFNum(fontname, fontnum);
TextFont(fontnum);
but if you are tring to change a TE Font
I had a problem with this in LSP.
I think the it would be
procedure CalcText; {procedure to fix line spacing}
var
fInfo: FontInfo;
begin
GetFontInfo(fInfo);
with fInfo, textH^^ do
begin
lineHeight := ascent + descent + leading;
fontAscent := ascent
end;
end;
menuitem:=LoWord(the_menu_item_selected)
GetItem(menuhandle, menuitem, fontname);
GetFNum(fontname, fontnum);
textH^^.txFont := fontnum;
textfont(fontnum);
CalcText; {call this to fix the line spacing}
TECalText(textH);
InvalRect(myWindow^.portrect); {force an update}
I Hope This Helps
Matt Mora
SRI International
Technical Details
Message-ID:
<28612@sri-unix.SRI.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!rutgers!sri-unix!storesReferences:
<64@sppy00.UUCP> <3949@ece-csc.UUCP> <67@sppy00.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!rutgers!sri-unix!stores From: stores@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Re: New Mac Programmer -- HELP! *Commentary added Keywords: Mac, Macintosh, Help, Programming, @%^#%$ Message-ID: <28612@sri-unix.SRI.COM> Date: 15 Mar 89 19:21:55 GMT References: <64@sppy00.UUCP> <3949@ece-csc.UUCP> <67@sppy00.UUCP> Reply-To: stores@unix.sri.com (Matt Mora) Distribution: na Organization: SRI, Menlo Park, CA. Lines: 63