1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* $Id$ */ 19 20 package org.apache.fop.complexscripts.fonts; 21 22 // CSOFF: LineLengthCheck 23 24 /** 25 * <p>The <code>GlyphDefinitionSubtable</code> implements an abstract base of a glyph definition subtable, 26 * providing a default implementation of the <code>GlyphDefinition</code> interface.</p> 27 * 28 * <p>This work was originally authored by Glenn Adams (gadams@apache.org).</p> 29 */ 30 public abstract class GlyphDefinitionSubtable extends GlyphSubtable implements GlyphDefinition { 31 32 /** 33 * Instantiate a <code>GlyphDefinitionSubtable</code>. 34 * @param id subtable identifier 35 * @param sequence subtable sequence 36 * @param flags subtable flags 37 * @param format subtable format 38 * @param mapping subtable coverage table 39 */ GlyphDefinitionSubtable(String id, int sequence, int flags, int format, GlyphMappingTable mapping)40 protected GlyphDefinitionSubtable(String id, int sequence, int flags, int format, GlyphMappingTable mapping) { 41 super(id, sequence, flags, format, mapping); 42 } 43 44 /** {@inheritDoc} */ getTableType()45 public int getTableType() { 46 return GlyphTable.GLYPH_TABLE_TYPE_DEFINITION; 47 } 48 49 /** {@inheritDoc} */ getTypeName()50 public String getTypeName() { 51 return GlyphDefinitionTable.getLookupTypeName(getType()); 52 } 53 54 /** {@inheritDoc} */ usesReverseScan()55 public boolean usesReverseScan() { 56 return false; 57 } 58 59 /** {@inheritDoc} */ hasDefinition(int gi)60 public boolean hasDefinition(int gi) { 61 GlyphCoverageMapping cvm; 62 if ((cvm = getCoverage()) != null) { 63 if (cvm.getCoverageIndex(gi) >= 0) { 64 return true; 65 } 66 } 67 GlyphClassMapping clm; 68 if ((clm = getClasses()) != null) { 69 if (clm.getClassIndex(gi, 0) >= 0) { 70 return true; 71 } 72 } 73 return false; 74 } 75 76 } 77