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 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved 29 * 30 */ 31 32#ifndef __ARABICSHAPING_H 33#define __ARABICSHAPING_H 34 35/** 36 * \file 37 * \internal 38 */ 39 40#include "LETypes.h" 41#include "OpenTypeTables.h" 42 43U_NAMESPACE_BEGIN 44 45class LEGlyphStorage; 46 47class ArabicShaping /* not : public UObject because all methods are static */ { 48public: 49 // Joining types 50 enum JoiningTypes 51 { 52 JT_NON_JOINING = 0, 53 JT_JOIN_CAUSING = 1, 54 JT_DUAL_JOINING = 2, 55 JT_LEFT_JOINING = 3, 56 JT_RIGHT_JOINING = 4, 57 JT_TRANSPARENT = 5, 58 JT_COUNT = 6 59 }; 60 61 // shaping bit masks 62 enum ShapingBitMasks 63 { 64 MASK_SHAPE_RIGHT = 1, // if this bit set, shapes to right 65 MASK_SHAPE_LEFT = 2, // if this bit set, shapes to left 66 MASK_TRANSPARENT = 4, // if this bit set, is transparent (ignore other bits) 67 MASK_NOSHAPE = 8 // if this bit set, don't shape this char, i.e. tatweel 68 }; 69 70 // shaping values 71 enum ShapeTypeValues 72 { 73 ST_NONE = 0, 74 ST_RIGHT = MASK_SHAPE_RIGHT, 75 ST_LEFT = MASK_SHAPE_LEFT, 76 ST_DUAL = MASK_SHAPE_RIGHT | MASK_SHAPE_LEFT, 77 ST_TRANSPARENT = MASK_TRANSPARENT, 78 ST_NOSHAPE_DUAL = MASK_NOSHAPE | ST_DUAL, 79 ST_NOSHAPE_NONE = MASK_NOSHAPE 80 }; 81 82 typedef le_int32 ShapeType; 83 84 static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax, 85 le_bool rightToLeft, LEGlyphStorage &glyphStorage); 86 87 static const FeatureMap *getFeatureMap(le_int32 &count); 88 89private: 90 // forbid instantiation 91 ArabicShaping(); 92 93 static ShapeType getShapeType(LEUnicode c); 94 95 static const le_uint8 shapingTypeTable[]; 96 static const size_t shapingTypeTableLen; 97 98 static const ShapeType shapeTypes[]; 99 100 static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage); 101}; 102 103U_NAMESPACE_END 104#endif 105