/*====================================================================
NOTE: You may find that text doesn't line up properly unless you use the New Century Schoolbook Roman typeface, since this was created with it.

INFORMATION:
	This is $Revision: 1.5 $ of this file
	It was last modified by $Author: death $ on $Date: 93/04/04 23:28:11 $
 	$Log:	NeXTToMacRTFText.m,v $
Revision 1.5  93/04/04  23:28:11  death
Sun Apr  4 23:28:11 PDT 1993

Revision 1.4  93/02/21  11:59:53  death
Sun Feb 21 11:59:53 PST 1993

Revision 1.3  93/01/10  08:27:20  death
Sun Jan 10 08:27:20 PST 1993

Revision 1.2  93/01/02  23:41:30  death
Sat Jan  2 23:41:30 PST 1993

Revision 1.1  93/01/02  13:38:59  death
Sat Jan  2 13:38:59 PST 1993

Revision 1.1  92/12/13  10:01:01  death
Sun Dec 13 10:01:00 PST 1992
====================================================================*/

#import "NeXTToMacRTFText.h"

@implementation NeXTToMacRTFText


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	Routine:		ConvertCharacter:
//	Parameters:	a character to be converted
//	Returns:		the converted character
//	Stores:		the character that we are returning.
//	Description:
//		This uses the ConvertArray set up in the initialization to convert
//		a character from a NeXT form to a Macintosh form.  Unlike the Mac rtf
//		converter, if we get a nullcharacter back, we don't have the ability to use
//		symbol instead.  As a result, there are a fair number of characters this will
//		not be able to convert, and it will just return them as themselves.
//		Note, we return a value in SECOND_RESULT concerning Symbol font usage.
//		This is to maintain an identical interface with MacToNeXTRTFText, and not
//		because we do anything with it.
//	Bugs:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (Character) ConvertCharacter: (Character) theCharacter
{
	Character	result;
	Boolean		couldconvert = YES;
	[self ResetResults];

	//
	//	In general, look up our result in the conversion array.  if we get a
	//	null back (and we don't didn't pass a null), indicate we could not convet properly.
	//
	result = ConvertArray[theCharacter];
	if ((result == NullCharacter) &&  (theCharacter != NullCharacter))
	{
		couldconvert = NO;
		result = theCharacter;
	}
	//
	//	Store the result, and return.  Put NO into the second result, showing that
	//	we did not/could not invoke the use of symbol to allow the char to be converted.
	//
	[self	  PutCharacter: result Into: FIRST_RESULT];
	[self  	PutBoolean: NO Into: SECOND_RESULT];

	if (couldconvert == YES)
		[self	StoreErrorCode: errOK AndText: "Character converted!"];
	else
		[self	StoreErrorCode: errCANTMAPTOONE
			AndText: "No equivalent standard Macintosh character"];
	return result;
}

@end
