Beispiel #1
0
static
void
swapsb(struct sfs_super *sp)
{
	sp->sp_magic = SWAPL(sp->sp_magic);
	sp->sp_nblocks = SWAPL(sp->sp_nblocks);
}
StateTableProcessor2::StateTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
  : SubtableProcessor2(morphSubtableHeader, success), 
    dir(1),
    format(0),
    nClasses(0), 
    classTableOffset(0), 
    stateArrayOffset(0), 
    entryTableOffset(0), 
    classTable(), 
    stateArray(),
    stateTableHeader(morphSubtableHeader, success),
    stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader)
{
  if (LE_FAILURE(success)) {
    return;
  }
  nClasses = SWAPL(stHeader->nClasses);
  classTableOffset = SWAPL(stHeader->classTableOffset);
  stateArrayOffset = SWAPL(stHeader->stateArrayOffset);
  entryTableOffset = SWAPL(stHeader->entryTableOffset);
  
  classTable = LEReferenceTo<LookupTableBase>(stHeader, success, classTableOffset);
  format = SWAPW(classTable->format);
  
  stateArray = LEReferenceToArrayOf<EntryTableIndex2>(stHeader, success, stateArrayOffset, LE_UNBOUNDED_ARRAY);
}
Beispiel #3
0
void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const
{
    const ChainHeader *chainHeader = chains;
    le_uint32 chainCount = SWAPL(this->nChains);
    le_uint32 chain;

    for (chain = 0; chain < chainCount; chain += 1) {
        FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
        le_uint32 chainLength = SWAPL(chainHeader->chainLength);
        le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
        le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
        const MorphSubtableHeader *subtableHeader =
            (const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries];
        le_int16 subtable;

        for (subtable = 0; subtable < nSubtables; subtable += 1) {
            le_int16 length = SWAPW(subtableHeader->length);
            SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
            FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);

            // should check coverage more carefully...
            if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) {
                subtableHeader->process(glyphStorage);
            }

            subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length);
        }

        chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength);
    }
}
SubtableProcessor2::SubtableProcessor2(const MorphSubtableHeader2 *morphSubtableHeader)
{
    subtableHeader = morphSubtableHeader;

    length = SWAPL(subtableHeader->length);
    coverage = SWAPL(subtableHeader->coverage);
    subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
}
SubtableProcessor2::SubtableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
  : subtableHeader(morphSubtableHeader, success), length(0), coverage(0), subtableFeatures(0L)
{
  if(LE_FAILURE(success)) return;

  length = SWAPL(subtableHeader->length);
  coverage = SWAPL(subtableHeader->coverage);
  subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
}
LigatureSubstitutionProcessor2::LigatureSubstitutionProcessor2(const MorphSubtableHeader2 *morphSubtableHeader)
  : StateTableProcessor2(morphSubtableHeader)
{
    ligatureSubstitutionHeader = (const LigatureSubstitutionHeader2 *) morphSubtableHeader;
    ligActionOffset = SWAPL(ligatureSubstitutionHeader->ligActionOffset);
    componentOffset = SWAPL(ligatureSubstitutionHeader->componentOffset);
    ligatureOffset = SWAPL(ligatureSubstitutionHeader->ligatureOffset);

    entryTable = (const LigatureSubstitutionStateEntry2 *) ((char *) &stateTableHeader->stHeader + entryTableOffset);
}
Beispiel #7
0
int __glXCallListsReqSize(GLbyte *pc, Bool swap )
{
    GLsizei n = *(GLsizei *)(pc + 0);
    GLenum type = *(GLenum *)(pc + 4);

    if (swap) {
	n = SWAPL( n );
	type = SWAPL( type );
    }
    return n * __glCallLists_size( type );
}
Beispiel #8
0
LigatureSubstitutionProcessor2::LigatureSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
  : StateTableProcessor2(morphSubtableHeader, success),
  ligActionOffset(0),
  ligatureSubstitutionHeader(morphSubtableHeader, success), componentOffset(0), ligatureOffset(0), entryTable()
{
    if (LE_FAILURE(success)) return;

    ligActionOffset = SWAPL(ligatureSubstitutionHeader->ligActionOffset);
    componentOffset = SWAPL(ligatureSubstitutionHeader->componentOffset);
    ligatureOffset = SWAPL(ligatureSubstitutionHeader->ligatureOffset);

    entryTable = LEReferenceToArrayOf<LigatureSubstitutionStateEntry2>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY);
}
Beispiel #9
0
int __glXMap1fReqSize(GLbyte *pc, Bool swap )
{
    GLenum target;
    GLint order, k;

    target = *(GLenum *)(pc + 0);
    order = *(GLint *)(pc + 12);
    if (swap) {
	target = SWAPL( target );
	order = SWAPL( order );
    }
    k = __glMap1f_size(target);
    return 4 * Map1Size(k, order);
}
Beispiel #10
0
int __glXMap2fReqSize(GLbyte *pc, Bool swap )
{
    GLenum target;
    GLint uorder, vorder, k;

    target = *(GLenum *)(pc + 0);
    uorder = *(GLint *)(pc + 12);
    vorder = *(GLint *)(pc + 24);
    if (swap) {
	target = SWAPL( target );
	uorder = SWAPL( uorder );
	vorder = SWAPL( vorder );
    }
    k = __glMap2f_size( target );
    return 4 * Map2Size( k, uorder, vorder );
}
Beispiel #11
0
int __glXMap2dReqSize(GLbyte *pc, Bool swap )
{
    GLenum target;
    GLint uorder, vorder, k;

    target = *(GLenum *)(pc + 32);
    uorder = *(GLint *)(pc + 36);
    vorder = *(GLint *)(pc + 40);
    if (swap) {
	target = SWAPL( target );
	uorder = SWAPL( uorder );
	vorder = SWAPL( vorder );
    }
    k = __glMap2d_size( target );
    return 8 * Map2Size( k, uorder, vorder );
}
Beispiel #12
0
int
__glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen)
{
    GLenum target;
    GLint order;

    target = *(GLenum *) (pc + 0);
    order = *(GLint *) (pc + 12);
    if (swap) {
        target = SWAPL(target);
        order = SWAPL(order);
    }
    if (order < 1)
        return -1;
    return safe_mul(4, safe_mul(__glMap1f_size(target), order));
}
Beispiel #13
0
int
__glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen)
{
    GLenum target;
    GLint uorder, vorder;

    target = *(GLenum *) (pc + 32);
    uorder = *(GLint *) (pc + 36);
    vorder = *(GLint *) (pc + 40);
    if (swap) {
        target = SWAPL(target);
        uorder = SWAPL(uorder);
        vorder = SWAPL(vorder);
    }
    return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder));
}
Beispiel #14
0
int
peek_length (char const *file)
{
  int             fd, len;
/*  char		  buff[4]; */
  int buff;

  if ((fd = open (file, O_RDONLY, 0644)) < 0)
  {
    char temp[200];

    sprintf (temp, "peek_length: '%s'",file);
    perror (temp);
    return -1;
  }
  if (read (fd, &buff, 4) != 4)
  {
    fprintf (stderr, "peek_length: %s: can't read length\n", file);
    close (fd);
    return -1;
  }
  SWAPL(&buff);
  close(fd);
/*  len = buff[0] << 24 | buff[1] << 16 | buff[2] << 8 | buff[3]; */
  len = buff;
  if (len < 0)
    fprintf (stderr, "Warning: peek_length: %s: length(%d) < 0\n", file, len);
  return len;
}
Beispiel #15
0
int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap )
{
    GLenum pname = *(GLenum *)(pc + 4);
    if (swap) {
	pname = SWAPL( pname );
    }
    return 4 * __glTexEnvfv_size( pname );	/* defined in samplegl lib */
}
Beispiel #16
0
int __glXLightModelfvReqSize(GLbyte *pc, Bool swap )
{
    GLenum pname = *(GLenum *)(pc + 0);
    if (swap) {
	pname = SWAPL( pname );
    }
    return 4 * __glLightModelfv_size( pname );	/* defined in samplegl lib */
}
Beispiel #17
0
static
void
swapindir(uint32_t *entries)
{
	int i;
	for (i=0; i<SFS_DBPERIDB; i++) {
		entries[i] = SWAPL(entries[i]);
	}
}
Beispiel #18
0
static int
fwrite_long(FILE *fp, int32 i)
{
    SWAPL(&i);
    if (fwrite (&i, sizeof(int32), 1, fp) != 1)
	return S3_ERROR;
    else
	return S3_SUCCESS;
}
Beispiel #19
0
static
void
writesuper(const char *volname, uint32_t nblocks)
{
	struct sfs_super sp;

	bzero((void *)&sp, sizeof(sp));

	if (strlen(volname) >= SFS_VOLNAME_SIZE) {
		errx(1, "Volume name %s too long", volname);
	}

	sp.sp_magic = SWAPL(SFS_MAGIC);
	sp.sp_nblocks = SWAPL(nblocks);
	strcpy(sp.sp_volname, volname);

	diskwrite(&sp, SFS_SB_LOCATION);
}
Beispiel #20
0
int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap )
{
    GLint mapsize;
    mapsize = *(GLint *)(pc + 4);
    if (swap) {
	mapsize = SWAPL( mapsize );
    }
    return 2 * mapsize;
}
U_NAMESPACE_BEGIN

