Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
38918 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425/*26*27*28* (C) Copyright IBM Corp. 2002 - All Rights Reserved29*30*/3132#include "LETypes.h"33#include "OpenTypeTables.h"34#include "GlyphSubstitutionTables.h"35#include "LookupProcessor.h"36#include "ExtensionSubtables.h"37#include "GlyphIterator.h"38#include "LESwaps.h"3940U_NAMESPACE_BEGIN4142// read a 32-bit value that might only be 16-bit-aligned in memory43#define READ_LONG(code) (le_uint32)((SWAPW(*(le_uint16*)&code) << 16) + SWAPW(*(((le_uint16*)&code) + 1)))4445// FIXME: should look at the format too... maybe have a sub-class for it?46le_uint32 ExtensionSubtable::process(const LEReferenceTo<ExtensionSubtable> &thisRef,47const LookupProcessor *lookupProcessor, le_uint16 lookupType,48GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const49{50if (LE_FAILURE(success)) {51return 0;52}5354le_uint16 elt = SWAPW(extensionLookupType);5556if (elt != lookupType) {57le_uint32 extOffset = READ_LONG(extensionOffset);58LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset);5960if(LE_SUCCESS(success)) {61return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);62}63}6465return 0;66}6768U_NAMESPACE_END697071