os/textandloc/fontservices/textshaperplugin/IcuSource/layout/CursiveAttachmentSubtables.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
 * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
sl@0
     3
 *
sl@0
     4
 */
sl@0
     5
sl@0
     6
#include "LETypes.h"
sl@0
     7
#include "OpenTypeTables.h"
sl@0
     8
#include "GlyphPositioningTables.h"
sl@0
     9
#include "CursiveAttachmentSubtables.h"
sl@0
    10
#include "AnchorTables.h"
sl@0
    11
#include "GlyphIterator.h"
sl@0
    12
#include "OpenTypeUtilities.h"
sl@0
    13
#include "LESwaps.h"
sl@0
    14
sl@0
    15
U_NAMESPACE_BEGIN
sl@0
    16
sl@0
    17
le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
sl@0
    18
{
sl@0
    19
    LEGlyphID glyphID       = glyphIterator->getCurrGlyphID();
sl@0
    20
    le_int32  coverageIndex = getGlyphCoverage(glyphID);
sl@0
    21
    le_uint16 eeCount       = SWAPW(entryExitCount);
sl@0
    22
sl@0
    23
    if (coverageIndex < 0 || coverageIndex >= eeCount) {
sl@0
    24
        glyphIterator->setCursiveGlyph();
sl@0
    25
        return 0;
sl@0
    26
    }
sl@0
    27
sl@0
    28
    LEPoint entryAnchor, exitAnchor;
sl@0
    29
    Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
sl@0
    30
    Offset exitOffset  = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
sl@0
    31
sl@0
    32
    if (entryOffset != 0) {
sl@0
    33
        const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset);
sl@0
    34
sl@0
    35
        entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
sl@0
    36
        glyphIterator->setCursiveEntryPoint(entryAnchor);
sl@0
    37
    }
sl@0
    38
sl@0
    39
    if (exitOffset != 0) {
sl@0
    40
        const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset);
sl@0
    41
sl@0
    42
        exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
sl@0
    43
        glyphIterator->setCursiveExitPoint(exitAnchor);
sl@0
    44
    }
sl@0
    45
sl@0
    46
    return 1;
sl@0
    47
}
sl@0
    48
sl@0
    49
U_NAMESPACE_END