J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 3 | * |
| 4 | * This code is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License version 2 only, as |
| 6 | * published by the Free Software Foundation. Sun designates this |
| 7 | * particular file as subject to the "Classpath" exception as provided |
| 8 | * by Sun in the LICENSE file that accompanied this code. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | * version 2 for more details (a copy is included in the LICENSE file that |
| 14 | * accompanied this code). |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License version |
| 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | * |
| 20 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 21 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 22 | * have any questions. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * |
| 28 | * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved |
| 29 | * |
| 30 | */ |
| 31 | |
| 32 | #include "LETypes.h" |
| 33 | #include "LEFontInstance.h" |
| 34 | #include "OpenTypeTables.h" |
| 35 | #include "GlyphPositioningTables.h" |
| 36 | #include "SinglePositioningSubtables.h" |
| 37 | #include "ValueRecords.h" |
| 38 | #include "GlyphIterator.h" |
| 39 | #include "LESwaps.h" |
| 40 | |
| 41 | le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const |
| 42 | { |
| 43 | switch(SWAPW(subtableFormat)) |
| 44 | { |
| 45 | case 0: |
| 46 | return 0; |
| 47 | |
| 48 | case 1: |
| 49 | { |
| 50 | const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this; |
| 51 | |
| 52 | return subtable->process(glyphIterator, fontInstance); |
| 53 | } |
| 54 | |
| 55 | case 2: |
| 56 | { |
| 57 | const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this; |
| 58 | |
| 59 | return subtable->process(glyphIterator, fontInstance); |
| 60 | } |
| 61 | |
| 62 | default: |
| 63 | return 0; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const |
| 68 | { |
| 69 | LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
| 70 | le_int32 coverageIndex = getGlyphCoverage(glyph); |
| 71 | |
| 72 | if (coverageIndex >= 0) { |
| 73 | valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); |
| 74 | |
| 75 | return 1; |
| 76 | } |
| 77 | |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const |
| 82 | { |
| 83 | LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
| 84 | le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph); |
| 85 | |
| 86 | if (coverageIndex >= 0) { |
| 87 | valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, |
| 88 | *glyphIterator, fontInstance); |
| 89 | |
| 90 | return 1; |
| 91 | } |
| 92 | |
| 93 | return 0; |
| 94 | } |