void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
{
  le_uint32 chainCount = SWAPL(this->nChains);
  LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header
    LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount);
    le_uint32 chain;

    for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) {
        if (chain > 0) {
            le_uint32 chainLength = SWAPL(chainHeader->chainLength);
            if (chainLength & 0x03) { // incorrect alignment for 32 bit tables
                success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
                return;
            }
            chainHeader.addOffset(chainLength, success);
        }
        FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
        le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
        le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
        LEReferenceTo<MorphSubtableHeader> subtableHeader =
          LEReferenceTo<MorphSubtableHeader>(chainHeader,success, &(chainHeader->featureTable[nFeatureEntries]));
        le_int16 subtable;

        for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) {
            if (subtable > 0) {
                le_int16 length = SWAPW(subtableHeader->length);
                if (length & 0x03) { // incorrect alignment for 32 bit tables
                    success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
                    return;
                }
                subtableHeader.addOffset(length, success);
            }
            SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
            FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);

            // should check coverage more carefully...
            if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0  && LE_SUCCESS(success)) {
              subtableHeader->process(subtableHeader, glyphStorage, success);
            }
        }
    }
}
Beispiel #22
0
int
awritefloat (char *file,
	     float *data,
	     int length)
{
  int             fd;
  int             size;
  int             offset;

  if ((fd = open (file, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0644)) < 0)
  {
    fprintf (stderr, "awritefloat: %s: can't create\n", file);
    perror("");
    return -1;
  }

  SWAPL(&length);
  if (write (fd, (char *) &length, 4) != 4)
  {
    fprintf (stderr, "awritefloat: %s: can't write length\n", file);
    perror("");
    close (fd);
    return -1;
  }
  SWAPL(&length);

  for(offset = 0; offset < length; offset++)
    SWAPF(data + offset);
  size = length * sizeof (float);
  if (write (fd, (char *) data, size) != size)
  {
    fprintf (stderr, "awritefloat: %s: can't write data\n", file);
    perror("");
    close (fd);
    return (-1);
  }
  for(offset = 0; offset < length; offset++)
    SWAPF(data + offset);

  printf ("Wrote %d floats in %s.\n", length, file);
  close (fd);
  return length;
}
Beispiel #23
0
int
__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
{
    __GLXdispatchConvolutionFilterHeader *hdr =
        (__GLXdispatchConvolutionFilterHeader *) pc;

    GLint image1size, image2size;
    GLenum format = hdr->format;
    GLenum type = hdr->type;
    GLint w = hdr->width;
    GLint h = hdr->height;
    GLint rowLength = hdr->rowLength;
    GLint alignment = hdr->alignment;

    if (swap) {
        format = SWAPL(format);
        type = SWAPL(type);
        w = SWAPL(w);
        h = SWAPL(h);
        rowLength = SWAPL(rowLength);
        alignment = SWAPL(alignment);
    }

    /* XXX Should rowLength be used for either or both image? */
    image1size = __glXImageSize(format, type, 0, w, 1, 1,
                                0, rowLength, 0, 0, alignment);
    image2size = __glXImageSize(format, type, 0, h, 1, 1,
                                0, rowLength, 0, 0, alignment);
    return safe_add(safe_pad(image1size), image2size);
}
U_NAMESPACE_BEGIN

