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. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26/* 27 * 28 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved 29 * 30 */ 31 32#include "LETypes.h" 33#include "OpenTypeTables.h" 34#include "Lookups.h" 35#include "CoverageTables.h" 36#include "LESwaps.h" 37 38U_NAMESPACE_BEGIN 39 40const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const 41{ 42 LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount)); 43 44 if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) { 45 success = LE_INDEX_OUT_OF_BOUNDS_ERROR; 46 return LEReferenceTo<LookupTable>(); 47 } else { 48 return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success))); 49 } 50} 51 52const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const 53{ 54 LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount)); 55 56 if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) { 57 success = LE_INDEX_OUT_OF_BOUNDS_ERROR; 58 return LEReferenceTo<LookupSubtable>(); 59 } else { 60 return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success))); 61 } 62} 63 64le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const 65{ 66 const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset)); 67 68 if(LE_FAILURE(success)) return 0; 69 70 return coverageTable->getGlyphCoverage(coverageTable, glyphID, success); 71} 72 73U_NAMESPACE_END 74