Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.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* (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved27*28*/2930#include "LETypes.h"31#include "OpenTypeTables.h"32#include "GlyphPositioningTables.h"33#include "CursiveAttachmentSubtables.h"34#include "AnchorTables.h"35#include "GlyphIterator.h"36#include "OpenTypeUtilities.h"37#include "LESwaps.h"3839U_NAMESPACE_BEGIN4041le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const42{43if (LE_FAILURE(success)) {44return 0;45}4647LEGlyphID glyphID = glyphIterator->getCurrGlyphID();48le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success);49le_uint16 eeCount = SWAPW(entryExitCount);5051LEReferenceToArrayOf<EntryExitRecord>52entryExitRecordsArrayRef(base, success, entryExitRecords, eeCount);5354if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) {55glyphIterator->setCursiveGlyph();56return 0;57}5859LEPoint entryAnchor, exitAnchor;60Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);61Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);6263if (entryOffset != 0) {64LEReferenceTo<AnchorTable> entryAnchorTable(base, success, entryOffset);6566if( LE_SUCCESS(success) ) {67entryAnchorTable->getAnchor(entryAnchorTable, glyphID, fontInstance, entryAnchor, success);68glyphIterator->setCursiveEntryPoint(entryAnchor);69}70} else {71//glyphIterator->clearCursiveEntryPoint();72}7374if (exitOffset != 0) {75LEReferenceTo<AnchorTable> exitAnchorTable(base, success, exitOffset);7677if( LE_SUCCESS(success) ) {78exitAnchorTable->getAnchor(exitAnchorTable, glyphID, fontInstance, exitAnchor, success);79glyphIterator->setCursiveExitPoint(exitAnchor);80}81} else {82//glyphIterator->clearCursiveExitPoint();83}8485return 1;86}8788U_NAMESPACE_END899091