00001 /* AbiSource Application Framework 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef GR_CHARWIDTHS_H 00021 #define GR_CHARWIDTHS_H 00022 00023 #include "ut_types.h" 00024 #include "ut_vector.h" 00025 00027 // we want GR_CHAR_WIDTH_UNKNOWN to be a large negative number 00028 // with the four bytes indentical to be able to use memset 00029 // so we choose 0x80808080 00030 #define GR_UNKNOWN_BYTE 0x80 00031 #define GR_CW_UNKNOWN (UT_sint32)0x80808080 00032 00033 // the following value should be used to indicate that the glyph is 00034 // absent from the font 00035 #define GR_CW_ABSENT (GR_CW_UNKNOWN + 1) 00036 00037 /* EXPLANATION OF THE OVERSTRIKING (or COMBINING) CHARACTERS MECHANISM 00038 (Tomas, Jan 26, 2003) 00039 00040 We classify overstriking characters into three categories: 00041 00042 1. Characters to be flushed with the near edge of the previous base 00043 character, or, from the LTR point of view, right-flushed 00044 2. Characters to be flushed with the far edge of the previous base 00045 character, or, from the LTR point of view, left-flushed 00046 3. Characters to be centered over the previous base character 00047 00048 Whether a Unicode character is overstriking, and if so of what 00049 type, can be detemined by using the UT_isOverstrikingChar() 00050 function. The width of the overstriking characters should be reported 00051 as follows: 00052 00053 Type 1 (right-flushed): width should be set to 0 00054 00055 Type 2 (left-flushed): the width of the glyph should be or'ed 00056 with GR_OC_LEFT_FLUSHED (defined in gr_Graphics.h) 00057 00058 Type 3 (centered): the with of the glyph should be reported 00059 as a negative number 00060 00061 */ 00062 class ABI_EXPORT GR_CharWidths 00063 { 00064 public: 00065 GR_CharWidths(void); 00066 virtual ~GR_CharWidths(void); 00067 00068 void zeroWidths(void); 00069 void setWidth(UT_UCSChar cIndex, UT_sint32 width); 00070 UT_sint32 getWidth(UT_UCSChar cIndex) const; 00071 00072 private: 00073 GR_CharWidths(GR_CharWidths &cp); // no impl 00074 00075 typedef struct _a { UT_sint32 aCW[256]; } Array256; 00076 00077 Array256 m_aLatin1; // for speed, we don't use vector 00078 UT_GenericVector<Array256*> m_vecHiByte; // sparse vector<Array256 *>[hibyte] 00079 }; 00080 00081 #endif /* GR_CHARWIDTHS_H */