Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/layout/GXLayoutEngine.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*/242526/*27*28* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved29*30*/3132#include "LETypes.h"33#include "LayoutEngine.h"34#include "GXLayoutEngine.h"35#include "LEGlyphStorage.h"3637#include "MorphTables.h"3839U_NAMESPACE_BEGIN4041UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)4243GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success)44: LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable)45{46fMorphTable.orphan();47// nothing else to do?48}4950GXLayoutEngine::~GXLayoutEngine()51{52reset();53}5455// apply 'mort' table56le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)57{58if (LE_FAILURE(success)) {59return 0;60}6162if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {63success = LE_ILLEGAL_ARGUMENT_ERROR;64return 0;65}6667mapCharsToGlyphs(chars, offset, count, FALSE, rightToLeft, glyphStorage, success);6869if (LE_FAILURE(success)) {70return 0;71}7273fMorphTable->process(fMorphTable, glyphStorage, success);7475return glyphStorage.getGlyphCount();76}7778// apply positional tables79void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,80LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)81{82if (LE_FAILURE(success)) {83return;84}8586if (chars == NULL || offset < 0 || count < 0) {87success = LE_ILLEGAL_ARGUMENT_ERROR;88return;89}9091// FIXME: no positional processing yet...92}9394U_NAMESPACE_END959697