Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/layout/GXLayoutEngine2.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* (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved28*29*/3031#include "LETypes.h"32#include "LayoutEngine.h"33#include "GXLayoutEngine2.h"34#include "LEGlyphStorage.h"35#include "MorphTables.h"3637U_NAMESPACE_BEGIN3839UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine2)4041GXLayoutEngine2::GXLayoutEngine2(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader2> &morphTable, le_int32 typoFlags, LEErrorCode &success)42: LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fMorphTable(morphTable)43{44// nothing else to do?45}4647GXLayoutEngine2::~GXLayoutEngine2()48{49reset();50}5152// apply 'morx' table53le_int32 GXLayoutEngine2::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)54{55if (LE_FAILURE(success)) {56return 0;57}5859if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {60success = LE_ILLEGAL_ARGUMENT_ERROR;61return 0;62}6364mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success);6566if (LE_FAILURE(success)) {67return 0;68}6970fMorphTable->process(fMorphTable, glyphStorage, fTypoFlags, success);71return glyphStorage.getGlyphCount();72}7374// apply positional tables75void GXLayoutEngine2::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,76LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)77{78if (LE_FAILURE(success)) {79return;80}8182if (chars == NULL || offset < 0 || count < 0) {83success = LE_ILLEGAL_ARGUMENT_ERROR;84return;85}8687// FIXME: no positional processing yet...88}8990U_NAMESPACE_END919293