ContextualGlyphInsertionProcessor2::ContextualGlyphInsertionProcessor2(const LEReferenceTo<StateTableHeader2> &header, le_int32 dir, LEErrorCode &success)
    : StateTableProcessor2(header, dir, success),
      contextualGlyphInsertionHeader(header, success)
{
    if (LE_FAILURE(success))
        return;

    le_uint32 insertionActionOffset = SWAPL(contextualGlyphInsertionHeader->insertionActionOffset);
    entryTable      = LEReferenceToArrayOf<ContextualGlyphInsertionStateEntry2>(stateTableHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY);
    insertionAction = LEReferenceToArrayOf<le_uint16>(stateTableHeader, success, insertionActionOffset, LE_UNBOUNDED_ARRAY);
}
Beispiel #25
0
static
void
writerootdir(void)
{
	struct sfs_inode sfi;

	bzero((void *)&sfi, sizeof(sfi));

	sfi.sfi_size = SWAPL(0);
	sfi.sfi_type = SWAPS(SFS_TYPE_DIR);
	sfi.sfi_linkcount = SWAPS(1);

	diskwrite(&sfi, SFS_ROOT_LOCATION);
}
U_NAMESPACE_BEGIN


// FIXME: should look at the format too... maybe have a sub-class for it?
le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
                                      GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
{
    le_uint16 elt = SWAPW(extensionLookupType);

    if (elt != lookupType) {
        le_uint32 extOffset = SWAPL(extensionOffset);
        LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset);

        return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance);
    }

    return 0;
}
Beispiel #27
0
static
void
swapinode(struct sfs_inode *sfi)
{
	int i;

	sfi->sfi_size = SWAPL(sfi->sfi_size);
	sfi->sfi_type = SWAPS(sfi->sfi_type);
	sfi->sfi_linkcount = SWAPS(sfi->sfi_linkcount);

	for (i=0; i<SFS_NDIRECT; i++) {
		sfi->sfi_direct[i] = SWAPL(sfi->sfi_direct[i]);
	}

#ifdef SFS_NIDIRECT
	for (i=0; i<SFS_NIDIRECT; i++) {
		sfi->sfi_indirect[i] = SWAPL(sfi->sfi_indirect[i]);
	}
#else
	sfi->sfi_indirect = SWAPL(sfi->sfi_indirect);
#endif

#ifdef SFS_NDIDIRECT
	for (i=0; i<SFS_NDIDIRECT; i++) {
		sfi->sfi_dindirect[i] = SWAPL(sfi->sfi_dindirect[i]);
	}
#else
#ifdef HAS_DIDIRECT
	sfi->sfi_dindirect = SWAPL(sfi->sfi_dindirect);
#endif
#endif

#ifdef SFS_NTIDIRECT
	for (i=0; i<SFS_NTIDIRECT; i++) {
		sfi->sfi_tindirect[i] = SWAPL(sfi->sfi_tindirect[i]);
	}
#else
#ifdef HAS_TIDIRECT
	sfi->sfi_tindirect = SWAPL(sfi->sfi_tindirect);
#endif
#endif
}
Beispiel #28
0
void MorphSubtableHeader2::process(const LEReferenceTo<MorphSubtableHeader2> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
{
    SubtableProcessor2 *processor = NULL;

    switch (SWAPL(coverage) & scfTypeMask2)
    {
    case mstIndicRearrangement:
        processor = new IndicRearrangementProcessor2(base, success);
        break;

    case mstContextualGlyphSubstitution:
        processor = new ContextualGlyphSubstitutionProcessor2(base, success);
        break;

    case mstLigatureSubstitution:
        processor = new LigatureSubstitutionProcessor2(base, success);
        break;

    case mstReservedUnused:
        break;

    case mstNonContextualGlyphSubstitution:
        processor = NonContextualGlyphSubstitutionProcessor2::createInstance(base, success);
        break;

    
    case mstContextualGlyphInsertion:
        processor = new ContextualGlyphInsertionProcessor2(base, success);
        break;

    default:
        return;
        break; /*NOTREACHED*/
    }

    if (processor != NULL) {
      processor->process(glyphStorage, success);
        delete processor;
    } else {
      if(LE_SUCCESS(success)) {
        success = LE_MEMORY_ALLOCATION_ERROR; // because ptr is null and we didn't break out.
      }
    }
}
Beispiel #29
0
static
void
swapdir(struct sfs_dir *sfd)
{
	sfd->sfd_ino = SWAPL(sfd->sfd_ino);
}
Beispiel #30
0
LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
{
    static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG;
    static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG;
    static const le_uint32 morxTableTag = LE_MORX_TABLE_TAG;

    if (LE_FAILURE(success)) {
        return NULL;
    }

    LEReferenceTo<GlyphSubstitutionTableHeader> gsubTable(fontInstance,gsubTableTag,success);
    LayoutEngine *result = NULL;
    LETag scriptTag   = 0x00000000;
    LETag languageTag = 0x00000000;
    LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode);

    // Right now, only invoke V2 processing for Devanagari.  TODO: Allow more V2 scripts as they are
    // properly tested.

    if ( v2ScriptTag == dev2ScriptTag && gsubTable.isValid() && gsubTable->coversScript(gsubTable, v2ScriptTag, success )) {
      result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success);
    }
    else if (gsubTable.isValid() && gsubTable->coversScript(gsubTable, scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode), success)) {
        switch (scriptCode) {
        case bengScriptCode:
        case devaScriptCode:
        case gujrScriptCode:
        case kndaScriptCode:
        case mlymScriptCode:
        case oryaScriptCode:
        case guruScriptCode:
        case tamlScriptCode:
        case teluScriptCode:
        case sinhScriptCode:
            result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, FALSE, gsubTable, success);
            break;

        case arabScriptCode:
            result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
            break;

        case hebrScriptCode:
            // Disable hebrew ligatures since they have only archaic uses, see ticket #8318
            result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags & ~kTypoFlagLiga, gsubTable, success);
            break;

        case hangScriptCode:
            result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
            break;

        case haniScriptCode:
            languageTag = OpenTypeLayoutEngine::getLangSysTag(languageCode);

            switch (languageCode) {
            case korLanguageCode:
            case janLanguageCode:
            case zhtLanguageCode:
            case zhsLanguageCode:
              if (gsubTable->coversScriptAndLanguage(gsubTable, scriptTag, languageTag, success, TRUE)) {
                    result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
                    break;
              }

                // note: falling through to default case.
            default:
                result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
                break;
            }

            break;

        case tibtScriptCode:
            result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
            break;

        case khmrScriptCode:
            result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
            break;

        default:
            result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
            break;
        }
    } else {
        LEReferenceTo<MorphTableHeader2> morxTable(fontInstance, morxTableTag, success);
        if (LE_SUCCESS(success) && morxTable.isValid() && SWAPL(morxTable->version)==0x00020000) {
          result = new GXLayoutEngine2(fontInstance, scriptCode, languageCode, morxTable, typoFlags, success);
        } else {
          LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success);
          if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort
            result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, mortTable, success);
            } else {
                switch (scriptCode) {
                    case bengScriptCode:
                    case devaScriptCode:
                    case gujrScriptCode:
                    case kndaScriptCode:
                    case mlymScriptCode:
                    case oryaScriptCode:
                    case guruScriptCode:
                    case tamlScriptCode:
                    case teluScriptCode:
                    case sinhScriptCode:
                    {
                        result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
                        break;
                    }

                    case arabScriptCode:
                        //case hebrScriptCode:
                        result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
                        break;

                        //case hebrScriptCode:
                        //    return new HebrewOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);

                    case thaiScriptCode:
                        result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
                        break;

                    case hangScriptCode:
                        result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
                        break;

                    default:
                        result = new LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
                        break;
                }
            }
        }
    }

    if (result && LE_FAILURE(success)) {
		delete result;
		result = NULL;
	}

    if (result == NULL) {
        success = LE_MEMORY_ALLOCATION_ERROR;
    }

    return result;
}