[comp.sys.mac.programmer] FindScriptRun ?!$@!

ggiergiel@vmsa.oac.uci.edu (11/08/90)

Version 2.0 of Script Manager "documents"
a new script interface routine called FindScriptRun.
The thing is supposed to take a pointer to a block of
character codes and to return the first contiguous
script block within that text. 
The obvious question is: How does it determine which
script a character code belongs to?
I see no way this can be done. After all, characters do
not belong to any particular script, fonts do.

Could one of the authors of that documentation 
(Mark Davis, Sue Bartalo or John Harvey) be
kind enough to clarify that point for us, please.

J. Giergiel

chou@cs.washington.edu (Pai Chou) (11/08/90)

In article <27387FBD.12689@orion.oac.uci.edu> ggiergiel@vmsa.oac.uci.edu writes:
>Version 2.0 of Script Manager "documents"
>a new script interface routine called FindScriptRun.
>The thing is supposed to take a pointer to a block of
>character codes and to return the first contiguous
>script block within that text. 
>The obvious question is: How does it determine which
>script a character code belongs to?
>I see no way this can be done. After all, characters do
>not belong to any particular script, fonts do.
>
>Could one of the authors of that documentation 
>(Mark Davis, Sue Bartalo or John Harvey) be
>kind enough to clarify that point for us, please.
>
>J. Giergiel

I am not one of the authors, but I guess it is possible
if the text is associated with some TextEdit record.

If you have an old style TextEdit then you can figure out
whether the char is English or non-English by scanning for
the MSB.  If you have a new style TextEdit then you can figure
out from the font ID of the character.

If this assumption is correct then the FindScriptRun
routine can look at the hText fields of active textedit
records, compare pointers, and look at the TextEdit
record for font info.

I'm just guessing.  I'd be interested in finding out how this works too.

Pai Chou

lippin@twinkies.berkeley.edu (The Apathist) (11/08/90)

Recently ggiergiel@vmsa.oac.uci.edu wrote:

>Version 2.0 of Script Manager "documents" a new script interface
>routine called FindScriptRun.  The thing is supposed to take a pointer
>to a block of character codes and to return the first contiguous
>script block within that text.  The obvious question is: How does it
>determine which script a character code belongs to?

While I don't have the documentation at my fingertips, I believe that
FindScriptRun uses the current script system (according to
thePort^.txFont) to parse the text, which it then splits into script
runs.

So the text you pass it has to be all of the same script.  This leads
one to wonder as to the utility of FindScriptRun.

The solution to this puzzle lies in the fact that some (most?) script
systems are two--two--two scripts in one:  they contain roman
characters as well as the native ones.  FindScriptRun lets you find
the roman characters that don't belong.

					--Tom Lippincott
					  lippin@math.berkeley.edu

	"The living dead don't need to solve word problems!"
					--Calvin