1/* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 27/* 28 * 29 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved 30 * 31 */ 32 33#ifndef __GXLAYOUTENGINE_H 34#define __GXLAYOUTENGINE_H 35 36#include "LETypes.h" 37#include "LayoutEngine.h" 38 39#include "MorphTables.h" 40 41U_NAMESPACE_BEGIN 42 43class LEFontInstance; 44class LEGlyphStorage; 45 46/** 47 * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT) 48 * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's 49 * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details. 50 * Information about 'mort' tables is in the chapter titled "Font Files." 51 * 52 * @internal 53 */ 54class GXLayoutEngine : public LayoutEngine 55{ 56public: 57 /** 58 * This is the main constructor. It constructs an instance of GXLayoutEngine for 59 * a particular font, script and language. It takes the 'mort' table as a parameter since 60 * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a 61 * GX font. 62 * 63 * Note: GX and AAT fonts don't contain any script and language specific tables, so 64 * the script and language are ignored. 65 * 66 * @param fontInstance - the font 67 * @param scriptCode - the script 68 * @param langaugeCode - the language 69 * @param morphTable - the 'mort' table 70 * @param success - set to an error code if the operation fails 71 * 72 * @see LayoutEngine::layoutEngineFactory 73 * @see ScriptAndLangaugeTags.h for script and language codes 74 * 75 * @internal 76 */ 77 GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success); 78 79 /** 80 * The destructor, virtual for correct polymorphic invocation. 81 * 82 * @internal 83 */ 84 virtual ~GXLayoutEngine(); 85 86 /** 87 * ICU "poor man's RTTI", returns a UClassID for the actual class. 88 * 89 * @stable ICU 2.8 90 */ 91 virtual UClassID getDynamicClassID() const; 92 93 /** 94 * ICU "poor man's RTTI", returns a UClassID for this class. 95 * 96 * @stable ICU 2.8 97 */ 98 static UClassID getStaticClassID(); 99 100protected: 101 102 /** 103 * The address of the 'mort' table 104 * 105 * @internal 106 */ 107 LEReferenceTo<MorphTableHeader> fMorphTable; 108 109 /** 110 * This method does GX layout using the font's 'mort' table. It converts the 111 * input character codes to glyph indices using mapCharsToGlyphs, and then 112 * applies the 'mort' table. 113 * 114 * Input parameters: 115 * @param chars - the input character context 116 * @param offset - the index of the first character to process 117 * @param count - the number of characters to process 118 * @param max - the number of characters in the input context 119 * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run 120 * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. 121 * 122 * Output parameters: 123 * @param success - set to an error code if the operation fails 124 * 125 * @return the number of glyphs in the glyph index array 126 * 127 * @internal 128 */ 129 virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, 130 LEGlyphStorage &glyphStorage, LEErrorCode &success); 131 132 /** 133 * This method adjusts the glyph positions using the font's 134 * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables. 135 * 136 * Input parameters: 137 * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed. 138 * 139 * Output parameters: 140 * @param success - set to an error code if the operation fails 141 * 142 * @internal 143 */ 144 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, 145 LEGlyphStorage &glyphStorage, LEErrorCode &success); 146 147}; 148 149U_NAMESPACE_END 150#endif 151 152