os/textandloc/fontservices/textshaperplugin/IcuSource/layout/SinglePositioningSubtables.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
 *
sl@0
     3
 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
sl@0
     4
 *
sl@0
     5
 */
sl@0
     6
sl@0
     7
#include "LETypes.h"
sl@0
     8
#include "LEFontInstance.h"
sl@0
     9
#include "OpenTypeTables.h"
sl@0
    10
#include "GlyphPositioningTables.h"
sl@0
    11
#include "SinglePositioningSubtables.h"
sl@0
    12
#include "ValueRecords.h"
sl@0
    13
#include "GlyphIterator.h"
sl@0
    14
#include "LESwaps.h"
sl@0
    15
sl@0
    16
U_NAMESPACE_BEGIN
sl@0
    17
sl@0
    18
le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
sl@0
    19
{
sl@0
    20
    switch(SWAPW(subtableFormat))
sl@0
    21
    {
sl@0
    22
    case 0:
sl@0
    23
        return 0;
sl@0
    24
sl@0
    25
    case 1:
sl@0
    26
    {
sl@0
    27
        const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this;
sl@0
    28
sl@0
    29
        return subtable->process(glyphIterator, fontInstance);
sl@0
    30
    }
sl@0
    31
sl@0
    32
    case 2:
sl@0
    33
    {
sl@0
    34
        const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this;
sl@0
    35
sl@0
    36
        return subtable->process(glyphIterator, fontInstance);
sl@0
    37
    }
sl@0
    38
sl@0
    39
    default:
sl@0
    40
        return 0;
sl@0
    41
    }
sl@0
    42
}
sl@0
    43
sl@0
    44
le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
sl@0
    45
{
sl@0
    46
    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
sl@0
    47
    le_int32 coverageIndex = getGlyphCoverage(glyph);
sl@0
    48
sl@0
    49
    if (coverageIndex >= 0) {
sl@0
    50
        valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
sl@0
    51
sl@0
    52
        return 1;
sl@0
    53
    }
sl@0
    54
sl@0
    55
    return 0;
sl@0
    56
}
sl@0
    57
sl@0
    58
le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
sl@0
    59
{
sl@0
    60
    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
sl@0
    61
    le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
sl@0
    62
sl@0
    63
    if (coverageIndex >= 0) {
sl@0
    64
        valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
sl@0
    65
sl@0
    66
        return 1;
sl@0
    67
    }
sl@0
    68
sl@0
    69
    return 0;
sl@0
    70
}
sl@0
    71
sl@0
    72
U_NAMESPACE_END