[futurebasic] Re: [FB] increasing/decreasing fontsize by one point in a styl

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Fri, 18 Jun 99 22:44:46 -0500
>i need to do the font-size changes within futurebasic,
>programatically, not in resedit or resourcer.
>
>and it needs to be for a styled edit field, where this code 
>simply returns a -1 for the size (to indicate the field is styled):
>>   editFieldHandle& = TEHANDLE(efNum)
>>   mySize% = editFieldHandle&..teSize%
>
>finally, i needs to apply this only to the user-specified
>selected text, not to all the text in the field.
>

Bowerbird,

I suspect what you are looking for are these toolbox calls:

CALL TEGETSTYLE (byte%,txtStyleRec,lineH%,ascent%,teH&)
CALL TESETSTYLE (mode%,txtStyleRec,redraw%,teH&)

The txtStyleRec is an indeterminate-length record, so I'm guessing that 
FB probably wants a handle here, rather than the actual record--you'd 
have to experiment unless someone else can tell us.

The format of txtStyleRec is this, if I translated IM correctly:

DIM RECORD styleRun
  DIM startChar%   'starting char pos
  DIM styleIndex%  'index in style table
DIM END RECORD .styleRunSize

DIM RECORD txtStyleRec
  DIM nRuns%       'number of style runs
  DIM nStyles      'number of distinct styles in table
  DIM styleTabH&   'handle to style table
  DIM lhTabH&      'handle to line-height table
  DIM teRefCon&    'reserved for application use
  DIM nullStyleH&  'handle to style set at null selection
DIM END RECORD .runsOffset

The txtStyleRec is followed by an array of styleRuns, which you could 
access with
  DIM stylH&, stylPtr&
  DIM  styleRuns&
  XREF styleRuns.styleRunSize(99)

  stylRecH&    = TeH&..txFont&  'handle takes place of txFont% & txFace%
  stylRecPtr&  = [stylRecH&]    'should probably lock first
  styleRuns&   = stylRecPtr&+.runsOffset

I'm beginning to realize you really need all the IM info to do this 
right. It's complex, but not really difficult. If you have IM, I'm sure 
you can manage it. As I recall, you originally asked for quick, but not 
easy. Good luck.

 0"0
 =J= a  y
  "