This commit is contained in:
Mandy Chung 2009-09-29 22:49:43 -07:00
commit 683ef572aa
155 changed files with 2171 additions and 1100 deletions

View File

@ -199,3 +199,7 @@ ifeq ($(PLATFORM), windows)
CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows
endif endif
# Make the Layout Engine build standalone
CPPFLAGS += -DLE_STANDALONE

View File

@ -37,6 +37,8 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
{ {
// NOTE: For now, we'll just pick the first alternative... // NOTE: For now, we'll just pick the first alternative...
@ -64,3 +66,5 @@ le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, c
return 0; return 0;
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __ALTERNATESUBSTITUTIONSUBTABLES_H #ifndef __ALTERNATESUBSTITUTIONSUBTABLES_H
#define __ALTERNATESUBSTITUTIONSUBTABLES_H #define __ALTERNATESUBSTITUTIONSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEGlyphFilter.h" #include "LEGlyphFilter.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphSubstitutionTables.h" #include "GlyphSubstitutionTables.h"
#include "GlyphIterator.h" #include "GlyphIterator.h"
U_NAMESPACE_BEGIN
struct AlternateSetTable struct AlternateSetTable
{ {
le_uint16 glyphCount; le_uint16 glyphCount;
@ -52,4 +59,5 @@ struct AlternateSubstitutionSubtable : GlyphSubstitutionSubtable
le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "AnchorTables.h" #include "AnchorTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance, void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance,
LEPoint &anchor) const LEPoint &anchor) const
{ {
@ -124,3 +126,6 @@ void Format3AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint &
fontInstance->pixelsToUnits(pixels, anchor); fontInstance->pixelsToUnits(pixels, anchor);
} }
U_NAMESPACE_END

View File

@ -32,10 +32,17 @@
#ifndef __ANCHORTABLES_H #ifndef __ANCHORTABLES_H
#define __ANCHORTABLES_H #define __ANCHORTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct AnchorTable struct AnchorTable
{ {
le_uint16 anchorFormat; le_uint16 anchorFormat;
@ -66,5 +73,7 @@ struct Format3AnchorTable : AnchorTable
void getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const; void getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -49,13 +49,16 @@
#include "ArabicShaping.h" #include "ArabicShaping.h"
#include "CanonShaping.h" #include "CanonShaping.h"
U_NAMESPACE_BEGIN
le_bool CharSubstitutionFilter::accept(LEGlyphID glyph) const le_bool CharSubstitutionFilter::accept(LEGlyphID glyph) const
{ {
return fFontInstance->canDisplay((LEUnicode) glyph); return fFontInstance->canDisplay((LEUnicode) glyph);
} }
ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine( UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
{ {
@ -63,9 +66,8 @@ ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(
fFeatureOrder = TRUE; fFeatureOrder = TRUE;
} }
ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine( ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
const LEFontInstance *fontInstance, le_int32 typoFlags)
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
{ {
fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount); fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
@ -86,8 +88,7 @@ ArabicOpenTypeLayoutEngine::~ArabicOpenTypeLayoutEngine()
// Input: characters // Input: characters
// Output: characters, char indices, tags // Output: characters, char indices, tags
// Returns: output character count // Returns: output character count
le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -124,8 +125,8 @@ le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[]
return count; return count;
} }
void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return; return;
@ -137,24 +138,20 @@ void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], l
} }
if (fGPOSTable != NULL) { if (fGPOSTable != NULL) {
OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
reverse, glyphStorage, success);
} else if (fGDEFTable != NULL) { } else if (fGDEFTable != NULL) {
GDEFMarkFilter filter(fGDEFTable); GDEFMarkFilter filter(fGDEFTable);
adjustMarkGlyphs(glyphStorage, &filter, success); adjustMarkGlyphs(glyphStorage, &filter, success);
} else { } else {
GlyphDefinitionTableHeader *gdefTable = GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
(GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
GDEFMarkFilter filter(gdefTable); GDEFMarkFilter filter(gdefTable);
adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
} }
} }
UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine( UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
const LEFontInstance *fontInstance,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
: ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
{ {
fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
@ -169,8 +166,7 @@ UnicodeArabicOpenTypeLayoutEngine::~UnicodeArabicOpenTypeLayoutEngine()
} }
// "glyphs", "indices" -> glyphs, indices // "glyphs", "indices" -> glyphs, indices
le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing( le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
@ -193,17 +189,14 @@ le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(
glyphStorage.adoptCharIndicesArray(tempGlyphStorage); glyphStorage.adoptCharIndicesArray(tempGlyphStorage);
ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, TRUE, glyphStorage, success);
TRUE, glyphStorage, success);
LE_DELETE_ARRAY(tempChars); LE_DELETE_ARRAY(tempChars);
return tempGlyphCount; return tempGlyphCount;
} }
void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/,
LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return; return;
@ -228,8 +221,7 @@ void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[]
} }
} }
void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
le_int32 offset, le_int32 count, le_bool reverse,
LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -245,3 +237,6 @@ void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode cha
adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
} }
U_NAMESPACE_END

View File

@ -43,6 +43,8 @@
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
#include "GlyphPositioningTables.h" #include "GlyphPositioningTables.h"
U_NAMESPACE_BEGIN
/** /**
* This class implements OpenType layout for Arabic fonts. It overrides * This class implements OpenType layout for Arabic fonts. It overrides
* the characerProcessing method to assign the correct OpenType feature * the characerProcessing method to assign the correct OpenType feature
@ -71,8 +73,8 @@ public:
* *
* @internal * @internal
*/ */
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 languageCode, le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
/** /**
* This constructor is used when the font requires a "canned" GSUB table which can't be known * This constructor is used when the font requires a "canned" GSUB table which can't be known
@ -87,8 +89,8 @@ public:
* *
* @internal * @internal
*/ */
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 languageCode, le_int32 typoFlags); le_int32 typoFlags);
/** /**
* The destructor, virtual for correct polymorphic invocation. * The destructor, virtual for correct polymorphic invocation.
@ -97,6 +99,20 @@ public:
*/ */
virtual ~ArabicOpenTypeLayoutEngine(); virtual ~ArabicOpenTypeLayoutEngine();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
/** /**
@ -108,8 +124,7 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the characters are in a * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
* right to left directional run
* *
* Output parameters: * Output parameters:
* @param outChars - the output character arrayt * @param outChars - the output character arrayt
@ -121,8 +136,7 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
@ -142,11 +156,9 @@ protected:
* *
* @internal * @internal
*/ */
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
// static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
// le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
}; };
@ -178,8 +190,8 @@ public:
* *
* @internal * @internal
*/ */
UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); le_int32 typoFlags);
/** /**
* The destructor, virtual for correct polymorphic invocation. * The destructor, virtual for correct polymorphic invocation.
@ -208,8 +220,7 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
* This method copies the input characters into the output glyph index array, * This method copies the input characters into the output glyph index array,
@ -227,8 +238,7 @@ protected:
* *
* @internal * @internal
*/ */
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
le_int32 count, le_bool reverse, le_bool mirror,
LEGlyphStorage &glyphStorage, LEErrorCode &success); LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
@ -245,8 +255,9 @@ protected:
* *
* @internal * @internal
*/ */
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "ClassDefinitionTables.h" #include "ClassDefinitionTables.h"
U_NAMESPACE_BEGIN
// This table maps Unicode joining types to // This table maps Unicode joining types to
// ShapeTypes. // ShapeTypes.
const ArabicShaping::ShapeType ArabicShaping::shapeTypes[] = const ArabicShaping::ShapeType ArabicShaping::shapeTypes[] =
@ -102,9 +104,7 @@ ArabicShaping::ShapeType ArabicShaping::getShapeType(LEUnicode c)
#define markFeatureMask 0x00040000UL #define markFeatureMask 0x00040000UL
#define mkmkFeatureMask 0x00020000UL #define mkmkFeatureMask 0x00020000UL
#define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | \ #define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask)
markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | \
dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask)
#define SHAPE_MASK 0xF0000000UL #define SHAPE_MASK 0xF0000000UL
@ -226,3 +226,5 @@ void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 char
adjustTags(erout, 2, glyphStorage); adjustTags(erout, 2, glyphStorage);
} }
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __ARABICSHAPING_H #ifndef __ARABICSHAPING_H
#define __ARABICSHAPING_H #define __ARABICSHAPING_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class ArabicShaping { class ArabicShaping /* not : public UObject because all methods are static */ {
public: public:
// Joining types // Joining types
enum JoiningTypes enum JoiningTypes
@ -74,8 +81,8 @@ public:
typedef le_int32 ShapeType; typedef le_int32 ShapeType;
static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
le_int32 charMax, le_bool rightToLeft, LEGlyphStorage &glyphStorage); le_bool rightToLeft, LEGlyphStorage &glyphStorage);
static const FeatureMap *getFeatureMap(le_int32 &count); static const FeatureMap *getFeatureMap(le_int32 &count);
@ -88,8 +95,8 @@ private:
static const le_uint8 shapingTypeTable[]; static const le_uint8 shapingTypeTable[];
static const ShapeType shapeTypes[]; static const ShapeType shapeTypes[];
static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage);
LEGlyphStorage &glyphStorage);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,12 +32,19 @@
#ifndef __ATTACHMENTPOSITIONINGSUBTABLES_H #ifndef __ATTACHMENTPOSITIONINGSUBTABLES_H
#define __ATTACHMENTPOSITIONINGSUBTABLES_H #define __ATTACHMENTPOSITIONINGSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphPositioningTables.h" #include "GlyphPositioningTables.h"
#include "ValueRecords.h" #include "ValueRecords.h"
#include "GlyphIterator.h" #include "GlyphIterator.h"
U_NAMESPACE_BEGIN
struct AttachmentPositioningSubtable : GlyphPositioningSubtable struct AttachmentPositioningSubtable : GlyphPositioningSubtable
{ {
Offset baseCoverageTableOffset; Offset baseCoverageTableOffset;
@ -55,4 +62,6 @@ inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(LEGlyphID baseGly
return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID); return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID);
} }
U_NAMESPACE_END
#endif #endif

View File

@ -36,6 +36,8 @@
#include "LETypes.h" #include "LETypes.h"
#include "CanonShaping.h" #include "CanonShaping.h"
U_NAMESPACE_BEGIN
const le_uint8 CanonShaping::glyphSubstitutionTable[] = { const le_uint8 CanonShaping::glyphSubstitutionTable[] = {
0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x58, 0x02, 0x86, 0x00, 0x12, 0x61, 0x72, 0x61, 0x62, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x58, 0x02, 0x86, 0x00, 0x12, 0x61, 0x72, 0x61, 0x62,
0x00, 0x6E, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79, 0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65, 0x00, 0x6E, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79, 0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65,
@ -3773,3 +3775,5 @@ const le_uint8 CanonShaping::glyphDefinitionTable[] = {
0x00, 0xDC, 0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA, 0x00, 0xDC, 0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA,
0xD1, 0xAD, 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6 0xD1, 0xAD, 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6
}; };
U_NAMESPACE_END

View File

@ -35,8 +35,9 @@
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
#include "ClassDefinitionTables.h" #include "ClassDefinitionTables.h"
void CanonShaping::sortMarks(le_int32 *indices, U_NAMESPACE_BEGIN
const le_int32 *combiningClasses, le_int32 index, le_int32 limit)
void CanonShaping::sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit)
{ {
for (le_int32 j = index + 1; j < limit; j += 1) { for (le_int32 j = index + 1; j < limit; j += 1) {
le_int32 i; le_int32 i;
@ -55,13 +56,11 @@ void CanonShaping::sortMarks(le_int32 *indices,
} }
} }
void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage) LEUnicode *outChars, LEGlyphStorage &glyphStorage)
{ {
const GlyphDefinitionTableHeader *gdefTable = const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable;
(const GlyphDefinitionTableHeader *) glyphDefinitionTable; const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable();
const ClassDefinitionTable *classTable =
gdefTable->getMarkAttachClassDefinitionTable();
le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount); le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount);
le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount);
LEErrorCode status = LE_NO_ERROR; LEErrorCode status = LE_NO_ERROR;
@ -103,3 +102,5 @@ void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount,
LE_DELETE_ARRAY(indices); LE_DELETE_ARRAY(indices);
LE_DELETE_ARRAY(combiningClasses); LE_DELETE_ARRAY(combiningClasses);
} }
U_NAMESPACE_END

View File

@ -34,20 +34,22 @@
#include "LETypes.h" #include "LETypes.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class CanonShaping class CanonShaping /* not : public UObject because all members are static */
{ {
public: public:
static const le_uint8 glyphSubstitutionTable[]; static const le_uint8 glyphSubstitutionTable[];
static const le_uint8 glyphDefinitionTable[]; static const le_uint8 glyphDefinitionTable[];
static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage); LEUnicode *outChars, LEGlyphStorage &glyphStorage);
private: private:
static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses, static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit);
le_int32 index, le_int32 limit);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "LETypes.h" #include "LETypes.h"
#include "LEGlyphFilter.h" #include "LEGlyphFilter.h"
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
/** /**
@ -43,7 +45,7 @@ class LEFontInstance;
* *
* @internal * @internal
*/ */
class CharSubstitutionFilter : public LEGlyphFilter class CharSubstitutionFilter : public UMemory, public LEGlyphFilter
{ {
private: private:
/** /**
@ -98,4 +100,7 @@ public:
le_bool accept(LEGlyphID glyph) const; le_bool accept(LEGlyphID glyph) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "ClassDefinitionTables.h" #include "ClassDefinitionTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const
{ {
switch(SWAPW(classFormat)) { switch(SWAPW(classFormat)) {
@ -139,3 +141,5 @@ le_bool ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass) const
return FALSE; return FALSE;
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __CLASSDEFINITIONTABLES_H #ifndef __CLASSDEFINITIONTABLES_H
#define __CLASSDEFINITIONTABLES_H #define __CLASSDEFINITIONTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct ClassDefinitionTable struct ClassDefinitionTable
{ {
le_uint16 classFormat; le_uint16 classFormat;
@ -69,4 +76,5 @@ struct ClassDefFormat2Table : ClassDefinitionTable
le_bool hasGlyphClass(le_int32 glyphClass) const; le_bool hasGlyphClass(le_int32 glyphClass) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,12 +32,19 @@
#ifndef __CONTEXTUALGLYPHINSERTION_H #ifndef __CONTEXTUALGLYPHINSERTION_H
#define __CONTEXTUALGLYPHINSERTION_H #define __CONTEXTUALGLYPHINSERTION_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LayoutTables.h" #include "LayoutTables.h"
#include "StateTables.h" #include "StateTables.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "MorphStateTables.h" #include "MorphStateTables.h"
U_NAMESPACE_BEGIN
struct ContextualGlyphInsertionHeader : MorphStateTableHeader struct ContextualGlyphInsertionHeader : MorphStateTableHeader
{ {
}; };
@ -60,4 +67,5 @@ struct LigatureSubstitutionStateEntry : StateEntry
ByteOffset markedInsertionListOffset; ByteOffset markedInsertionListOffset;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -39,6 +39,10 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor)
ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
: StateTableProcessor(morphSubtableHeader) : StateTableProcessor(morphSubtableHeader)
{ {
@ -57,8 +61,7 @@ void ContextualGlyphSubstitutionProcessor::beginStateTable()
markGlyph = 0; markGlyph = 0;
} }
ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
le_int32 &currGlyph, EntryTableIndex index)
{ {
const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index]; const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index];
ByteOffset newState = SWAPW(entry->newStateOffset); ByteOffset newState = SWAPW(entry->newStateOffset);
@ -97,3 +100,5 @@ ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorag
void ContextualGlyphSubstitutionProcessor::endStateTable() void ContextualGlyphSubstitutionProcessor::endStateTable()
{ {
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H #ifndef __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
#define __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H #define __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "SubtableProcessor.h" #include "SubtableProcessor.h"
#include "StateTableProcessor.h" #include "StateTableProcessor.h"
#include "ContextualGlyphSubstitution.h" #include "ContextualGlyphSubstitution.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class ContextualGlyphSubstitutionProcessor : public StateTableProcessor class ContextualGlyphSubstitutionProcessor : public StateTableProcessor
@ -52,6 +59,20 @@ public:
ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
virtual ~ContextualGlyphSubstitutionProcessor(); virtual ~ContextualGlyphSubstitutionProcessor();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
private: private:
ContextualGlyphSubstitutionProcessor(); ContextualGlyphSubstitutionProcessor();
@ -62,6 +83,8 @@ protected:
le_int32 markGlyph; le_int32 markGlyph;
const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader; const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,11 +32,18 @@
#ifndef __CONTEXTUALGLYPHSUBSTITUTION_H #ifndef __CONTEXTUALGLYPHSUBSTITUTION_H
#define __CONTEXTUALGLYPHSUBSTITUTION_H #define __CONTEXTUALGLYPHSUBSTITUTION_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LayoutTables.h" #include "LayoutTables.h"
#include "StateTables.h" #include "StateTables.h"
#include "MorphTables.h" #include "MorphTables.h"
U_NAMESPACE_BEGIN
struct ContextualGlyphSubstitutionHeader : MorphStateTableHeader struct ContextualGlyphSubstitutionHeader : MorphStateTableHeader
{ {
ByteOffset substitutionTableOffset; ByteOffset substitutionTableOffset;
@ -55,4 +62,5 @@ struct ContextualGlyphSubstitutionStateEntry : StateEntry
WordOffset currOffset; WordOffset currOffset;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -39,6 +38,8 @@
#include "CoverageTables.h" #include "CoverageTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
/* /*
NOTE: This could be optimized somewhat by keeping track NOTE: This could be optimized somewhat by keeping track
of the previous sequenceIndex in the loop and doing next() of the previous sequenceIndex in the loop and doing next()
@ -542,3 +543,5 @@ le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupPro
return 0; return 0;
} }
U_NAMESPACE_END

View File

@ -32,6 +32,11 @@
#ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H #ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H
#define __CONTEXTUALSUBSTITUTIONSUBTABLES_H #define __CONTEXTUALSUBSTITUTIONSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
@ -39,6 +44,8 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LookupProcessor.h" #include "LookupProcessor.h"
U_NAMESPACE_BEGIN
struct SubstitutionLookupRecord struct SubstitutionLookupRecord
{ {
le_uint16 sequenceIndex; le_uint16 sequenceIndex;
@ -218,4 +225,5 @@ struct ChainingContextualSubstitutionFormat3Subtable
le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "CoverageTables.h" #include "CoverageTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_int32 CoverageTable::getGlyphCoverage(LEGlyphID glyphID) const le_int32 CoverageTable::getGlyphCoverage(LEGlyphID glyphID) const
{ {
switch(SWAPW(coverageFormat)) switch(SWAPW(coverageFormat))
@ -106,3 +108,5 @@ le_int32 CoverageFormat2Table::getGlyphCoverage(LEGlyphID glyphID) const
return startCoverageIndex + (ttGlyphID - firstInRange); return startCoverageIndex + (ttGlyphID - firstInRange);
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __COVERAGETABLES_H #ifndef __COVERAGETABLES_H
#define __COVERAGETABLES_H #define __COVERAGETABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct CoverageTable struct CoverageTable
{ {
le_uint16 coverageFormat; le_uint16 coverageFormat;
@ -58,5 +65,5 @@ struct CoverageFormat2Table : CoverageTable
le_int32 getGlyphCoverage(LEGlyphID glyphID) const; le_int32 getGlyphCoverage(LEGlyphID glyphID) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -37,6 +37,8 @@
#include "OpenTypeUtilities.h" #include "OpenTypeUtilities.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
{ {
LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); LEGlyphID glyphID = glyphIterator->getCurrGlyphID();
@ -68,3 +70,5 @@ le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const
return 1; return 1;
} }
U_NAMESPACE_END

View File

@ -32,10 +32,17 @@
#ifndef __CURSIVEATTACHMENTSUBTABLES_H #ifndef __CURSIVEATTACHMENTSUBTABLES_H
#define __CURSIVEATTACHMENTSUBTABLES_H #define __CURSIVEATTACHMENTSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphPositioningTables.h" #include "GlyphPositioningTables.h"
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
class GlyphIterator; class GlyphIterator;
@ -53,4 +60,7 @@ struct CursiveAttachmentSubtable : GlyphPositioningSubtable
le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -32,9 +31,16 @@
#ifndef __DEFAULTCHARMAPPER_H #ifndef __DEFAULTCHARMAPPER_H
#define __DEFAULTCHARMAPPER_H #define __DEFAULTCHARMAPPER_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
U_NAMESPACE_BEGIN
/** /**
* This class is an instance of LECharMapper which * This class is an instance of LECharMapper which
* implements control character filtering and bidi * implements control character filtering and bidi
@ -42,7 +48,7 @@
* *
* @see LECharMapper * @see LECharMapper
*/ */
class DefaultCharMapper : public LECharMapper class DefaultCharMapper : public UMemory, public LECharMapper
{ {
private: private:
le_bool fFilterControls; le_bool fFilterControls;
@ -77,4 +83,5 @@ public:
LEUnicode32 mapChar(LEUnicode32 ch) const; LEUnicode32 mapChar(LEUnicode32 ch) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
* *
@ -34,6 +35,8 @@
#include "DeviceTables.h" #include "DeviceTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
const le_uint16 DeviceTable::fieldMasks[] = {0x0003, 0x000F, 0x00FF}; const le_uint16 DeviceTable::fieldMasks[] = {0x0003, 0x000F, 0x00FF};
const le_uint16 DeviceTable::fieldSignBits[] = {0x0002, 0x0008, 0x0080}; const le_uint16 DeviceTable::fieldSignBits[] = {0x0002, 0x0008, 0x0080};
const le_uint16 DeviceTable::fieldBits[] = { 2, 4, 8}; const le_uint16 DeviceTable::fieldBits[] = { 2, 4, 8};
@ -62,3 +65,5 @@ le_int16 DeviceTable::getAdjustment(le_uint16 ppem) const
return result; return result;
} }
U_NAMESPACE_END

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
@ -32,10 +33,15 @@
#ifndef __DEVICETABLES_H #ifndef __DEVICETABLES_H
#define __DEVICETABLES_H #define __DEVICETABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphIterator.h"
#include "GlyphPositionAdjustments.h" U_NAMESPACE_BEGIN
struct DeviceTable struct DeviceTable
{ {
@ -52,5 +58,7 @@ private:
static const le_uint16 fieldBits[]; static const le_uint16 fieldBits[];
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -25,7 +25,8 @@
/* /*
* *
* (C) Copyright IBM Corp. 2003 - All Rights Reserved *
* (C) Copyright IBM Corp. 2002 - All Rights Reserved
* *
*/ */
@ -37,6 +38,9 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
// FIXME: should look at the format too... maybe have a sub-class for it? // FIXME: should look at the format too... maybe have a sub-class for it?
le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
@ -52,3 +56,5 @@ le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_
return 0; return 0;
} }
U_NAMESPACE_END

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 2002-2003 - All Rights Reserved * (C) Copyright IBM Corp. 2002-2003 - All Rights Reserved
* *
@ -32,12 +33,19 @@
#ifndef __EXTENSIONSUBTABLES_H #ifndef __EXTENSIONSUBTABLES_H
#define __EXTENSIONSUBTABLES_H #define __EXTENSIONSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphSubstitutionTables.h" #include "GlyphSubstitutionTables.h"
#include "LookupProcessor.h" #include "LookupProcessor.h"
#include "GlyphIterator.h" #include "GlyphIterator.h"
U_NAMESPACE_BEGIN
struct ExtensionSubtable //: GlyphSubstitutionSubtable struct ExtensionSubtable //: GlyphSubstitutionSubtable
{ {
le_uint16 substFormat; le_uint16 substFormat;
@ -48,4 +56,5 @@ struct ExtensionSubtable //: GlyphSubstitutionSubtable
GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
* *
@ -35,6 +36,8 @@
#include "Features.h" #include "Features.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const
{ {
if (featureIndex >= SWAPW(featureCount)) { if (featureIndex >= SWAPW(featureCount)) {
@ -79,3 +82,5 @@ const FeatureTable *FeatureListTable::getFeatureTable(LETag featureTag) const
return 0; return 0;
#endif #endif
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __FEATURES_H #ifndef __FEATURES_H
#define __FEATURES_H #define __FEATURES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct FeatureRecord struct FeatureRecord
{ {
ATag featureTag; ATag featureTag;
@ -58,4 +65,5 @@ struct FeatureListTable
const FeatureTable *getFeatureTable(LETag featureTag) const; const FeatureTable *getFeatureTable(LETag featureTag) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -34,6 +34,8 @@
#include "GDEFMarkFilter.h" #include "GDEFMarkFilter.h"
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
U_NAMESPACE_BEGIN
GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable) GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable)
{ {
classDefTable = gdefTable->getGlyphClassDefinitionTable(); classDefTable = gdefTable->getGlyphClassDefinitionTable();
@ -50,3 +52,5 @@ le_bool GDEFMarkFilter::accept(LEGlyphID glyph) const
return glyphClass == gcdMarkGlyph; return glyphClass == gcdMarkGlyph;
} }
U_NAMESPACE_END

View File

@ -32,11 +32,18 @@
#ifndef __GDEFMARKFILTER__H #ifndef __GDEFMARKFILTER__H
#define __GDEFMARKFILTER__H #define __GDEFMARKFILTER__H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEGlyphFilter.h" #include "LEGlyphFilter.h"
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
class GDEFMarkFilter : public LEGlyphFilter U_NAMESPACE_BEGIN
class GDEFMarkFilter : public UMemory, public LEGlyphFilter
{ {
private: private:
const GlyphClassDefinitionTable *classDefTable; const GlyphClassDefinitionTable *classDefTable;
@ -51,5 +58,5 @@ public:
virtual le_bool accept(LEGlyphID glyph) const; virtual le_bool accept(LEGlyphID glyph) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -23,6 +23,7 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
@ -36,8 +37,11 @@
#include "MorphTables.h" #include "MorphTables.h"
GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, U_NAMESPACE_BEGIN
le_int32 languageCode, const MorphTableHeader *morphTable)
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable)
: LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable) : LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable)
{ {
// nothing else to do? // nothing else to do?
@ -49,9 +53,7 @@ GXLayoutEngine::~GXLayoutEngine()
} }
// apply 'mort' table // apply 'mort' table
le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage,
LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
@ -74,8 +76,7 @@ le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
} }
// apply positional tables // apply positional tables
void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
le_int32 offset, le_int32 count, le_bool /*reverse*/,
LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success) LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -89,3 +90,5 @@ void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[],
// FIXME: no positional processing yet... // FIXME: no positional processing yet...
} }
U_NAMESPACE_END

View File

@ -23,6 +23,7 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
@ -37,6 +38,8 @@
#include "MorphTables.h" #include "MorphTables.h"
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
class LEGlyphStorage; class LEGlyphStorage;
@ -70,8 +73,7 @@ public:
* *
* @internal * @internal
*/ */
GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
le_int32 languageCode, const MorphTableHeader *morphTable);
/** /**
* The destructor, virtual for correct polymorphic invocation. * The destructor, virtual for correct polymorphic invocation.
@ -80,6 +82,20 @@ public:
*/ */
virtual ~GXLayoutEngine(); virtual ~GXLayoutEngine();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
/** /**
@ -99,10 +115,8 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the text is in a * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
* right to left directional run * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
* @param glyphStorage - the glyph storage object. The glyph
* and char index arrays will be set.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -111,8 +125,7 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEGlyphStorage &glyphStorage, LEErrorCode &success); LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
@ -120,16 +133,18 @@ protected:
* 'kern', 'trak', 'bsln', 'opbd' and 'just' tables. * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
* *
* Input parameters: * Input parameters:
* @param glyphStorage - the object holding the glyph storage. * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
* The positions will be updated as needed.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
* *
* @internal * @internal
*/ */
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEGlyphStorage &glyphStorage, LEErrorCode &success);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -34,6 +34,8 @@
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const
{ {
return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset)); return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset));
@ -53,3 +55,5 @@ const MarkAttachClassDefinitionTable *GlyphDefinitionTableHeader::getMarkAttachC
{ {
return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset)); return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset));
} }
U_NAMESPACE_END

View File

@ -32,10 +32,17 @@
#ifndef __GLYPHDEFINITIONTABLES_H #ifndef __GLYPHDEFINITIONTABLES_H
#define __GLYPHDEFINITIONTABLES_H #define __GLYPHDEFINITIONTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "ClassDefinitionTables.h" #include "ClassDefinitionTables.h"
U_NAMESPACE_BEGIN
typedef ClassDefinitionTable GlyphClassDefinitionTable; typedef ClassDefinitionTable GlyphClassDefinitionTable;
enum GlyphClassDefinitions enum GlyphClassDefinitions
@ -110,4 +117,5 @@ struct GlyphDefinitionTableHeader
const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const; const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -38,11 +38,10 @@
#include "Lookups.h" #include "Lookups.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
GlyphPositionAdjustments *theGlyphPositionAdjustments, FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask,
const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
: direction(1), position(-1), nextLimit(-1), prevLimit(-1), : direction(1), position(-1), nextLimit(-1), prevLimit(-1),
glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments), glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments),
srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask),
@ -262,8 +261,8 @@ void GlyphIterator::setCurrGlyphBaseOffset(le_int32 baseOffset)
glyphPositionAdjustments->setBaseOffset(position, baseOffset); glyphPositionAdjustments->setBaseOffset(position, baseOffset);
} }
void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust) float xAdvanceAdjust, float yAdvanceAdjust)
{ {
if (direction < 0) { if (direction < 0) {
if (position <= nextLimit || position >= prevLimit) { if (position <= nextLimit || position >= prevLimit) {
@ -281,8 +280,8 @@ void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust,
glyphPositionAdjustments->adjustYAdvance(position, yAdvanceAdjust); glyphPositionAdjustments->adjustYAdvance(position, yAdvanceAdjust);
} }
void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust) float xAdvanceAdjust, float yAdvanceAdjust)
{ {
if (direction < 0) { if (direction < 0) {
if (position <= nextLimit || position >= prevLimit) { if (position <= nextLimit || position >= prevLimit) {
@ -484,10 +483,11 @@ le_bool GlyphIterator::findMark2Glyph()
do { do {
newPosition -= direction; newPosition -= direction;
} while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && filterGlyph(newPosition));
filterGlyph(newPosition));
position = newPosition; position = newPosition;
return position != prevLimit; return position != prevLimit;
} }
U_NAMESPACE_END

View File

@ -32,26 +32,24 @@
#ifndef __GLYPHITERATOR_H #ifndef __GLYPHITERATOR_H
#define __GLYPHITERATOR_H #define __GLYPHITERATOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
struct InsertionRecord U_NAMESPACE_BEGIN
{
InsertionRecord *next;
le_int32 position;
le_int32 count;
LEGlyphID glyphs[ANY_NUMBER];
};
class LEGlyphStorage; class LEGlyphStorage;
class GlyphPositionAdjustments; class GlyphPositionAdjustments;
class GlyphIterator { class GlyphIterator : public UMemory {
public: public:
GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask, FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
GlyphIterator(GlyphIterator &that); GlyphIterator(GlyphIterator &that);
@ -122,4 +120,5 @@ private:
GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "GlyphLookupTables.h" #include "GlyphLookupTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const
{ {
const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset)); const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset));
@ -51,3 +53,5 @@ le_bool GlyphLookupTableHeader::coversScriptAndLanguage(LETag scriptTag, LETag l
// Note: don't have to SWAPW langSysTable->featureCount to check for non-zero. // Note: don't have to SWAPW langSysTable->featureCount to check for non-zero.
return langSysTable != NULL && langSysTable->featureCount != 0; return langSysTable != NULL && langSysTable->featureCount != 0;
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __GLYPHLOOKUPTABLES_H #ifndef __GLYPHLOOKUPTABLES_H
#define __GLYPHLOOKUPTABLES_H #define __GLYPHLOOKUPTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct GlyphLookupTableHeader struct GlyphLookupTableHeader
{ {
fixed32 version; fixed32 version;
@ -46,4 +53,7 @@ struct GlyphLookupTableHeader
le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const; le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -34,6 +34,8 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
U_NAMESPACE_BEGIN
#define CHECK_ALLOCATE_ARRAY(array, type, size) \ #define CHECK_ALLOCATE_ARRAY(array, type, size) \
if (array == NULL) { \ if (array == NULL) { \
array = (type *) new type[size]; \ array = (type *) new type[size]; \
@ -185,3 +187,5 @@ LEPoint *GlyphPositionAdjustments::EntryExitPoint::getExitPoint(LEPoint &exitPoi
return NULL; return NULL;
} }
U_NAMESPACE_END

View File

@ -32,16 +32,23 @@
#ifndef __GLYPHPOSITIONADJUSTMENTS_H #ifndef __GLYPHPOSITIONADJUSTMENTS_H
#define __GLYPHPOSITIONADJUSTMENTS_H #define __GLYPHPOSITIONADJUSTMENTS_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class LEFontInstance; class LEFontInstance;
class GlyphPositionAdjustments class GlyphPositionAdjustments : public UMemory
{ {
private: private:
class Adjustment { class Adjustment : public UMemory {
public: public:
inline Adjustment(); inline Adjustment();
@ -78,7 +85,7 @@ private:
// allow copying of this class because all of its fields are simple types // allow copying of this class because all of its fields are simple types
}; };
class EntryExitPoint class EntryExitPoint : public UMemory
{ {
public: public:
inline EntryExitPoint(); inline EntryExitPoint();
@ -144,14 +151,11 @@ public:
inline void adjustXAdvance(le_int32 index, float xAdjustment); inline void adjustXAdvance(le_int32 index, float xAdjustment);
inline void adjustYAdvance(le_int32 index, float yAdjustment); inline void adjustYAdvance(le_int32 index, float yAdjustment);
void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
le_bool baselineIsLogicalEnd); void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
void setExitPoint(le_int32 index, LEPoint &newExitPoint,
le_bool baselineIsLogicalEnd);
void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd); void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd);
void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, const LEFontInstance *fontInstance);
const LEFontInstance *fontInstance);
}; };
inline GlyphPositionAdjustments::Adjustment::Adjustment() inline GlyphPositionAdjustments::Adjustment::Adjustment()
@ -160,10 +164,8 @@ inline GlyphPositionAdjustments::Adjustment::Adjustment()
// nothing else to do! // nothing else to do!
} }
inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff)
float xAdv, float yAdv, le_int32 baseOff) : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), baseOffset(baseOff)
: xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv),
baseOffset(baseOff)
{ {
// nothing else to do! // nothing else to do!
} }
@ -246,7 +248,7 @@ inline void GlyphPositionAdjustments::Adjustment::adjustYAdvance(float yAdjustme
inline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint() inline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint()
: fFlags(0) : fFlags(0)
{ {
fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fEntryPoint.fY = 0; fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fExitPoint.fY = 0;
} }
inline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint() inline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint()
@ -264,12 +266,10 @@ inline le_bool GlyphPositionAdjustments::EntryExitPoint::baselineIsLogicalEnd()
return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0; return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0;
} }
inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint( inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
{ {
if (baselineIsLogicalEnd) { if (baselineIsLogicalEnd) {
fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
EEF_BASELINE_IS_LOGICAL_END);
} else { } else {
fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH); fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH);
} }
@ -277,12 +277,10 @@ inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(
fEntryPoint = newEntryPoint; fEntryPoint = newEntryPoint;
} }
inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint( inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
{ {
if (baselineIsLogicalEnd) { if (baselineIsLogicalEnd) {
fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
EEF_BASELINE_IS_LOGICAL_END);
} else { } else {
fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH); fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH);
} }
@ -290,8 +288,7 @@ inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(
fExitPoint = newExitPoint; fExitPoint = newExitPoint;
} }
inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph( inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(le_bool baselineIsLogicalEnd)
le_bool baselineIsLogicalEnd)
{ {
if (baselineIsLogicalEnd) { if (baselineIsLogicalEnd) {
fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END); fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
@ -386,4 +383,5 @@ inline le_bool GlyphPositionAdjustments::hasCursiveGlyphs() const
return fEntryExitPoints != NULL; return fEntryExitPoints != NULL;
} }
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -40,18 +39,18 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "GlyphPositionAdjustments.h" #include "GlyphPositionAdjustments.h"
void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, U_NAMESPACE_BEGIN
GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
LETag scriptTag, LETag languageTag, LETag scriptTag, LETag languageTag,
const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
const LEFontInstance *fontInstance, const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
{ {
GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder);
featureMapCount, featureOrder);
processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, glyphDefinitionTableHeader, fontInstance);
glyphDefinitionTableHeader, fontInstance);
glyphPositionAdjustments->applyCursiveAdjustments(glyphStorage, rightToLeft, fontInstance); glyphPositionAdjustments->applyCursiveAdjustments(glyphStorage, rightToLeft, fontInstance);
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -32,11 +31,18 @@
#ifndef __GLYPHPOSITIONINGTABLES_H #ifndef __GLYPHPOSITIONINGTABLES_H
#define __GLYPHPOSITIONINGTABLES_H #define __GLYPHPOSITIONINGTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "Lookups.h" #include "Lookups.h"
#include "GlyphLookupTables.h" #include "GlyphLookupTables.h"
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
class LEGlyphStorage; class LEGlyphStorage;
class LEGlyphFilter; class LEGlyphFilter;
@ -45,12 +51,10 @@ struct GlyphDefinitionTableHeader;
struct GlyphPositioningTableHeader : public GlyphLookupTableHeader struct GlyphPositioningTableHeader : public GlyphLookupTableHeader
{ {
void process(LEGlyphStorage &glyphStorage, void process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
GlyphPositionAdjustments *glyphPositionAdjustments,
le_bool rightToLeft, LETag scriptTag, LETag languageTag, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
const LEFontInstance *fontInstance, const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
}; };
enum GlyphPositioningSubtableTypes enum GlyphPositioningSubtableTypes
@ -68,4 +72,5 @@ enum GlyphPositioningSubtableTypes
typedef LookupSubtable GlyphPositioningSubtable; typedef LookupSubtable GlyphPositioningSubtable;
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
* *
*/ */
@ -50,6 +49,8 @@
#include "GlyphPosnLookupProc.h" #include "GlyphPosnLookupProc.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
// Aside from the names, the contextual positioning subtables are // Aside from the names, the contextual positioning subtables are
// the same as the contextual substitution subtables. // the same as the contextual substitution subtables.
typedef ContextualSubstitutionSubtable ContextualPositioningSubtable; typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
@ -57,8 +58,7 @@ typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubt
GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor( GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
const GlyphPositioningTableHeader *glyphPositioningTableHeader, const GlyphPositioningTableHeader *glyphPositioningTableHeader,
LETag scriptTag, LETag languageTag, LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
: LookupProcessor( : LookupProcessor(
(char *) glyphPositioningTableHeader, (char *) glyphPositioningTableHeader,
SWAPW(glyphPositioningTableHeader->scriptListOffset), SWAPW(glyphPositioningTableHeader->scriptListOffset),
@ -166,3 +166,5 @@ le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *l
GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor() GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
{ {
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -32,6 +31,11 @@
#ifndef __GLYPHPOSITIONINGLOOKUPPROCESSOR_H #ifndef __GLYPHPOSITIONINGLOOKUPPROCESSOR_H
#define __GLYPHPOSITIONINGLOOKUPPROCESSOR_H #define __GLYPHPOSITIONINGLOOKUPPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
@ -42,12 +46,13 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LookupProcessor.h" #include "LookupProcessor.h"
U_NAMESPACE_BEGIN
class GlyphPositioningLookupProcessor : public LookupProcessor class GlyphPositioningLookupProcessor : public LookupProcessor
{ {
public: public:
GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader, GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader,
LETag scriptTag, LETag languageTag, LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
virtual ~GlyphPositioningLookupProcessor(); virtual ~GlyphPositioningLookupProcessor();
@ -63,4 +68,5 @@ private:
GlyphPositioningLookupProcessor &operator=(const GlyphPositioningLookupProcessor &other); // forbid copying of this class GlyphPositioningLookupProcessor &operator=(const GlyphPositioningLookupProcessor &other); // forbid copying of this class
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -48,17 +48,17 @@
#include "GlyphSubstLookupProc.h" #include "GlyphSubstLookupProc.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
: LookupProcessor( : LookupProcessor(
(char *) glyphSubstitutionTableHeader, (char *) glyphSubstitutionTableHeader,
SWAPW(glyphSubstitutionTableHeader->scriptListOffset), SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
SWAPW(glyphSubstitutionTableHeader->featureListOffset), SWAPW(glyphSubstitutionTableHeader->featureListOffset),
SWAPW(glyphSubstitutionTableHeader->lookupListOffset), SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
scriptTag, languageTag, featureMap, featureMapCount, featureOrder) scriptTag, languageTag, featureMap, featureMapCount, featureOrder), fFilter(filter)
, fFilter(filter)
{ {
// anything? // anything?
} }
@ -143,3 +143,5 @@ le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *
GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor() GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
{ {
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -32,6 +31,11 @@
#ifndef __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H #ifndef __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H
#define __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H #define __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEGlyphFilter.h" #include "LEGlyphFilter.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
@ -43,12 +47,13 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LookupProcessor.h" #include "LookupProcessor.h"
U_NAMESPACE_BEGIN
class GlyphSubstitutionLookupProcessor : public LookupProcessor class GlyphSubstitutionLookupProcessor : public LookupProcessor
{ {
public: public:
GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
virtual ~GlyphSubstitutionLookupProcessor(); virtual ~GlyphSubstitutionLookupProcessor();
@ -65,4 +70,5 @@ private:
GlyphSubstitutionLookupProcessor &operator=(const GlyphSubstitutionLookupProcessor &other); // forbid copying of this class GlyphSubstitutionLookupProcessor &operator=(const GlyphSubstitutionLookupProcessor &other); // forbid copying of this class
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -40,14 +40,15 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LESwaps.h" #include "LESwaps.h"
le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, U_NAMESPACE_BEGIN
le_bool rightToLeft, LETag scriptTag, LETag languageTag,
le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
const LEGlyphFilter *filter, const FeatureMap *featureMap, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
le_int32 featureMapCount, le_bool featureOrder) const
{ {
GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder);
featureMapCount, featureOrder);
return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL); return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL);
} }
U_NAMESPACE_END

View File

@ -32,22 +32,27 @@
#ifndef __GLYPHSUBSTITUTIONTABLES_H #ifndef __GLYPHSUBSTITUTIONTABLES_H
#define __GLYPHSUBSTITUTIONTABLES_H #define __GLYPHSUBSTITUTIONTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "Lookups.h" #include "Lookups.h"
#include "GlyphLookupTables.h" #include "GlyphLookupTables.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class LEGlyphFilter; class LEGlyphFilter;
struct GlyphDefinitionTableHeader; struct GlyphDefinitionTableHeader;
struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader
{ {
le_int32 process(LEGlyphStorage &glyphStorage, le_int32 process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
le_bool rightToLeft, LETag scriptTag, LETag languageTag, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEGlyphFilter *filter,
const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
const LEGlyphFilter *filter, const FeatureMap *featureMap,
le_int32 featureMapCount, le_bool featureOrder) const;
}; };
enum GlyphSubstitutionSubtableTypes enum GlyphSubstitutionSubtableTypes
@ -64,4 +69,5 @@ enum GlyphSubstitutionSubtableTypes
typedef LookupSubtable GlyphSubstitutionSubtable; typedef LookupSubtable GlyphSubstitutionSubtable;
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* HanLayoutEngine.cpp: OpenType processing for Han fonts. * HanLayoutEngine.cpp: OpenType processing for Han fonts.
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved. * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
@ -41,6 +40,10 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HanOpenTypeLayoutEngine)
#define loclFeatureTag LE_LOCL_FEATURE_TAG #define loclFeatureTag LE_LOCL_FEATURE_TAG
#define smplFeatureTag LE_SMPL_FEATURE_TAG #define smplFeatureTag LE_SMPL_FEATURE_TAG
#define tradFeatureTag LE_TRAD_FEATURE_TAG #define tradFeatureTag LE_TRAD_FEATURE_TAG
@ -60,9 +63,8 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
#define features (loclFeatureMask) #define features (loclFeatureMask)
HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
const GlyphSubstitutionTableHeader *gsubTable)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
{ {
fFeatureMap = featureMap; fFeatureMap = featureMap;
@ -74,8 +76,7 @@ HanOpenTypeLayoutEngine::~HanOpenTypeLayoutEngine()
// nothing to do // nothing to do
} }
le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success) LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -104,3 +105,5 @@ le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
return count; return count;
} }
U_NAMESPACE_END

View File

@ -23,8 +23,8 @@
* *
*/ */
/* /*
*
* HanLayoutEngine.h: OpenType processing for Han fonts. * HanLayoutEngine.h: OpenType processing for Han fonts.
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved. * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
@ -40,6 +40,8 @@
#include "GlyphSubstitutionTables.h" #include "GlyphSubstitutionTables.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
/** /**
@ -69,8 +71,7 @@ public:
* *
* @internal * @internal
*/ */
HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 languageCode,
le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
@ -81,6 +82,20 @@ public:
*/ */
virtual ~HanOpenTypeLayoutEngine(); virtual ~HanOpenTypeLayoutEngine();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
/** /**
@ -92,10 +107,8 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the characters are in a * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
* right to left directional run * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set.
* @param glyphStorage - the object holding the glyph storage. The char
* index and auxillary data arrays will be set.
* *
* Output parameters: * Output parameters:
* @param outChars - the output character arrayt * @param outChars - the output character arrayt
@ -107,9 +120,10 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "OpenTypeUtilities.h" #include "OpenTypeUtilities.h"
#include "IndicReordering.h" #include "IndicReordering.h"
U_NAMESPACE_BEGIN
// Split matra table indices // Split matra table indices
#define _x1 (1 << CF_INDEX_SHIFT) #define _x1 (1 << CF_INDEX_SHIFT)
#define _x2 (2 << CF_INDEX_SHIFT) #define _x2 (2 << CF_INDEX_SHIFT)
@ -385,3 +387,5 @@ le_int32 IndicReordering::getWorstCaseExpansion(le_int32 scriptCode)
return classTable->getWorstCaseExpansion(); return classTable->getWorstCaseExpansion();
} }
U_NAMESPACE_END

View File

@ -45,20 +45,20 @@
#include "IndicReordering.h" #include "IndicReordering.h"
IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, U_NAMESPACE_BEGIN
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
const GlyphSubstitutionTableHeader *gsubTable) UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable),
fMPreFixups(NULL) IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), fMPreFixups(NULL)
{ {
fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount); fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
fFeatureOrder = TRUE; fFeatureOrder = TRUE;
} }
IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fMPreFixups(NULL)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags),
fMPreFixups(NULL)
{ {
fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount); fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
fFeatureOrder = TRUE; fFeatureOrder = TRUE;
@ -71,8 +71,7 @@ IndicOpenTypeLayoutEngine::~IndicOpenTypeLayoutEngine()
// Input: characters, tags // Input: characters, tags
// Output: glyphs, char indices // Output: glyphs, char indices
le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -84,8 +83,7 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[],
return 0; return 0;
} }
le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, glyphStorage, success);
rightToLeft, glyphStorage, success);
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
@ -99,8 +97,7 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[],
// Input: characters // Input: characters
// Output: characters, char indices, tags // Output: characters, char indices, tags
// Returns: output character count // Returns: output character count
le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -131,9 +128,10 @@ le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
// NOTE: assumes this allocates featureTags... // NOTE: assumes this allocates featureTags...
// (probably better than doing the worst case stuff here...) // (probably better than doing the worst case stuff here...)
le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups);
outChars, glyphStorage, &fMPreFixups);
glyphStorage.adoptGlyphCount(outCharCount);
glyphStorage.adoptGlyphCount(outCharCount);
return outCharCount; return outCharCount;
} }
U_NAMESPACE_END

View File

@ -43,6 +43,8 @@
#include "GlyphDefinitionTables.h" #include "GlyphDefinitionTables.h"
#include "GlyphPositioningTables.h" #include "GlyphPositioningTables.h"
U_NAMESPACE_BEGIN
class MPreFixups; class MPreFixups;
class LEGlyphStorage; class LEGlyphStorage;
@ -77,8 +79,7 @@ public:
* *
* @internal * @internal
*/ */
IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode,
le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
/** /**
@ -94,8 +95,8 @@ public:
* *
* @internal * @internal
*/ */
IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); le_int32 typoFlags);
/** /**
* The destructor, virtual for correct polymorphic invocation. * The destructor, virtual for correct polymorphic invocation.
@ -104,6 +105,20 @@ public:
*/ */
virtual ~IndicOpenTypeLayoutEngine(); virtual ~IndicOpenTypeLayoutEngine();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
/** /**
@ -117,10 +132,9 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the characters are in a * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
* right to left directional run * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
* @param glyphStorage - the glyph storage object. The glyph and character * the auxillary data array will be set to the feature tags.
* index arrays will be set. The auxillary data array will be set to the feature tags.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -129,8 +143,7 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
@ -147,11 +160,9 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the characters are in a * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
* right to left directional run
* @param featureTags - the feature tag array * @param featureTags - the feature tag array
* @param glyphStorage - the glyph storage object. The glyph and char * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
* index arrays will be set.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -163,12 +174,14 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
LEErrorCode &success);
private: private:
MPreFixups *fMPreFixups; MPreFixups *fMPreFixups;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,12 +32,19 @@
#ifndef __INDICREARRANGEMENT_H #ifndef __INDICREARRANGEMENT_H
#define __INDICREARRANGEMENT_H #define __INDICREARRANGEMENT_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LayoutTables.h" #include "LayoutTables.h"
#include "StateTables.h" #include "StateTables.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "MorphStateTables.h" #include "MorphStateTables.h"
U_NAMESPACE_BEGIN
struct IndicRearrangementSubtableHeader : MorphStateTableHeader struct IndicRearrangementSubtableHeader : MorphStateTableHeader
{ {
}; };
@ -78,4 +85,6 @@ struct IndicRearrangementStateEntry : StateEntry
{ {
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -39,6 +39,10 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor)
IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader) IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader)
: StateTableProcessor(morphSubtableHeader) : StateTableProcessor(morphSubtableHeader)
{ {
@ -56,8 +60,7 @@ void IndicRearrangementProcessor::beginStateTable()
lastGlyph = 0; lastGlyph = 0;
} }
ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
le_int32 &currGlyph, EntryTableIndex index)
{ {
const IndicRearrangementStateEntry *entry = &entryTable[index]; const IndicRearrangementStateEntry *entry = &entryTable[index];
ByteOffset newState = SWAPW(entry->newStateOffset); ByteOffset newState = SWAPW(entry->newStateOffset);
@ -416,3 +419,5 @@ void IndicRearrangementProcessor::doRearrangementAction(LEGlyphStorage &glyphSto
break; break;
} }
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __INDICREARRANGEMENTPROCESSOR_H #ifndef __INDICREARRANGEMENTPROCESSOR_H
#define __INDICREARRANGEMENTPROCESSOR_H #define __INDICREARRANGEMENTPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "SubtableProcessor.h" #include "SubtableProcessor.h"
#include "StateTableProcessor.h" #include "StateTableProcessor.h"
#include "IndicRearrangement.h" #include "IndicRearrangement.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
class IndicRearrangementProcessor : public StateTableProcessor class IndicRearrangementProcessor : public StateTableProcessor
@ -54,12 +61,28 @@ public:
IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader); IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader);
virtual ~IndicRearrangementProcessor(); virtual ~IndicRearrangementProcessor();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
le_int32 firstGlyph; le_int32 firstGlyph;
le_int32 lastGlyph; le_int32 lastGlyph;
const IndicRearrangementStateEntry *entryTable; const IndicRearrangementStateEntry *entryTable;
const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader; const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -36,6 +36,8 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "MPreFixups.h" #include "MPreFixups.h"
U_NAMESPACE_BEGIN
#define initFeatureTag LE_INIT_FEATURE_TAG #define initFeatureTag LE_INIT_FEATURE_TAG
#define nuktFeatureTag LE_NUKT_FEATURE_TAG #define nuktFeatureTag LE_NUKT_FEATURE_TAG
#define akhnFeatureTag LE_AKHN_FEATURE_TAG #define akhnFeatureTag LE_AKHN_FEATURE_TAG
@ -71,7 +73,7 @@
#define distFeatureMask 0x00020000UL #define distFeatureMask 0x00020000UL
#define initFeatureMask 0x00010000UL #define initFeatureMask 0x00010000UL
class ReorderingOutput { class ReorderingOutput : public UMemory {
private: private:
le_int32 fOutIndex; le_int32 fOutIndex;
LEUnicode *fOutChars; LEUnicode *fOutChars;
@ -187,8 +189,7 @@ public:
fOutIndex += 1; fOutIndex += 1;
} }
le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, FeatureMask matraFeatures, le_bool wordStart)
FeatureMask matraFeatures, le_bool wordStart)
{ {
IndicClassTable::CharClass matraClass = classTable->getCharClass(matra); IndicClassTable::CharClass matraClass = classTable->getCharClass(matra);
@ -219,8 +220,7 @@ public:
return FALSE; return FALSE;
} }
void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures)
le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures)
{ {
IndicClassTable::CharClass vmClass = classTable->getCharClass(vowelModifier); IndicClassTable::CharClass vmClass = classTable->getCharClass(vowelModifier);
@ -244,8 +244,7 @@ public:
} }
} }
void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures)
le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures)
{ {
IndicClassTable::CharClass smClass = classTable->getCharClass(stressMark); IndicClassTable::CharClass smClass = classTable->getCharClass(stressMark);
@ -360,9 +359,7 @@ enum
}; };
// TODO: Find better names for these! // TODO: Find better names for these!
#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | \ #define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | \
blwmFeatureMask | abvmFeatureMask | distFeatureMask)
#define tagArray3 (pstfFeatureMask | tagArray4) #define tagArray3 (pstfFeatureMask | tagArray4)
#define tagArray2 (halfFeatureMask | tagArray3) #define tagArray2 (halfFeatureMask | tagArray3)
#define tagArray1 (blwfFeatureMask | tagArray2) #define tagArray1 (blwfFeatureMask | tagArray2)
@ -415,8 +412,7 @@ const FeatureMap *IndicReordering::getFeatureMap(le_int32 &count)
return featureMap; return featureMap;
} }
le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
const LEUnicode *chars, le_int32 prev, le_int32 charCount)
{ {
le_int32 cursor = prev; le_int32 cursor = prev;
le_int8 state = 0; le_int8 state = 0;
@ -752,3 +748,5 @@ void IndicReordering::adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphS
delete mpreFixups; delete mpreFixups;
} }
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __INDICREORDERING_H #ifndef __INDICREORDERING_H
#define __INDICREORDERING_H #define __INDICREORDERING_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
// Characters that get refered to by name... // Characters that get refered to by name...
#define C_SIGN_ZWNJ 0x200C #define C_SIGN_ZWNJ 0x200C
#define C_SIGN_ZWJ 0x200D #define C_SIGN_ZWJ 0x200D
@ -140,7 +147,7 @@ struct IndicClassTable
static const IndicClassTable *getScriptClassTable(le_int32 scriptCode); static const IndicClassTable *getScriptClassTable(le_int32 scriptCode);
}; };
class IndicReordering { class IndicReordering /* not : public UObject because all methods are static */ {
public: public:
static le_int32 getWorstCaseExpansion(le_int32 scriptCode); static le_int32 getWorstCaseExpansion(le_int32 scriptCode);
@ -156,8 +163,7 @@ private:
// do not instantiate // do not instantiate
IndicReordering(); IndicReordering();
static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
le_int32 prev, le_int32 charCount);
}; };
@ -305,4 +311,5 @@ inline le_bool IndicClassTable::hasBelowBaseForm(LEUnicode ch) const
return hasBelowBaseForm(getCharClass(ch)); return hasBelowBaseForm(getCharClass(ch));
} }
U_NAMESPACE_END
#endif #endif

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
* *
@ -39,6 +40,8 @@
#define DEBUG 0 #define DEBUG 0
U_NAMESPACE_BEGIN
struct PairInfo { struct PairInfo {
le_uint32 key; // sigh, MSVC compiler gags on union here le_uint32 key; // sigh, MSVC compiler gags on union here
le_int16 value; // fword, kern value in funits le_int16 value; // fword, kern value in funits
@ -191,6 +194,12 @@ void KernTable::process(LEGlyphStorage& storage)
float adjust = 0; float adjust = 0;
for (int i = 1, e = storage.getGlyphCount(); i < e; ++i) { for (int i = 1, e = storage.getGlyphCount(); i < e; ++i) {
key = key << 16 | (storage[i] & 0xffff); key = key << 16 | (storage[i] & 0xffff);
// argh, to do a binary search, we need to have the pair list in sorted order
// but it is not in sorted order on win32 platforms because of the endianness difference
// so either I have to swap the element each time I examine it, or I have to swap
// all the elements ahead of time and store them in the font
const PairInfo* p = pairs; const PairInfo* p = pairs;
const PairInfo* tp = (const PairInfo*)(p + rangeShift); const PairInfo* tp = (const PairInfo*)(p + rangeShift);
if (key > tp->key) { if (key > tp->key) {
@ -238,3 +247,6 @@ void KernTable::process(LEGlyphStorage& storage)
storage.adjustPosition(storage.getGlyphCount(), adjust, 0, success); storage.adjustPosition(storage.getGlyphCount(), adjust, 0, success);
} }
} }
U_NAMESPACE_END

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
* *
@ -37,9 +38,12 @@
#endif #endif
#include "LETypes.h" #include "LETypes.h"
//#include "LEFontInstance.h"
//#include "LEGlyphStorage.h"
#include <stdio.h> #include <stdio.h>
U_NAMESPACE_BEGIN
struct PairInfo; struct PairInfo;
class LEFontInstance; class LEFontInstance;
class LEGlyphStorage; class LEGlyphStorage;
@ -67,4 +71,6 @@ class U_LAYOUT_API KernTable
void process(LEGlyphStorage& storage); void process(LEGlyphStorage& storage);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -23,8 +23,8 @@
* *
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
* This file is a modification of the ICU file IndicLayoutEngine.cpp * This file is a modification of the ICU file IndicLayoutEngine.cpp
@ -38,17 +38,20 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "KhmerReordering.h" #include "KhmerReordering.h"
KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, U_NAMESPACE_BEGIN
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
const GlyphSubstitutionTableHeader *gsubTable) UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine)
KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
{ {
fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount); fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount);
fFeatureOrder = TRUE; fFeatureOrder = TRUE;
} }
KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) le_int32 typoFlags)
: OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
{ {
fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount); fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount);
@ -63,16 +66,14 @@ KhmerOpenTypeLayoutEngine::~KhmerOpenTypeLayoutEngine()
// Input: characters // Input: characters
// Output: characters, char indices, tags // Output: characters, char indices, tags
// Returns: output character count // Returns: output character count
le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
} }
if (chars == NULL || offset < 0 || count < 0 || max < 0 || if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
offset >= max || offset + count > max) {
success = LE_ILLEGAL_ARGUMENT_ERROR; success = LE_ILLEGAL_ARGUMENT_ERROR;
return 0; return 0;
} }
@ -96,9 +97,10 @@ le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
// NOTE: assumes this allocates featureTags... // NOTE: assumes this allocates featureTags...
// (probably better than doing the worst case stuff here...) // (probably better than doing the worst case stuff here...)
le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count, le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage);
fScriptCode, outChars, glyphStorage);
glyphStorage.adoptGlyphCount(outCharCount); glyphStorage.adoptGlyphCount(outCharCount);
return outCharCount; return outCharCount;
} }
U_NAMESPACE_END

View File

@ -23,6 +23,7 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
@ -45,19 +46,18 @@
// #include "GlyphDefinitionTables.h" // #include "GlyphDefinitionTables.h"
// #include "GlyphPositioningTables.h" // #include "GlyphPositioningTables.h"
U_NAMESPACE_BEGIN
// class MPreFixups; // class MPreFixups;
// class LEGlyphStorage; // class LEGlyphStorage;
/** /**
* This class implements OpenType layout for Khmer OpenType fonts, as * This class implements OpenType layout for Khmer OpenType fonts, as
* specified by Microsoft in "Creating and Supporting OpenType Fonts * specified by Microsoft in "Creating and Supporting OpenType Fonts for
* for Khmer Scripts" * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
* (http://www.microsoft.com/typography/otspec/indicot/default.htm)
* TODO: change url
* *
* This class overrides the characterProcessing method to do Khmer * This class overrides the characterProcessing method to do Khmer character processing
* character processing and reordering (See the MS spec. for more * and reordering (See the MS spec. for more details)
* details)
* *
* @internal * @internal
*/ */
@ -65,11 +65,10 @@ class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
{ {
public: public:
/** /**
* This is the main constructor. It constructs an instance of * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
* KhmerOpenTypeLayoutEngine for a particular font, script and * a particular font, script and language. It takes the GSUB table as a parameter since
* language. It takes the GSUB table as a parameter since * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
* LayoutEngine::layoutEngineFactory has to read the GSUB table to * Khmer OpenType font.
* know that it has an Khmer OpenType font.
* *
* @param fontInstance - the font * @param fontInstance - the font
* @param scriptCode - the script * @param scriptCode - the script
@ -82,14 +81,12 @@ public:
* *
* @internal * @internal
*/ */
KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
const GlyphSubstitutionTableHeader *gsubTable);
/** /**
* This constructor is used when the font requires a "canned" GSUB * This constructor is used when the font requires a "canned" GSUB table which can't be known
* table which can't be known until after this constructor has * until after this constructor has been invoked.
* been invoked.
* *
* @param fontInstance - the font * @param fontInstance - the font
* @param scriptCode - the script * @param scriptCode - the script
@ -100,8 +97,8 @@ public:
* *
* @internal * @internal
*/ */
KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); le_int32 typoFlags);
/** /**
* The destructor, virtual for correct polymorphic invocation. * The destructor, virtual for correct polymorphic invocation.
@ -110,25 +107,35 @@ public:
*/ */
virtual ~KhmerOpenTypeLayoutEngine(); virtual ~KhmerOpenTypeLayoutEngine();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
protected: protected:
/** /**
* This method does Khmer OpenType character processing. It * This method does Khmer OpenType character processing. It assigns the OpenType feature
* assigns the OpenType feature tags to the characters, and may * tags to the characters, and may generate output characters which have been reordered.
* generate output characters which have been reordered. It may * It may also split some vowels, resulting in more output characters than input characters.
* also split some vowels, resulting in more output characters
* than input characters.
* *
* Input parameters: * Input parameters:
* @param chars - the input character context * @param chars - the input character context
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - <code>TRUE</code> if the characters are in * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
* a right to left directional run * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
* @param glyphStorage - the glyph storage object. The glyph and * the auxillary data array will be set to the feature tags.
* character index arrays will be set. the auxillary data array
* will be set to the feature tags.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -137,9 +144,11 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -37,6 +37,9 @@
#include "KhmerReordering.h" #include "KhmerReordering.h"
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
U_NAMESPACE_BEGIN
// Characters that get refered to by name... // Characters that get refered to by name...
enum enum
{ {
@ -53,35 +56,23 @@ enum
enum enum
{ {
// simple classes, they are used in the statetable (in this file) // simple classes, they are used in the statetable (in this file) to control the length of a syllable
// to control the length of a syllable they are also used to know // they are also used to know where a character should be placed (location in reference to the base character)
// where a character should be placed (location in reference to // and also to know if a character, when independtly displayed, should be displayed with a dotted-circle to
// the base character) and also to know if a character, when // indicate error in syllable construction
// independtly displayed, should be displayed with a dotted-circle
// to indicate error in syllable construction
_xx = KhmerClassTable::CC_RESERVED, _xx = KhmerClassTable::CC_RESERVED,
_sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_POS_ABOVE,
| KhmerClassTable::CF_POS_ABOVE, _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE| KhmerClassTable::CF_POS_AFTER,
_sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE
| KhmerClassTable::CF_POS_AFTER,
_c1 = KhmerClassTable::CC_CONSONANT | KhmerClassTable::CF_CONSONANT, _c1 = KhmerClassTable::CC_CONSONANT | KhmerClassTable::CF_CONSONANT,
_c2 = KhmerClassTable::CC_CONSONANT2 | KhmerClassTable::CF_CONSONANT, _c2 = KhmerClassTable::CC_CONSONANT2 | KhmerClassTable::CF_CONSONANT,
_c3 = KhmerClassTable::CC_CONSONANT3 | KhmerClassTable::CF_CONSONANT, _c3 = KhmerClassTable::CC_CONSONANT3 | KhmerClassTable::CF_CONSONANT,
_rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE,
| KhmerClassTable::CF_DOTTED_CIRCLE, _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_SHIFTER,
_cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE | KhmerClassTable::CF_DOTTED_CIRCLE,
| KhmerClassTable::CF_SHIFTER, _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW | KhmerClassTable::CF_DOTTED_CIRCLE,
_dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL,
| KhmerClassTable::CF_DOTTED_CIRCLE, _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE,
_db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG | KhmerClassTable::CF_DOTTED_CIRCLE,
| KhmerClassTable::CF_DOTTED_CIRCLE,
_da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE
| KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL,
_dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER
| KhmerClassTable::CF_DOTTED_CIRCLE,
_co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG
| KhmerClassTable::CF_DOTTED_CIRCLE,
// split vowel // split vowel
_va = _da | KhmerClassTable::CF_SPLIT_VOWEL, _va = _da | KhmerClassTable::CF_SPLIT_VOWEL,
@ -90,13 +81,10 @@ enum
// Character class tables // Character class tables
// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs...
// _xx character does not combine into syllable, such as numbers,
// puntuation marks, non-Khmer signs...
// _sa Sign placed above the base // _sa Sign placed above the base
// _sp Sign placed after the base // _sp Sign placed after the base
// _c1 Consonant of type 1 or independent vowel (independent vowels // _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants)
// behave as type 1 consonants)
// _c2 Consonant of type 2 (only RO) // _c2 Consonant of type 2 (only RO)
// _c3 Consonant of type 3 // _c3 Consonant of type 3
// _rb Khmer sign robat u17CC. combining mark for subscript consonants // _rb Khmer sign robat u17CC. combining mark for subscript consonants
@ -105,13 +93,10 @@ enum
// _db Dependent vowel placed below the base // _db Dependent vowel placed below the base
// _da Dependent vowel placed above the base // _da Dependent vowel placed above the base
// _dr Dependent vowel placed behind the base (right of the base) // _dr Dependent vowel placed behind the base (right of the base)
// _co Khmer combining mark COENG u17D2, combines with the consonant // _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following
// or independent vowel following it to create a subscript consonant // it to create a subscript consonant or independent vowel
// or independent vowel // _va Khmer split vowel in wich the first part is before the base and the second one above the base
// _va Khmer split vowel in wich the first part is before the base and // _vr Khmer split vowel in wich the first part is before the base and the second one behind (right of) the base
// the second one above the base
// _vr Khmer split vowel in wich the first part is before the base and
// the second one behind (right of) the base
static const KhmerClassTable::CharClass khmerCharClasses[] = static const KhmerClassTable::CharClass khmerCharClasses[] =
{ {
@ -129,19 +114,19 @@ static const KhmerClassTable::CharClass khmerCharClasses[] =
// //
// //
// The range of characters defined in the above table is defined // The range of characters defined in the above table is defined here. FOr Khmer 1780 to 17DF
// here. FOr Khmer 1780 to 17DF Even if the Khmer range is bigger, all // Even if the Khmer range is bigger, all other characters are not combinable, and therefore treated
// other characters are not combinable, and therefore treated as _xx // as _xx
static const KhmerClassTable khmerClassTable = {0x1780, 0x17df, khmerCharClasses}; static const KhmerClassTable khmerClassTable = {0x1780, 0x17df, khmerCharClasses};
// Below we define how a character in the input string is either in // Below we define how a character in the input string is either in the khmerCharClasses table
// the khmerCharClasses table (in which case we get its type back), a // (in which case we get its type back), a ZWJ or ZWNJ (two characters that may appear
// ZWJ or ZWNJ (two characters that may appear within the syllable, // within the syllable, but are not in the table) we also get their type back, or an unknown object
// but are not in the table) we also get their type back, or an // in which case we get _xx (CC_RESERVED) back
// unknown object in which case we get _xx (CC_RESERVED) back
KhmerClassTable::CharClass KhmerClassTable::getCharClass(LEUnicode ch) const KhmerClassTable::CharClass KhmerClassTable::getCharClass(LEUnicode ch) const
{ {
if (ch == C_SIGN_ZWJ) { if (ch == C_SIGN_ZWJ) {
return CC_ZERO_WIDTH_J_MARK; return CC_ZERO_WIDTH_J_MARK;
} }
@ -164,13 +149,14 @@ const KhmerClassTable *KhmerClassTable::getKhmerClassTable()
class ReorderingOutput { class ReorderingOutput : public UMemory {
private: private:
le_int32 fOutIndex; le_int32 fOutIndex;
LEUnicode *fOutChars; LEUnicode *fOutChars;
LEGlyphStorage &fGlyphStorage; LEGlyphStorage &fGlyphStorage;
public: public:
ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage) ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage)
: fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage) : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage)
@ -232,18 +218,11 @@ public:
#define abvmFeatureMask 0x00100000UL #define abvmFeatureMask 0x00100000UL
#define mkmkFeatureMask 0x00080000UL #define mkmkFeatureMask 0x00080000UL
#define tagPref (prefFeatureMask | presFeatureMask | \ #define tagPref (prefFeatureMask | presFeatureMask | cligFeatureMask | distFeatureMask)
cligFeatureMask | distFeatureMask) #define tagAbvf (abvfFeatureMask | abvsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask)
#define tagAbvf (abvfFeatureMask | abvsFeatureMask | \ #define tagPstf (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask)
cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask) #define tagBlwf (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
#define tagPstf (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | \ #define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask | mkmkFeatureMask)
presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | \
distFeatureMask | blwmFeatureMask)
#define tagBlwf (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | \
distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | \
blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | \
blwmFeatureMask | mkmkFeatureMask)
@ -274,35 +253,32 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
// The stateTable is used to calculate the end (the length) of a well // The stateTable is used to calculate the end (the length) of a well
// formed Khmer Syllable. // formed Khmer Syllable.
// //
// Each horizontal line is ordered exactly the same way as the values // Each horizontal line is ordered exactly the same way as the values in KhmerClassTable
// in KhmerClassTable CharClassValues in KhmerReordering.h This // CharClassValues in KhmerReordering.h This coincidence of values allows the
// coincidence of values allows the follow up of the table. // follow up of the table.
// //
// Each line corresponds to a state, which does not necessarily need // Each line corresponds to a state, which does not necessarily need to be a type
// to be a type of component... for example, state 2 is a base, with // of component... for example, state 2 is a base, with is always a first character
// is always a first character in the syllable, but the state could be // in the syllable, but the state could be produced a consonant of any type when
// produced a consonant of any type when it is the first character // it is the first character that is analysed (in ground state).
// that is analysed (in ground state).
// //
// Differentiating 3 types of consonants is necessary in order to // Differentiating 3 types of consonants is necessary in order to
// forbid the use of certain combinations, such as having a second // forbid the use of certain combinations, such as having a second
// coeng after a coeng RO. // coeng after a coeng RO,
// The inexistent possibility of having a type 3 after another type 3 // The inexistent possibility of having a type 3 after another type 3 is permitted,
// is permitted, eliminating it would very much complicate the table, // eliminating it would very much complicate the table, and it does not create typing
// and it does not create typing problems, as the case above. // problems, as the case above.
// //
// The table is quite complex, in order to limit the number of coeng // The table is quite complex, in order to limit the number of coeng consonants
// consonants to 2 (by means of the table). // to 2 (by means of the table).
// //
// There a peculiarity, as far as Unicode is concerned: // There a peculiarity, as far as Unicode is concerned:
// - The consonant-shifter is considered in two possible different // - The consonant-shifter is considered in two possible different
// locations, the one considered in Unicode 3.0 and the one considered // locations, the one considered in Unicode 3.0 and the one considered in
// in Unicode 4.0. (there is a backwards compatibility problem in this // Unicode 4.0. (there is a backwards compatibility problem in this standard).
// standard).
// xx independent character, such as a number, punctuation sign or // xx independent character, such as a number, punctuation sign or non-khmer char
// non-khmer char
// //
// c1 Khmer consonant of type 1 or an independent vowel // c1 Khmer consonant of type 1 or an independent vowel
// that is, a letter in which the subscript for is only under the // that is, a letter in which the subscript for is only under the
@ -320,10 +296,9 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
// //
// co coeng character (u17D2) // co coeng character (u17D2)
// //
// dv dependent vowel (including split vowels, they are treated in the // dv dependent vowel (including split vowels, they are treated in the same way).
// same way). even if dv is not defined above, the component that is // even if dv is not defined above, the component that is really tested for is
// really tested for is KhmerClassTable::CC_DEPENDENT_VOWEL, which is // KhmerClassTable::CC_DEPENDENT_VOWEL, which is common to all dependent vowels
// common to all dependent vowels
// //
// zwj Zero Width joiner // zwj Zero Width joiner
// //
@ -352,8 +327,7 @@ static const le_int8 khmerStateTable[][KhmerClassTable::CC_COUNT] =
{-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, // 8 - First consonant of type 2 after coeng {-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, // 8 - First consonant of type 2 after coeng
{-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, // 9 - First consonant or type 3 after ceong {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, // 9 - First consonant or type 3 after ceong
{-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before) {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before)
{-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 11 - Second coeng consonant {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 11 - Second coeng consonant (or ind. vowel) no register shifter before
// (or ind. vowel) no register shifter before
{-1, -1, 1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter {-1, -1, 1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter
{-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 13 - Second register shifter {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 13 - Second register shifter
{-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 14 - ZWJ before vowel {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 14 - ZWJ before vowel
@ -363,6 +337,7 @@ static const le_int8 khmerStateTable[][KhmerClassTable::CC_COUNT] =
{-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, // 18 - ZWJ after vowel {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, // 18 - ZWJ after vowel
{-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - Third coeng {-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - Third coeng
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, // 20 - dependent vowel after a Robat {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, // 20 - dependent vowel after a Robat
}; };
@ -377,15 +352,13 @@ const FeatureMap *KhmerReordering::getFeatureMap(le_int32 &count)
// Given an input string of characters and a location in which to start looking // Given an input string of characters and a location in which to start looking
// calculate, using the state table, which one is the last character of the syllable // calculate, using the state table, which one is the last character of the syllable
// that starts in the starting position. // that starts in the starting position.
le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
const LEUnicode *chars, le_int32 prev, le_int32 charCount)
{ {
le_int32 cursor = prev; le_int32 cursor = prev;
le_int8 state = 0; le_int8 state = 0;
while (cursor < charCount) { while (cursor < charCount) {
KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) & KhmerClassTable::CF_CLASS_MASK);
& KhmerClassTable::CF_CLASS_MASK);
state = khmerStateTable[state][charClass]; state = khmerStateTable[state][charClass];
@ -402,8 +375,8 @@ le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable,
// This is the real reordering function as applied to the Khmer language // This is the real reordering function as applied to the Khmer language
le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 /*scriptCode*/,
le_int32 /*scriptCode*/, LEUnicode *outChars, LEGlyphStorage &glyphStorage) LEUnicode *outChars, LEGlyphStorage &glyphStorage)
{ {
const KhmerClassTable *classTable = KhmerClassTable::getKhmerClassTable(); const KhmerClassTable *classTable = KhmerClassTable::getKhmerClassTable();
@ -442,8 +415,7 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount,
// and because CC_CONSONANT2 is enough to identify it, as it is the only consonant // and because CC_CONSONANT2 is enough to identify it, as it is the only consonant
// with this flag // with this flag
if ( (charClass & KhmerClassTable::CF_COENG) && (i + 1 < syllable) && if ( (charClass & KhmerClassTable::CF_COENG) && (i + 1 < syllable) &&
( (classTable->getCharClass(chars[i + 1]) & ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) )
KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) )
{ {
coengRo = i; coengRo = i;
} }
@ -455,16 +427,15 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount,
output.writeChar(C_RO, coengRo + 1, tagPref); output.writeChar(C_RO, coengRo + 1, tagPref);
} }
// shall we add a dotted circle? If in the position in which // shall we add a dotted circle?
// the base should be (first char in the string) there is a // If in the position in which the base should be (first char in the string) there is
// character that has the Dotted circle flag (a character that // a character that has the Dotted circle flag (a character that cannot be a base)
// cannot be a base) then write a dotted circle // then write a dotted circle
if (classTable->getCharClass(chars[prev]) & KhmerClassTable::CF_DOTTED_CIRCLE) { if (classTable->getCharClass(chars[prev]) & KhmerClassTable::CF_DOTTED_CIRCLE) {
output.writeChar(C_DOTTED_CIRCLE, prev, tagDefault); output.writeChar(C_DOTTED_CIRCLE, prev, tagDefault);
} }
// copy what is left to the output, skipping before vowels and // copy what is left to the output, skipping before vowels and coeng Ro if they are present
// coeng Ro if they are present
for (i = prev; i < syllable; i += 1) { for (i = prev; i < syllable; i += 1) {
charClass = classTable->getCharClass(chars[i]); charClass = classTable->getCharClass(chars[i]);
@ -515,30 +486,14 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount,
// and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two // and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two
// different positions, right after the shifter or after a vowel (Unicode 4) // different positions, right after the shifter or after a vowel (Unicode 4)
if ( (charClass & KhmerClassTable::CF_SHIFTER) && (i + 1 < syllable) ) { if ( (charClass & KhmerClassTable::CF_SHIFTER) && (i + 1 < syllable) ) {
if (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL ) { if ((classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL)
output.writeChar(chars[i], i, tagBlwf); || (i + 2 < syllable
break; && ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
} && ( (classTable->getCharClass(chars[i + 2]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT))
if (i + 2 < syllable && || (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_ABOVE_VOWEL))
( (classTable->getCharClass(chars[i + 1]) & || (i + 4 < syllable
KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) && && ( (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
( (classTable->getCharClass(chars[i + 2]) & && ( (classTable->getCharClass(chars[i + 4]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) )
KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) )
{
output.writeChar(chars[i], i, tagBlwf);
break;
}
if (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) &
KhmerClassTable::CF_ABOVE_VOWEL) )
{
output.writeChar(chars[i], i, tagBlwf);
break;
}
if (i + 4 < syllable &&
( (classTable->getCharClass(chars[i + 3]) &
KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) &&
( (classTable->getCharClass(chars[i + 4]) &
KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) )
{ {
output.writeChar(chars[i], i, tagBlwf); output.writeChar(chars[i], i, tagBlwf);
break; break;
@ -556,3 +511,6 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount,
return output.getOutputIndex(); return output.getOutputIndex();
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
* This file is a modification of the ICU file IndicReordering.h * This file is a modification of the ICU file IndicReordering.h
@ -35,80 +34,60 @@
#ifndef __KHMERREORDERING_H #ifndef __KHMERREORDERING_H
#define __KHMERREORDERING_H #define __KHMERREORDERING_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
// Vocabulary // Vocabulary
// Base -> A consonant or an independent vowel in its full (not subscript) form. It is the
// Base -> // center of the syllable, it can be souranded by coeng (subscript) consonants, vowels,
// A consonant or an independent vowel in its full (not // split vowels, signs... but there is only one base in a syllable, it has to be coded as
// subscript) form. It is the center of the syllable, it can be // the first character of the syllable.
// souranded by coeng (subscript) consonants, vowels, split // split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant).
// vowels, signs... but there is only one base in a syllable, it // Khmer language has five of them. Khmer split vowels either have one part before the
// has to be coded as the first character of the syllable. // base and one after the base or they have a part before the base and a part above the base.
// split vowel -> // The first part of all Khmer split vowels is the same character, identical to
// vowel that has two parts placed separately (e.g. Before and // the glyph of Khmer dependent vowel SRA EI
// after the consonant). Khmer language has five of them. Khmer // coeng --> modifier used in Khmer to construct coeng (subscript) consonants
// split vowels either have one part before the base and one after // Differently than indian languages, the coeng modifies the consonant that follows it,
// the base or they have a part before the base and a part above // not the one preceding it Each consonant has two forms, the base form and the subscript form
// the base. The first part of all Khmer split vowels is the same // the base form is the normal one (using the consonants code-point), the subscript form is
// character, identical to the glyph of Khmer dependent vowel SRA // displayed when the combination coeng + consonant is encountered.
// EI // Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant
// coeng -> // Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO)
// modifier used in Khmer to construct coeng (subscript) // Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA)
// consonants differently than indian languages, the coeng // Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds
// modifies the consonant that follows it, not the one preceding // if it is attached to a consonant of the first series or a consonant of the second series
// it Each consonant has two forms, the base form and the // Most consonants have an equivalent in the other series, but some of theme exist only in
// subscript form the base form is the normal one (using the // one series (for example SA). If we want to use the consonant SA with a vowel sound that
// consonants code-point), the subscript form is displayed when // can only be done with a vowel sound that corresponds to a vowel accompanying a consonant
// the combination coeng + consonant is encountered. // of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN
// Consonant of type 1 -> // x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and
// A consonant which has subscript for that only occupies space // MUSIKATOAN a second series consonant to have a first series vowel sound.
// under a base consonant // Consonant shifter are both normally supercript marks, but, when they are followed by a
// Consonant of type 2 -> // superscript, they change shape and take the form of subscript dependent vowel SRA U.
// Its subscript form occupies space under and before the base // If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they
// (only one, RO) // should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should
// Consonant of Type 3 -> // be placed after the coeng consonant.
// Its subscript form occupies space under and after the base // Dependent vowel -> In khmer dependent vowels can be placed above, below, before or after the base
// (KHO, CHHO, THHO, BA, YO, SA) // Each vowel has its own position. Only one vowel per syllable is allowed.
// Consonant shifter -> // Signs -> Khmer has above signs and post signs. Only one above sign and/or one post sign are
// Khmer has to series of consonants. The same dependent vowel has // Allowed in a syllable.
// different sounds if it is attached to a consonant of the first //
// series or a consonant of the second series Most consonants have
// an equivalent in the other series, but some of theme exist only
// in one series (for example SA). If we want to use the consonant
// SA with a vowel sound that can only be done with a vowel sound
// that corresponds to a vowel accompanying a consonant of the
// other series, then we need to use a consonant shifter: TRIISAP
// or MUSIKATOAN x17C9 y x17CA. TRIISAP changes a first series
// consonant to second series sound and MUSIKATOAN a second series
// consonant to have a first series vowel sound. Consonant
// shifter are both normally supercript marks, but, when they are
// followed by a superscript, they change shape and take the form
// of subscript dependent vowel SRA U. If they are in the same
// syllable as a coeng consonant, Unicode 3.0 says that they
// should be typed before the coeng. Unicode 4.0 breaks the
// standard and says that it should be placed after the coeng
// consonant.
// Dependent vowel ->
// In khmer dependent vowels can be placed above, below, before or
// after the base Each vowel has its own position. Only one vowel
// per syllable is allowed.
// Signs ->
// Khmer has above signs and post signs. Only one above sign
// and/or one post sign are Allowed in a syllable.
// //
// This list must include all types of components that can be used struct KhmerClassTable // This list must include all types of components that can be used inside a syllable
// inside a syllable
struct KhmerClassTable
{ {
// order is important here! This order must be the same that is enum CharClassValues // order is important here! This order must be the same that is found in each horizontal
// found in each horizontal line in the statetable for Khmer (file // line in the statetable for Khmer (file KhmerReordering.cpp).
// KhmerReordering.cpp).
enum CharClassValues
{ {
CC_RESERVED = 0, CC_RESERVED = 0,
CC_CONSONANT = 1, // consonant of type 1 or independent vowel CC_CONSONANT = 1, // consonant of type 1 or independent vowel
@ -116,8 +95,7 @@ struct KhmerClassTable
CC_CONSONANT3 = 3, // Consonant of type 3 CC_CONSONANT3 = 3, // Consonant of type 3
CC_ZERO_WIDTH_NJ_MARK = 4, // Zero Width non joiner character (0x200C) CC_ZERO_WIDTH_NJ_MARK = 4, // Zero Width non joiner character (0x200C)
CC_CONSONANT_SHIFTER = 5, CC_CONSONANT_SHIFTER = 5,
CC_ROBAT = 6, // Khmer special diacritic accent CC_ROBAT = 6, // Khmer special diacritic accent -treated differently in state table
// -treated differently in state table
CC_COENG = 7, // Subscript consonant combining character CC_COENG = 7, // Subscript consonant combining character
CC_DEPENDENT_VOWEL = 8, CC_DEPENDENT_VOWEL = 8,
CC_SIGN_ABOVE = 9, CC_SIGN_ABOVE = 9,
@ -131,10 +109,8 @@ struct KhmerClassTable
CF_CLASS_MASK = 0x0000FFFF, CF_CLASS_MASK = 0x0000FFFF,
CF_CONSONANT = 0x01000000, // flag to speed up comparing CF_CONSONANT = 0x01000000, // flag to speed up comparing
CF_SPLIT_VOWEL = 0x02000000, // flag for a split vowel -> the first part CF_SPLIT_VOWEL = 0x02000000, // flag for a split vowel -> the first part is added in front of the syllable
// is added in front of the syllable CF_DOTTED_CIRCLE = 0x04000000, // add a dotted circle if a character with this flag is the first in a syllable
CF_DOTTED_CIRCLE = 0x04000000, // add a dotted circle if a character with
// this flag is the first in a syllable
CF_COENG = 0x08000000, // flag to speed up comparing CF_COENG = 0x08000000, // flag to speed up comparing
CF_SHIFTER = 0x10000000, // flag to speed up comparing CF_SHIFTER = 0x10000000, // flag to speed up comparing
CF_ABOVE_VOWEL = 0x20000000, // flag to speed up comparing CF_ABOVE_VOWEL = 0x20000000, // flag to speed up comparing
@ -161,10 +137,10 @@ struct KhmerClassTable
}; };
class KhmerReordering { class KhmerReordering /* not : public UObject because all methods are static */ {
public: public:
static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
le_int32 scriptCode, LEUnicode *outChars, LEGlyphStorage &glyphStorage); LEUnicode *outChars, LEGlyphStorage &glyphStorage);
static const FeatureMap *getFeatureMap(le_int32 &count); static const FeatureMap *getFeatureMap(le_int32 &count);
@ -172,8 +148,10 @@ private:
// do not instantiate // do not instantiate
KhmerReordering(); KhmerReordering();
static le_int32 findSyllable(const KhmerClassTable *classTable, static le_int32 findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
const LEUnicode *chars, le_int32 prev, le_int32 charCount);
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
******************************************************************************* *******************************************************************************
* *
* Copyright (C) 1999-2005, International Business Machines * Copyright (C) 1999-2005, International Business Machines
@ -42,6 +41,10 @@
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEFontInstance)
const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit,
le_int32 script, LEErrorCode &success) const le_int32 script, LEErrorCode &success) const
{ {
@ -100,3 +103,5 @@ LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *map
return mapCharToGlyph(mappedChar); return mapCharToGlyph(mappedChar);
} }
U_NAMESPACE_END

View File

@ -34,6 +34,12 @@
#define __LEFONTINSTANCE_H #define __LEFONTINSTANCE_H
#include "LETypes.h" #include "LETypes.h"
/**
* \file
* \brief C++ API: Layout Engine Font Instance object
*/
U_NAMESPACE_BEGIN
/** /**
* Instances of this class are used by <code>LEFontInstance::mapCharsToGlyphs</code> and * Instances of this class are used by <code>LEFontInstance::mapCharsToGlyphs</code> and
@ -44,7 +50,7 @@
* *
* @stable ICU 3.2 * @stable ICU 3.2
*/ */
class LECharMapper class LECharMapper /* not : public UObject because this is an interface/mixin class */
{ {
public: public:
/** /**
@ -97,7 +103,7 @@ class LEGlyphStorage;
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
class LEFontInstance class U_LAYOUT_API LEFontInstance : public UObject
{ {
public: public:
@ -160,8 +166,7 @@ public:
* *
* @stable ICU 3.2 * @stable ICU 3.2
*/ */
virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
le_int32 limit, le_int32 script, LEErrorCode &success) const;
// //
// Font file access // Font file access
@ -238,8 +243,7 @@ public:
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
/** /**
* This method maps a single character to a glyph index, using the * This method maps a single character to a glyph index, using the
@ -502,6 +506,21 @@ public:
* @stable ICU 3.2 * @stable ICU 3.2
*/ */
virtual le_int32 getLineHeight() const; virtual le_int32 getLineHeight() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 3.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 3.2
*/
static UClassID getStaticClassID();
}; };
inline le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const inline le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const
@ -562,4 +581,7 @@ inline le_int32 LEFontInstance::getLineHeight() const
return getAscent() + getDescent() + getLeading(); return getAscent() + getDescent() + getLeading();
} }
U_NAMESPACE_END
#endif #endif

View File

@ -34,14 +34,15 @@
#include "LETypes.h" #include "LETypes.h"
U_NAMESPACE_BEGIN
/** /**
* This is a helper class that is used to * This is a helper class that is used to
* recognize a set of glyph indices. * recognize a set of glyph indices.
* *
* @internal * @internal
*/ */
class LEGlyphFilter class LEGlyphFilter /* not : public UObject because this is an interface/mixin class */ {
{
public: public:
/** /**
* Destructor. * Destructor.
@ -63,4 +64,5 @@ public:
virtual le_bool accept(LEGlyphID glyph) const = 0; virtual le_bool accept(LEGlyphID glyph) const = 0;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
********************************************************************** **********************************************************************
* Copyright (C) 1998-2005, International Business Machines * Copyright (C) 1998-2005, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
@ -35,6 +34,10 @@
#include "LEInsertionList.h" #include "LEInsertionList.h"
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEGlyphStorage)
LEGlyphStorage::LEGlyphStorage() LEGlyphStorage::LEGlyphStorage()
: fGlyphCount(0), fGlyphs(NULL), fCharIndices(NULL), fPositions(NULL), : fGlyphCount(0), fGlyphs(NULL), fCharIndices(NULL), fPositions(NULL),
fAuxData(NULL), fInsertionList(NULL), fSrcIndex(0), fDestIndex(0) fAuxData(NULL), fInsertionList(NULL), fSrcIndex(0), fDestIndex(0)
@ -603,3 +606,6 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl
return FALSE; return FALSE;
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
********************************************************************** **********************************************************************
* Copyright (C) 1998-2005, International Business Machines * Copyright (C) 1998-2005, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
@ -37,6 +36,13 @@
#include "LETypes.h" #include "LETypes.h"
#include "LEInsertionList.h" #include "LEInsertionList.h"
/**
* \file
* \brief C++ API: This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
*/
U_NAMESPACE_BEGIN
/** /**
* This class encapsulates the per-glyph storage used by the ICU LayoutEngine. * This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
* For each glyph it holds the glyph ID, the index of the backing store character * For each glyph it holds the glyph ID, the index of the backing store character
@ -50,7 +56,7 @@
* *
* @draft ICU 3.6 * @draft ICU 3.6
*/ */
class U_LAYOUT_API LEGlyphStorage : protected LEInsertionCallback class U_LAYOUT_API LEGlyphStorage : public UObject, protected LEInsertionCallback
{ {
private: private:
/** /**
@ -112,35 +118,37 @@ private:
protected: protected:
/** /**
* This implements <code>LEInsertionCallback</code>. The * This implements <code>LEInsertionCallback</code>. The <code>LEInsertionList</code>
* <code>LEInsertionList</code> will call this method once for * will call this method once for each insertion.
* each insertion.
* *
* @param atPosition the position of the insertion * @param atPosition the position of the insertion
* @param count the number of glyphs being inserted * @param count the number of glyphs being inserted
* @param newGlyphs the address of the new glyph IDs * @param newGlyphs the address of the new glyph IDs
* *
* @return <code>true</code> if <code>LEInsertionList</code> * @return <code>true</code> if <code>LEInsertionList</code> should stop
* should stop processing the insertion list after this insertion. * processing the insertion list after this insertion.
* *
* @see LEInsertionList.h * @see LEInsertionList.h
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]);
LEGlyphID newGlyphs[]);
public: public:
/** /**
* Allocates an empty <code>LEGlyphStorage</code> object. You must * Allocates an empty <code>LEGlyphStorage</code> object. You must call
* call <code>allocateGlyphArray, allocatePositions and * <code>allocateGlyphArray, allocatePositions and allocateAuxData</code>
* allocateAuxData</code> to allocate the data. * to allocate the data.
*
* @draft ICU 3.0
*/ */
LEGlyphStorage(); LEGlyphStorage();
/** /**
* The destructor. This will deallocate all of the arrays. * The destructor. This will deallocate all of the arrays.
*
* @draft ICU 3.0
*/ */
~LEGlyphStorage(); ~LEGlyphStorage();
@ -154,9 +162,9 @@ public:
inline le_int32 getGlyphCount() const; inline le_int32 getGlyphCount() const;
/** /**
* This method copies the glyph array into a caller supplied * This method copies the glyph array into a caller supplied array.
* array. The caller must ensure that the array is large enough * The caller must ensure that the array is large enough to hold all
* to hold all the glyphs. * the glyphs.
* *
* @param glyphs - the destiniation glyph array * @param glyphs - the destiniation glyph array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -166,10 +174,10 @@ public:
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const; void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
/** /**
* This method copies the glyph array into a caller supplied * This method copies the glyph array into a caller supplied array,
* array, ORing in extra bits. (This functionality is needed by * ORing in extra bits. (This functionality is needed by the JDK,
* the JDK, which uses 32 bits pre glyph idex, with the high 16 * which uses 32 bits pre glyph idex, with the high 16 bits encoding
* bits encoding the composite font slot number) * the composite font slot number)
* *
* @param glyphs - the destination (32 bit) glyph array * @param glyphs - the destination (32 bit) glyph array
* @param extraBits - this value will be ORed with each glyph index * @param extraBits - this value will be ORed with each glyph index
@ -177,13 +185,12 @@ public:
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method copies the character index array into a caller * This method copies the character index array into a caller supplied array.
* supplied array. The caller must ensure that the array is large * The caller must ensure that the array is large enough to hold a
* enough to hold a character index for each glyph. * character index for each glyph.
* *
* @param charIndices - the destiniation character index array * @param charIndices - the destiniation character index array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -193,9 +200,9 @@ public:
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const; void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
/** /**
* This method copies the character index array into a caller * This method copies the character index array into a caller supplied array.
* supplied array. The caller must ensure that the array is large * The caller must ensure that the array is large enough to hold a
* enough to hold a character index for each glyph. * character index for each glyph.
* *
* @param charIndices - the destiniation character index array * @param charIndices - the destiniation character index array
* @param indexBase - an offset which will be added to each index * @param indexBase - an offset which will be added to each index
@ -203,14 +210,13 @@ public:
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method copies the position array into a caller supplied * This method copies the position array into a caller supplied array.
* array. The caller must ensure that the array is large enough * The caller must ensure that the array is large enough to hold an
* to hold an X and Y position for each glyph, plus an extra X and * X and Y position for each glyph, plus an extra X and Y for the
* Y for the advance of the last glyph. * advance of the last glyph.
* *
* @param positions - the destiniation position array * @param positions - the destiniation position array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -233,33 +239,27 @@ public:
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method allocates the glyph array, the char indices array * This method allocates the glyph array, the char indices array and the insertion list. You
* and the insertion list. You must call this method before using * must call this method before using the object. This method also initializes the char indices
* the object. This method also initializes the char indices
* array. * array.
* @param initialGlyphCount the initial size of the glyph and char *
* indices arrays. * @param initialGlyphCount the initial size of the glyph and char indices arrays.
* @param rightToLeft <code>true</code> if the original input text * @param rightToLeft <code>true</code> if the original input text is right to left.
* is right to left. * @param success set to an error code if the storage cannot be allocated of if the initial
* @param success set to an error code if the storage cannot be * glyph count is not positive.
* allocated of if the initial glyph count is not positive.
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success);
LEErrorCode &success);
/** /**
* This method allocates the storage for the glyph positions. It * This method allocates the storage for the glyph positions. It allocates one extra X, Y
* allocates one extra X, Y position pair for the position just * position pair for the position just after the last glyph.
* after the last glyph.
* *
* @param success set to an error code if the positions array * @param success set to an error code if the positions array cannot be allocated.
* cannot be allocated.
* *
* @return the number of X, Y position pairs allocated. * @return the number of X, Y position pairs allocated.
* *
@ -270,8 +270,7 @@ public:
/** /**
* This method allocates the storage for the auxillary glyph data. * This method allocates the storage for the auxillary glyph data.
* *
* @param success set to an error code if the aulillary data array * @param success set to an error code if the aulillary data array cannot be allocated.
* cannot be allocated.
* *
* @return the size of the auxillary data array. * @return the size of the auxillary data array.
* *
@ -282,10 +281,8 @@ public:
/** /**
* Copy the entire auxillary data array. * Copy the entire auxillary data array.
* *
* @param auxData the auxillary data array will be copied to this * @param auxData the auxillary data array will be copied to this address
* address * @param success set to an error code if the data cannot be copied
* @param success set to an error code if the data cannot be
* copied
* *
* @draft ICU 3.6 * @draft ICU 3.6
*/ */
@ -295,8 +292,7 @@ public:
* Get the glyph ID for a particular glyph. * Get the glyph ID for a particular glyph.
* *
* @param glyphIndex the index into the glyph array * @param glyphIndex the index into the glyph array
* @param success set to an error code if the glyph ID cannot be * @param success set to an error code if the glyph ID cannot be retrieved.
* retrieved.
* *
* @return the glyph ID * @return the glyph ID
* *
@ -308,8 +304,7 @@ public:
* Get the char index for a particular glyph. * Get the char index for a particular glyph.
* *
* @param glyphIndex the index into the glyph array * @param glyphIndex the index into the glyph array
* @param success set to an error code if the char index cannot be * @param success set to an error code if the char index cannot be retrieved.
* retrieved.
* *
* @return the character index * @return the character index
* *
@ -322,8 +317,7 @@ public:
* Get the auxillary data for a particular glyph. * Get the auxillary data for a particular glyph.
* *
* @param glyphIndex the index into the glyph array * @param glyphIndex the index into the glyph array
* @param success set to an error code if the auxillary data * @param success set to an error code if the auxillary data cannot be retrieved.
* cannot be retrieved.
* *
* @return the auxillary data * @return the auxillary data
* *
@ -345,11 +339,10 @@ public:
/** /**
* Call this method to replace a single glyph in the glyph array * Call this method to replace a single glyph in the glyph array
* with multiple glyphs. This method uses the * with multiple glyphs. This method uses the <code>LEInsertionList</code>
* <code>LEInsertionList</code> to do the insertion. It returns * to do the insertion. It returns the address of storage where the new
* the address of storage where the new glyph IDs can be * glyph IDs can be stored. They will not actually be inserted into the
* stored. They will not actually be inserted into the glyph array * glyph array until <code>applyInsertions</code> is called.
* until <code>applyInsertions</code> is called.
* *
* @param atIndex the index of the glyph to be replaced * @param atIndex the index of the glyph to be replaced
* @param insertCount the number of glyphs to replace it with * @param insertCount the number of glyphs to replace it with
@ -381,26 +374,22 @@ public:
* *
* @param glyphIndex the index of the glyph * @param glyphIndex the index of the glyph
* @param glyphID the new glyph ID * @param glyphID the new glyph ID
* @param success will be set to an error code if the glyph ID * @param success will be set to an error code if the glyph ID cannot be set.
* cannot be set.
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success);
LEErrorCode &success);
/** /**
* Set the char index for a particular glyph. * Set the char index for a particular glyph.
* *
* @param glyphIndex the index of the glyph * @param glyphIndex the index of the glyph
* @param charIndex the new char index * @param charIndex the new char index
* @param success will be set to an error code if the char index * @param success will be set to an error code if the char index cannot be set.
* cannot be set.
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success);
LEErrorCode &success);
/** /**
* Set the X, Y position for a particular glyph. * Set the X, Y position for a particular glyph.
@ -408,13 +397,11 @@ public:
* @param glyphIndex the index of the glyph * @param glyphIndex the index of the glyph
* @param x the new X position * @param x the new X position
* @param y the new Y position * @param y the new Y position
* @param success will be set to an error code if the position * @param success will be set to an error code if the position cannot be set.
* cannot be set.
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void setPosition(le_int32 glyphIndex, float x, float y, void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success);
LEErrorCode &success);
/** /**
* Adjust the X, Y position for a particular glyph. * Adjust the X, Y position for a particular glyph.
@ -422,21 +409,18 @@ public:
* @param glyphIndex the index of the glyph * @param glyphIndex the index of the glyph
* @param xAdjust the adjustment to the glyph's X position * @param xAdjust the adjustment to the glyph's X position
* @param yAdjust the adjustment to the glyph's Y position * @param yAdjust the adjustment to the glyph's Y position
* @param success will be set to an error code if the glyph's * @param success will be set to an error code if the glyph's position cannot be adjusted.
* position cannot be adjusted.
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success);
LEErrorCode &success);
/** /**
* Set the auxillary data for a particular glyph. * Set the auxillary data for a particular glyph.
* *
* @param glyphIndex the index of the glyph * @param glyphIndex the index of the glyph
* @param auxData the new auxillary data * @param auxData the new auxillary data
* @param success will be set to an error code if the auxillary * @param success will be set to an error code if the auxillary data cannot be set.
* data cannot be set.
* *
* @draft ICU 3.6 * @draft ICU 3.6
*/ */
@ -512,13 +496,27 @@ public:
/** /**
* This method frees the glyph, character index, position and * This method frees the glyph, character index, position and
* auxillary data arrays so that the LayoutEngine can be reused to * auxillary data arrays so that the LayoutEngine can be reused
* layout a different characer array. (This method is also called * to layout a different characer array. (This method is also called
* by the destructor) * by the destructor)
* *
* @draft ICU 3.0 * @draft ICU 3.0
*/ */
void reset(); void reset();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 3.0
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 3.0
*/
static UClassID getStaticClassID();
}; };
inline le_int32 LEGlyphStorage::getGlyphCount() const inline le_int32 LEGlyphStorage::getGlyphCount() const
@ -531,4 +529,7 @@ inline LEGlyphID &LEGlyphStorage::operator[](le_int32 glyphIndex) const
return fGlyphs[glyphIndex]; return fGlyphs[glyphIndex];
} }
U_NAMESPACE_END
#endif #endif

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
********************************************************************** **********************************************************************
* Copyright (C) 1998-2004, International Business Machines * Copyright (C) 1998-2004, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
@ -34,6 +33,8 @@
#include "LETypes.h" #include "LETypes.h"
#include "LEInsertionList.h" #include "LEInsertionList.h"
U_NAMESPACE_BEGIN
#define ANY_NUMBER 1 #define ANY_NUMBER 1
struct InsertionRecord struct InsertionRecord
@ -44,6 +45,8 @@ struct InsertionRecord
LEGlyphID glyphs[ANY_NUMBER]; LEGlyphID glyphs[ANY_NUMBER];
}; };
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEInsertionList)
LEInsertionList::LEInsertionList(le_bool rightToLeft) LEInsertionList::LEInsertionList(le_bool rightToLeft)
: head(NULL), tail(NULL), growAmount(0), append(rightToLeft) : head(NULL), tail(NULL), growAmount(0), append(rightToLeft)
{ {
@ -106,3 +109,5 @@ le_bool LEInsertionList::applyInsertions(LEInsertionCallback *callback)
return FALSE; return FALSE;
} }
U_NAMESPACE_END

View File

@ -24,7 +24,6 @@
*/ */
/* /*
*
********************************************************************** **********************************************************************
* Copyright (C) 1998-2004, International Business Machines * Copyright (C) 1998-2004, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
@ -36,6 +35,8 @@
#include "LETypes.h" #include "LETypes.h"
U_NAMESPACE_BEGIN
struct InsertionRecord; struct InsertionRecord;
/** /**
@ -78,7 +79,7 @@ public:
* *
* @internal * @internal
*/ */
class LEInsertionList class LEInsertionList : public UObject
{ {
public: public:
/** /**
@ -140,6 +141,20 @@ public:
*/ */
void reset(); void reset();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
private: private:
/** /**
@ -174,4 +189,6 @@ private:
le_bool append; le_bool append;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -25,10 +25,12 @@
/* /*
* *
* (C) Copyright IBM Corp. 1998-2004. All Rights Reserved. * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
* *
* WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
* YOU REALLY KNOW WHAT YOU'RE DOING. * YOU REALLY KNOW WHAT YOU'RE DOING.
*
* Generated on: 07/19/2005 01:01:08 PM PDT
*/ */
#ifndef __LELANGUAGES_H #ifndef __LELANGUAGES_H
@ -36,12 +38,19 @@
#include "LETypes.h" #include "LETypes.h"
/**
* \file
* \brief C++ API: List of language codes for LayoutEngine
*/
U_NAMESPACE_BEGIN
/** /**
* A provisional list of language codes. For now, * A provisional list of language codes. For now,
* this is just a list of languages which the LayoutEngine * this is just a list of languages which the LayoutEngine
* supports. * supports.
* *
* @draft ICU 3.0 * @draft ICU 3.4
*/ */
enum LanguageCodes { enum LanguageCodes {
@ -79,4 +88,5 @@ enum LanguageCodes {
languageCodeCount = 30 languageCodeCount = 30
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -25,17 +25,23 @@
/* /*
* *
* (C) Copyright IBM Corp. 1998-2004. All Rights Reserved. * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
* *
* WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
* YOU REALLY KNOW WHAT YOU'RE DOING. * YOU REALLY KNOW WHAT YOU'RE DOING.
*
*/ */
#ifndef __LESCRIPTS_H #ifndef __LESCRIPTS_H
#define __LESCRIPTS_H #define __LESCRIPTS_H
#include "LETypes.h" #include "LETypes.h"
/**
* \file
* \brief C++ API: Constants for Unicode script values
*/
U_NAMESPACE_BEGIN
/** /**
* Constants for Unicode script values, generated using * Constants for Unicode script values, generated using
@ -104,4 +110,5 @@ enum ScriptCodes {
scriptCodeCount = 55 scriptCodeCount = 55
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -0,0 +1,132 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#ifndef __LESTANDALONE
#define __LESTANDALONE
/* Definitions to make Layout Engine work away from ICU. */
#ifndef U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
#endif
#ifndef U_NAMESPACE_END
#define U_NAMESPACE_END
#endif
/* RTTI Definition */
typedef const char *UClassID;
#ifndef UOBJECT_DEFINE_RTTI_IMPLEMENTATION
#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(x) UClassID x::getStaticClassID(){static char z=0; return (UClassID)&z; } UClassID x::getDynamicClassID() const{return x::getStaticClassID(); }
#endif
/* UMemory's functions aren't used by the layout engine. */
struct UMemory {};
/* UObject's functions aren't used by the layout engine. */
struct UObject {};
/* String handling */
#include <stdlib.h>
#include <string.h>
/**
* A convenience macro to test for the success of a LayoutEngine call.
*
* @stable ICU 2.4
*/
#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR)
/**
* A convenience macro to test for the failure of a LayoutEngine call.
*
* @stable ICU 2.4
*/
#define LE_FAILURE(code) ((code)>LE_NO_ERROR)
#ifndef _LP64
typedef long le_int32;
typedef unsigned long le_uint32;
#else
typedef int le_int32;
typedef unsigned int le_uint32;
#endif
#define HAVE_LE_INT32 1
#define HAVE_LE_UINT32 1
typedef unsigned short UChar;
typedef le_uint32 UChar32;
typedef short le_int16;
#define HAVE_LE_INT16 1
typedef unsigned short le_uint16;
#define HAVE_LE_UINT16
typedef signed char le_int8;
#define HAVE_LE_INT8
typedef unsigned char le_uint8;
#define HAVE_LE_UINT8
typedef char UBool;
/**
* Error codes returned by the LayoutEngine.
*
* @stable ICU 2.4
*/
enum LEErrorCode {
/* informational */
LE_NO_SUBFONT_WARNING = -127, // U_USING_DEFAULT_WARNING,
/* success */
LE_NO_ERROR = 0, // U_ZERO_ERROR,
/* failures */
LE_ILLEGAL_ARGUMENT_ERROR = 1, // U_ILLEGAL_ARGUMENT_ERROR,
LE_MEMORY_ALLOCATION_ERROR = 7, // U_MEMORY_ALLOCATION_ERROR,
LE_INDEX_OUT_OF_BOUNDS_ERROR = 8, //U_INDEX_OUTOFBOUNDS_ERROR,
LE_NO_LAYOUT_ERROR = 16, // U_UNSUPPORTED_ERROR,
LE_INTERNAL_ERROR = 5, // U_INTERNAL_PROGRAM_ERROR,
LE_FONT_FILE_NOT_FOUND_ERROR = 4, // U_FILE_ACCESS_ERROR,
LE_MISSING_FONT_TABLE_ERROR = 2 // U_MISSING_RESOURCE_ERROR
};
#define HAVE_LEERRORCODE
#define U_LAYOUT_API
#define uprv_malloc malloc
#define uprv_free free
#define uprv_memcpy memcpy
#define uprv_realloc realloc
#if !defined(U_IS_BIG_ENDIAN)
#ifdef _LITTLE_ENDIAN
#define U_IS_BIG_ENDIAN 0
#endif
#endif
#endif

View File

@ -26,7 +26,7 @@
/* /*
* *
* (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
*/ */
@ -35,11 +35,12 @@
#include "LETypes.h" #include "LETypes.h"
#if !defined(U_IS_BIG_ENDIAN) /**
#ifdef _LITTLE_ENDIAN * \file
#define U_IS_BIG_ENDIAN 0 * \brief C++ API: Endian independent access to data for LayoutEngine
#endif */
#endif
U_NAMESPACE_BEGIN
/** /**
* A convenience macro which invokes the swapWord member function * A convenience macro which invokes the swapWord member function
@ -47,7 +48,6 @@
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
#if defined(U_IS_BIG_ENDIAN) #if defined(U_IS_BIG_ENDIAN)
#if U_IS_BIG_ENDIAN #if U_IS_BIG_ENDIAN
#define SWAPW(value) (value) #define SWAPW(value) (value)
@ -64,7 +64,6 @@
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
#if defined(U_IS_BIG_ENDIAN) #if defined(U_IS_BIG_ENDIAN)
#if U_IS_BIG_ENDIAN #if U_IS_BIG_ENDIAN
#define SWAPL(value) (value) #define SWAPL(value) (value)
@ -86,8 +85,7 @@
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
class LESwaps class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ {
{
public: public:
#if !defined(U_IS_BIG_ENDIAN) #if !defined(U_IS_BIG_ENDIAN)
@ -144,4 +142,5 @@ private:
LESwaps() {} // private - forbid instantiation LESwaps() {} // private - forbid instantiation
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -23,7 +23,6 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
@ -33,75 +32,99 @@
#ifndef __LETYPES_H #ifndef __LETYPES_H
#define __LETYPES_H #define __LETYPES_H
/**
* If LE_Standalone is defined, it must exist and contain
* definitions for some core ICU defines.
*/
#ifdef LE_STANDALONE
#include "LEStandalone.h"
#endif
#ifdef LE_STANDALONE
/* Stand-alone Layout Engine- without ICU. */
#include "LEStandalone.h"
#define LE_USE_CMEMORY #define LE_USE_CMEMORY
#ifdef LE_USE_CMEMORY
#include <stdlib.h>
#include <string.h>
#endif
#ifndef _LP64
typedef long le_int32;
typedef unsigned long le_uint32;
#else #else
typedef int le_int32; #if !defined(LE_USE_CMEMORY) && (defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_STATIC_IMPLEMENTATION) || defined(U_COMBINED_IMPLEMENTATION))
typedef unsigned int le_uint32; #define LE_USE_CMEMORY
#endif #endif
typedef short le_int16; #include "unicode/utypes.h"
typedef unsigned short le_uint16; #include "unicode/uobject.h"
typedef signed char le_int8; #ifdef LE_USE_CMEMORY
typedef unsigned char le_uint8; #include "cmemory.h"
typedef char le_bool; #endif
#endif /* not standalone */
typedef char UClassID;
#if 0 U_NAMESPACE_BEGIN
/*!
* \file
* \brief Basic definitions for the ICU LayoutEngine
*/
/** /**
* A type used for signed, 32-bit integers. * A type used for signed, 32-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#ifndef HAVE_LE_INT32
typedef int32_t le_int32; typedef int32_t le_int32;
#endif
/** /**
* A type used for unsigned, 32-bit integers. * A type used for unsigned, 32-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#ifndef HAVE_LE_UINT32
typedef uint32_t le_uint32; typedef uint32_t le_uint32;
#endif
/** /**
* A type used for signed, 16-bit integers. * A type used for signed, 16-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#ifndef HAVE_LE_INT16
typedef int16_t le_int16; typedef int16_t le_int16;
#endif
#ifndef HAVE_LE_UINT16
/** /**
* A type used for unsigned, 16-bit integers. * A type used for unsigned, 16-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
typedef uint16_t le_uint16; typedef uint16_t le_uint16;
#endif
#ifndef HAVE_LE_INT8
/** /**
* A type used for signed, 8-bit integers. * A type used for signed, 8-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
typedef int8_t le_int8; typedef int8_t le_int8;
#endif
#ifndef HAVE_LE_UINT8
/** /**
* A type used for unsigned, 8-bit integers. * A type used for unsigned, 8-bit integers.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
typedef uint8_t le_uint8; typedef uint8_t le_uint8;
typedef char le_bool;
#endif #endif
/**
* A type used for boolean values.
*
* @stable ICU 2.4
*/
typedef UBool le_bool;
#ifndef TRUE #ifndef TRUE
/** /**
* Used for <code>le_bool</code> values which are <code>true</code>. * Used for <code>le_bool</code> values which are <code>true</code>.
@ -264,21 +287,21 @@ typedef le_uint32 LEGlyphID;
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
typedef le_uint16 LEUnicode16; typedef UChar LEUnicode16;
/** /**
* Used to represent 32-bit Unicode code points. * Used to represent 32-bit Unicode code points.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
typedef le_uint32 LEUnicode32; typedef UChar32 LEUnicode32;
/** /**
* Used to represent 16-bit Unicode code points. * Used to represent 16-bit Unicode code points.
* *
* @deprecated since ICU 2.4. Use LEUnicode16 instead * @deprecated since ICU 2.4. Use LEUnicode16 instead
*/ */
typedef le_uint16 LEUnicode; typedef UChar LEUnicode;
/** /**
* Used to hold a pair of (x, y) values which represent a point. * Used to hold a pair of (x, y) values which represent a point.
@ -325,7 +348,7 @@ typedef struct LEPoint LEPoint;
* *
* @internal * @internal
*/ */
#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) #define LE_ARRAY_COPY(dst, src, count) uprv_memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
/** /**
* Allocate an array of basic types. This is used to isolate the rest of * Allocate an array of basic types. This is used to isolate the rest of
@ -333,7 +356,7 @@ typedef struct LEPoint LEPoint;
* *
* @internal * @internal
*/ */
#define LE_NEW_ARRAY(type, count) (type *) malloc((count) * sizeof(type)) #define LE_NEW_ARRAY(type, count) (type *) uprv_malloc((count) * sizeof(type))
/** /**
* Re-allocate an array of basic types. This is used to isolate the rest of * Re-allocate an array of basic types. This is used to isolate the rest of
@ -341,7 +364,7 @@ typedef struct LEPoint LEPoint;
* *
* @internal * @internal
*/ */
#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0]) #define LE_GROW_ARRAY(array, newSize) uprv_realloc((void *) (array), (newSize) * sizeof (array)[0])
/** /**
* Free an array of basic types. This is used to isolate the rest of * Free an array of basic types. This is used to isolate the rest of
@ -349,7 +372,7 @@ typedef struct LEPoint LEPoint;
* *
* @internal * @internal
*/ */
#define LE_DELETE_ARRAY(array) free((void *) (array)) #define LE_DELETE_ARRAY(array) uprv_free((void *) (array))
#endif #endif
/** /**
@ -567,22 +590,24 @@ enum LEFeatureTags {
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#ifndef HAVE_LEERRORCODE
enum LEErrorCode { enum LEErrorCode {
/* informational */ /* informational */
LE_NO_SUBFONT_WARNING = -127, // U_USING_DEFAULT_WARNING, LE_NO_SUBFONT_WARNING = U_USING_DEFAULT_WARNING, /**< The font does not contain subfonts. */
/* success */ /* success */
LE_NO_ERROR = 0, // U_ZERO_ERROR, LE_NO_ERROR = U_ZERO_ERROR, /**< No error, no warning. */
/* failures */ /* failures */
LE_ILLEGAL_ARGUMENT_ERROR = 1, // U_ILLEGAL_ARGUMENT_ERROR, LE_ILLEGAL_ARGUMENT_ERROR = U_ILLEGAL_ARGUMENT_ERROR, /**< An illegal argument was detected. */
LE_MEMORY_ALLOCATION_ERROR = 7, // U_MEMORY_ALLOCATION_ERROR, LE_MEMORY_ALLOCATION_ERROR = U_MEMORY_ALLOCATION_ERROR, /**< Memory allocation error. */
LE_INDEX_OUT_OF_BOUNDS_ERROR = 8, //U_INDEX_OUTOFBOUNDS_ERROR, LE_INDEX_OUT_OF_BOUNDS_ERROR = U_INDEX_OUTOFBOUNDS_ERROR, /**< Trying to access an index that is out of bounds. */
LE_NO_LAYOUT_ERROR = 16, // U_UNSUPPORTED_ERROR, LE_NO_LAYOUT_ERROR = U_UNSUPPORTED_ERROR, /**< You must call layoutChars() first. */
LE_INTERNAL_ERROR = 5, // U_INTERNAL_PROGRAM_ERROR, LE_INTERNAL_ERROR = U_INTERNAL_PROGRAM_ERROR, /**< An internal error was encountered. */
LE_FONT_FILE_NOT_FOUND_ERROR = 4, // U_FILE_ACCESS_ERROR, LE_FONT_FILE_NOT_FOUND_ERROR = U_FILE_ACCESS_ERROR, /**< The requested font file cannot be opened. */
LE_MISSING_FONT_TABLE_ERROR = 2 // U_MISSING_RESOURCE_ERROR LE_MISSING_FONT_TABLE_ERROR = U_MISSING_RESOURCE_ERROR /**< The requested font table does not exist. */
}; };
#endif
#ifndef XP_CPLUSPLUS #ifndef XP_CPLUSPLUS
/** /**
@ -598,14 +623,20 @@ typedef enum LEErrorCode LEErrorCode;
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR) #ifndef LE_FAILURE
#define LE_SUCCESS(code) (U_SUCCESS((UErrorCode)code))
#endif
/** /**
* A convenience macro to test for the failure of a LayoutEngine call. * A convenience macro to test for the failure of a LayoutEngine call.
* *
* @stable ICU 2.4 * @stable ICU 2.4
*/ */
#define LE_FAILURE(code) ((code)>LE_NO_ERROR) #ifndef LE_FAILURE
#define LE_FAILURE(code) (U_FAILURE((UErrorCode)code))
#define U_LAYOUT_API
#endif #endif
U_NAMESPACE_END
#endif

View File

@ -23,6 +23,7 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
@ -40,6 +41,7 @@
#include "IndicLayoutEngine.h" #include "IndicLayoutEngine.h"
#include "KhmerLayoutEngine.h" #include "KhmerLayoutEngine.h"
#include "ThaiLayoutEngine.h" #include "ThaiLayoutEngine.h"
//#include "TibetanLayoutEngine.h"
#include "GXLayoutEngine.h" #include "GXLayoutEngine.h"
#include "ScriptAndLanguageTags.h" #include "ScriptAndLanguageTags.h"
#include "CharSubstitutionFilter.h" #include "CharSubstitutionFilter.h"
@ -55,6 +57,8 @@
#include "KernTable.h" #include "KernTable.h"
U_NAMESPACE_BEGIN
const LEUnicode32 DefaultCharMapper::controlChars[] = { const LEUnicode32 DefaultCharMapper::controlChars[] = {
0x0009, 0x000A, 0x000D, 0x0009, 0x000A, 0x000D,
/*0x200C, 0x200D,*/ 0x200E, 0x200F, /*0x200C, 0x200D,*/ 0x200E, 0x200F,
@ -101,9 +105,7 @@ LEUnicode32 DefaultCharMapper::mapChar(LEUnicode32 ch) const
} }
if (fMirror) { if (fMirror) {
le_int32 index = OpenTypeUtilities::search((le_uint32) ch, le_int32 index = OpenTypeUtilities::search((le_uint32) ch, (le_uint32 *)DefaultCharMapper::mirroredChars, DefaultCharMapper::mirroredCharsCount);
(le_uint32 *)DefaultCharMapper::mirroredChars,
DefaultCharMapper::mirroredCharsCount);
if (mirroredChars[index] == ch) { if (mirroredChars[index] == ch) {
return DefaultCharMapper::srahCderorrim[index]; return DefaultCharMapper::srahCderorrim[index];
@ -132,6 +134,9 @@ CharSubstitutionFilter::~CharSubstitutionFilter()
// nothing to do // nothing to do
} }
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine)
#define ccmpFeatureTag LE_CCMP_FEATURE_TAG #define ccmpFeatureTag LE_CCMP_FEATURE_TAG
#define ccmpFeatureMask 0x80000000UL #define ccmpFeatureMask 0x80000000UL
@ -145,10 +150,9 @@ static const FeatureMap canonFeatureMap[] =
static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap); static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap);
LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
le_int32 languageCode, le_int32 typoFlags) : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fLanguageCode(languageCode),
: fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fTypoFlags(typoFlags)
fLanguageCode(languageCode), fTypoFlags(typoFlags)
{ {
fGlyphStorage = new LEGlyphStorage(); fGlyphStorage = new LEGlyphStorage();
} }
@ -158,8 +162,7 @@ le_int32 LayoutEngine::getGlyphCount() const
return fGlyphStorage->getGlyphCount(); return fGlyphStorage->getGlyphCount();
} }
void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
LEErrorCode &success) const
{ {
fGlyphStorage->getCharIndices(charIndices, indexBase, success); fGlyphStorage->getCharIndices(charIndices, indexBase, success);
} }
@ -170,8 +173,7 @@ void LayoutEngine::getCharIndices(le_int32 charIndices[], LEErrorCode &success)
} }
// Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits // Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits
void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
LEErrorCode &success) const
{ {
fGlyphStorage->getGlyphs(glyphs, extraBits, success); fGlyphStorage->getGlyphs(glyphs, extraBits, success);
} }
@ -218,15 +220,13 @@ void LayoutEngine::getGlyphPositions(float positions[], LEErrorCode &success) co
fGlyphStorage->getGlyphPositions(positions, success); fGlyphStorage->getGlyphPositions(positions, success);
} }
void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const
LEErrorCode &success) const
{ {
fGlyphStorage->getGlyphPosition(glyphIndex, x, y, success); fGlyphStorage->getGlyphPosition(glyphIndex, x, y, success);
} }
le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft, LEUnicode *&outChars, LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
@ -237,12 +237,7 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off
return 0; return 0;
} }
if ((fTypoFlags & 0x4) == 0) { // no canonical processing const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
return count;
}
const GlyphSubstitutionTableHeader *canonGSUBTable =
(GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
LETag scriptTag = OpenTypeLayoutEngine::getScriptTag(fScriptCode); LETag scriptTag = OpenTypeLayoutEngine::getScriptTag(fScriptCode);
LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode); LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode);
le_int32 i, dir = 1, out = 0, outCharCount = count; le_int32 i, dir = 1, out = 0, outCharCount = count;
@ -263,8 +258,7 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off
return 0; return 0;
} }
CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, glyphStorage);
reordered, glyphStorage);
inChars = reordered; inChars = reordered;
} }
@ -289,8 +283,7 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off
LE_DELETE_ARRAY(reordered); LE_DELETE_ARRAY(reordered);
} }
outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE);
langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE);
out = (rightToLeft? count - 1 : 0); out = (rightToLeft? count - 1 : 0);
@ -305,35 +298,26 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off
return outCharCount; return outCharCount;
} }
le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
} }
if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
offset + count > max) {
success = LE_ILLEGAL_ARGUMENT_ERROR; success = LE_ILLEGAL_ARGUMENT_ERROR;
return 0; return 0;
} }
LEUnicode *outChars = NULL; LEUnicode *outChars = NULL;
le_int32 outCharCount = characterProcessing(chars, offset, count, max, le_int32 outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success);
rightToLeft, outChars, glyphStorage, success);
if (outChars != NULL) { if (outChars != NULL) {
mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft, mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft, glyphStorage, success);
glyphStorage, success); LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work...
// FIXME: a subclass may have allocated this, in which case this delete
// might not work...
LE_DELETE_ARRAY(outChars);
} else { } else {
mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success);
glyphStorage, success);
} }
return glyphStorage.getGlyphCount(); return glyphStorage.getGlyphCount();
@ -341,8 +325,7 @@ le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
// Input: glyphs // Input: glyphs
// Output: positions // Output: positions
void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success)
float x, float y, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return; return;
@ -369,8 +352,7 @@ void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage,
glyphStorage.setPosition(glyphCount, x, y, success); glyphStorage.setPosition(glyphCount, x, y, success);
} }
void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
le_int32 count, le_bool reverse,
LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -398,8 +380,7 @@ void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset
return; return;
} }
void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
LEGlyphFilter *markFilter, LEErrorCode &success)
{ {
float xAdjust = 0; float xAdjust = 0;
le_int32 p, glyphCount = glyphStorage.getGlyphCount(); le_int32 p, glyphCount = glyphStorage.getGlyphCount();
@ -435,9 +416,7 @@ void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage,
glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success); glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success);
} }
void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter,
LEErrorCode &success)
{ {
float xAdjust = 0; float xAdjust = 0;
le_int32 c = 0, direction = 1, p; le_int32 c = 0, direction = 1, p;
@ -484,8 +463,7 @@ const void *LayoutEngine::getFontTable(LETag tableTag) const
return fFontInstance->getFontTable(tableTag); return fFontInstance->getFontTable(tableTag);
} }
void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
le_int32 count, le_bool reverse, le_bool mirror,
LEGlyphStorage &glyphStorage, LEErrorCode &success) LEGlyphStorage &glyphStorage, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
@ -496,32 +474,27 @@ void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
DefaultCharMapper charMapper(TRUE, mirror); DefaultCharMapper charMapper(TRUE, mirror);
fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, glyphStorage);
&charMapper, glyphStorage);
} }
// Input: characters, font? // Input: characters, font?
// Output: glyphs, positions, char indices // Output: glyphs, positions, char indices
// Returns: number of glyphs // Returns: number of glyphs
le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
float x, float y, LEErrorCode &success) float x, float y, LEErrorCode &success)
{ {
if (LE_FAILURE(success)) { if (LE_FAILURE(success)) {
return 0; return 0;
} }
if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
offset + count > max) {
success = LE_ILLEGAL_ARGUMENT_ERROR; success = LE_ILLEGAL_ARGUMENT_ERROR;
return 0; return 0;
} }
le_int32 glyphCount; le_int32 glyphCount;
glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, *fGlyphStorage, success);
*fGlyphStorage, success);
positionGlyphs(*fGlyphStorage, x, y, success); positionGlyphs(*fGlyphStorage, x, y, success);
adjustGlyphPositions(chars, offset, count, rightToLeft, *fGlyphStorage, success); adjustGlyphPositions(chars, offset, count, rightToLeft, *fGlyphStorage, success);
@ -533,17 +506,13 @@ void LayoutEngine::reset()
fGlyphStorage->reset(); fGlyphStorage->reset();
} }
LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
{ {
// 3 -> kerning and ligatures // 3 -> kerning and ligatures
return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, languageCode, 3, success);
languageCode, 3, success);
} }
LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
LEErrorCode &success)
{ {
static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG; static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG;
static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG; static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG;
@ -552,18 +521,12 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
return NULL; return NULL;
} }
// code2000 has GPOS kern feature tags for latn script const GlyphSubstitutionTableHeader *gsubTable = (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag);
const GlyphSubstitutionTableHeader *gsubTable =
(const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag);
LayoutEngine *result = NULL; LayoutEngine *result = NULL;
LETag scriptTag = 0x00000000; LETag scriptTag = 0x00000000;
LETag languageTag = 0x00000000; LETag languageTag = 0x00000000;
if (gsubTable != NULL && if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
gsubTable->coversScript(scriptTag =
OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
switch (scriptCode) { switch (scriptCode) {
case bengScriptCode: case bengScriptCode:
case devaScriptCode: case devaScriptCode:
@ -575,13 +538,11 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
case tamlScriptCode: case tamlScriptCode:
case teluScriptCode: case teluScriptCode:
case sinhScriptCode: case sinhScriptCode:
result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
case arabScriptCode: case arabScriptCode:
result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
case haniScriptCode: case haniScriptCode:
@ -593,33 +554,33 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
case zhtLanguageCode: case zhtLanguageCode:
case zhsLanguageCode: case zhsLanguageCode:
if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) { if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) {
result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
} }
// note: falling through to default case. // note: falling through to default case.
default: default:
result = new OpenTypeLayoutEngine(fontInstance, scriptCode, result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
} }
break; break;
#if 0
case tibtScriptCode:
result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
break;
#endif
case khmrScriptCode: case khmrScriptCode:
result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
default: default:
result = new OpenTypeLayoutEngine(fontInstance, scriptCode, result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
languageCode, typoFlags, gsubTable);
break; break;
} }
} else { } else {
const MorphTableHeader *morphTable = const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
(MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
if (morphTable != NULL) { if (morphTable != NULL) {
result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable); result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable);
@ -636,16 +597,18 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
case teluScriptCode: case teluScriptCode:
case sinhScriptCode: case sinhScriptCode:
{ {
result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
languageCode, typoFlags);
break; break;
} }
case arabScriptCode: case arabScriptCode:
result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, //case hebrScriptCode:
languageCode, typoFlags); result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
break; break;
//case hebrScriptCode:
// return new HebrewOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
case thaiScriptCode: case thaiScriptCode:
result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags); result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
break; break;
@ -667,3 +630,5 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
LayoutEngine::~LayoutEngine() { LayoutEngine::~LayoutEngine() {
delete fGlyphStorage; delete fGlyphStorage;
} }
U_NAMESPACE_END

View File

@ -23,6 +23,7 @@
* *
*/ */
/* /*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
@ -34,63 +35,61 @@
#include "LETypes.h" #include "LETypes.h"
#include <string.h> /**
* \file
* \brief C++ API: Virtual base class for complex text layout.
*/
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
class LEGlyphFilter; class LEGlyphFilter;
class LEGlyphStorage; class LEGlyphStorage;
/** /**
* This is a virtual base class used to do complex text layout. The * This is a virtual base class used to do complex text layout. The text must all
* text must all be in a single font, script, and language. An * be in a single font, script, and language. An instance of a LayoutEngine can be
* instance of a LayoutEngine can be created by calling the * created by calling the layoutEngineFactory method. Fonts are identified by
* layoutEngineFactory method. Fonts are identified by instances of * instances of the LEFontInstance class. Script and language codes are identified
* the LEFontInstance class. Script and language codes are identified
* by integer codes, which are defined in ScriptAndLanuageTags.h. * by integer codes, which are defined in ScriptAndLanuageTags.h.
* *
* Note that this class is not public API. It is declared public so * Note that this class is not public API. It is declared public so that it can be
* that it can be exported from the library that it is a part of. * exported from the library that it is a part of.
* *
* The input to the layout process is an array of characters in * The input to the layout process is an array of characters in logical order,
* logical order, and a starting X, Y position for the text. The * and a starting X, Y position for the text. The output is an array of glyph indices,
* output is an array of glyph indices, an array of character indices * an array of character indices for the glyphs, and an array of glyph positions.
* for the glyphs, and an array of glyph positions. These arrays are * These arrays are protected members of LayoutEngine which can be retreived by a
* protected members of LayoutEngine which can be retreived by a * public method. The reset method can be called to free these arrays so that the
* public method. The reset method can be called to free these arrays * LayoutEngine can be reused.
* so that the LayoutEngine can be reused.
* *
* The layout process is done in three steps. There is a protected * The layout process is done in three steps. There is a protected virtual method
* virtual method for each step. These methods have a default * for each step. These methods have a default implementation which only does
* implementation which only does character to glyph mapping and * character to glyph mapping and default positioning using the glyph's advance
* default positioning using the glyph's advance widths. Subclasses * widths. Subclasses can override these methods for more advanced layout.
* can override these methods for more advanced layout. There is a * There is a public method which invokes the steps in the correct order.
* public method which invokes the steps in the correct order.
* *
* The steps are: * The steps are:
* *
* 1) Glyph processing - character to glyph mapping and any other * 1) Glyph processing - character to glyph mapping and any other glyph processing
* glyph processing such as ligature substitution and contextual * such as ligature substitution and contextual forms.
* forms.
* *
* 2) Glyph positioning - position the glyphs based on their advance * 2) Glyph positioning - position the glyphs based on their advance widths.
* widths.
* *
* 3) Glyph position adjustments - adjustment of glyph positions for * 3) Glyph position adjustments - adjustment of glyph positions for kerning,
* kerning, accent placement, etc. * accent placement, etc.
* *
* NOTE: in all methods below, output parameters are references to * NOTE: in all methods below, output parameters are references to pointers so
* pointers so the method can allocate and free the storage as * the method can allocate and free the storage as needed. All storage allocated
* needed. All storage allocated in this way is owned by the object * in this way is owned by the object which created it, and will be freed when it
* which created it, and will be freed when it is no longer needed, or * is no longer needed, or when the object's destructor is invoked.
* when the object's destructor is invoked.
* *
* @see LEFontInstance * @see LEFontInstance
* @see ScriptAndLanguageTags.h * @see ScriptAndLanguageTags.h
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
class U_LAYOUT_API LayoutEngine class U_LAYOUT_API LayoutEngine : public UObject {
{
protected: protected:
/** /**
* The object which holds the glyph storage * The object which holds the glyph storage
@ -134,21 +133,21 @@ protected:
le_int32 fTypoFlags; le_int32 fTypoFlags;
/** /**
* This constructs an instance for a given font, script and * This constructs an instance for a given font, script and language. Subclass constructors
* language. Subclass constructors
* must call this constructor. * must call this constructor.
* *
* @param fontInstance - the font for the text * @param fontInstance - the font for the text
* @param scriptCode - the script for the text * @param scriptCode - the script for the text
* @param languageCode - the language for the text * @param languageCode - the language for the text
* @param typoFlags - the typographic control flags for the text. Set bit 1 if kerning
* is desired, set bit 2 if ligature formation is desired. Others are reserved.
* *
* @see LEFontInstance * @see LEFontInstance
* @see ScriptAndLanguageTags.h * @see ScriptAndLanguageTags.h
* *
* @internal * @internal
*/ */
LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
le_int32 languageCode, le_int32 typoFlags);
/** /**
* This overrides the default no argument constructor to make it * This overrides the default no argument constructor to make it
@ -160,11 +159,10 @@ protected:
LayoutEngine(); LayoutEngine();
/** /**
* This method does any required pre-processing to the input * This method does any required pre-processing to the input characters. It
* characters. It may generate output characters that differ from * may generate output characters that differ from the input charcters due to
* the input charcters due to insertions, deletions, or * insertions, deletions, or reorderings. In such cases, it will also generate an
* reorderings. In such cases, it will also generate an output * output character index array reflecting these changes.
* character index array reflecting these changes.
* *
* Subclasses must override this method. * Subclasses must override this method.
* *
@ -173,44 +171,36 @@ protected:
* @param offset - the index of the first character to process * @param offset - the index of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - TRUE if the characters are in a right to * @param rightToLeft - TRUE if the characters are in a right to left directional run
* left directional run * @param outChars - the output character array, if different from the input
* @param outChars - the output character array, if different from * @param glyphStorage - the object that holds the per-glyph storage. The character index array may be set.
* the input
* @param glyphStorage - the object that holds the per-glyph
* storage. The character index array may be set.
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
* @return the output character count (input character count if no *
* change) * @return the output character count (input character count if no change)
* *
* @internal * @internal
*/ */
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
* This method does the glyph processing. It converts an array of * This method does the glyph processing. It converts an array of characters
* characters into an array of glyph indices and character * into an array of glyph indices and character indices. The characters to be
* indices. The characters to be processed are passed in a * processed are passed in a surrounding context. The context is specified as
* surrounding context. The context is specified as a starting * a starting address and a maximum character count. An offset and a count are
* address and a maximum character count. An offset and a count * used to specify the characters to be processed.
* are used to specify the characters to be processed.
* *
* The default implementation of this method only does character * The default implementation of this method only does character to glyph mapping.
* to glyph mapping. Subclasses needing more elaborate glyph * Subclasses needing more elaborate glyph processing must override this method.
* processing must override this method.
* *
* Input parameters: * Input parameters:
* @param chars - the character context * @param chars - the character context
* @param offset - the offset of the first character to process * @param offset - the offset of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the context. * @param max - the number of characters in the context.
* @param rightToLeft - TRUE if the text is in a right to left * @param rightToLeft - TRUE if the text is in a right to left directional run
* directional run * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char indices arrays
* @param glyphStorage - the object which holds the per-glyph * will be set.
* storage. The glyph and char indices arrays will be
* set.
* *
* Output parameters: * Output parameters:
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -219,60 +209,50 @@ protected:
* *
* @internal * @internal
*/ */
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
le_int32 count, le_int32 max, le_bool rightToLeft,
LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
* This method does basic glyph positioning. The default * This method does basic glyph positioning. The default implementation positions
* implementation positions the glyphs based on their advance * the glyphs based on their advance widths. This is sufficient for most uses. It
* widths. This is sufficient for most uses. It is not expected * is not expected that many subclasses will override this method.
* that many subclasses will override this method.
* *
* Input parameters: * Input parameters:
* @param glyphStorage - the object which holds the per-glyph storage. * @param glyphStorage - the object which holds the per-glyph storage. The glyph position array will be set.
* The glyph position array will be set.
* @param x - the starting X position * @param x - the starting X position
* @param y - the starting Y position * @param y - the starting Y position
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
* *
* @internal * @internal
*/ */
virtual void positionGlyphs(LEGlyphStorage &glyphStorage, virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
float x, float y, LEErrorCode &success);
/** /**
* This method does positioning adjustments like accent * This method does positioning adjustments like accent positioning and
* positioning and kerning. The default implementation does * kerning. The default implementation does nothing. Subclasses needing
* nothing. Subclasses needing position adjustments must override * position adjustments must override this method.
* this method.
* *
* Note that this method has both characters and glyphs as input * Note that this method has both characters and glyphs as input so that
* so that it can use the character codes to determine glyph types * it can use the character codes to determine glyph types if that information
* if that information isn't directly available. (e.g. Some Arabic * isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
* OpenType fonts don't have a GDEF table) * table)
* *
* @param chars - the input character context * @param chars - the input character context
* @param offset - the offset of the first character to process * @param offset - the offset of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param reverse - <code>TRUE</code> if the glyphs in the glyph * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
* array have been reordered * @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
* @param glyphStorage - the object which holds the per-glyph * adjusted as needed.
* storage. The glyph positions will be adjusted as needed. * @param success - output parameter set to an error code if the operation fails
* @param success - output parameter set to an error code if the
* operation fails
* *
* @internal * @internal
*/ */
virtual void adjustGlyphPositions(const LEUnicode chars[], virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
le_int32 offset, le_int32 count, le_bool reverse,
LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
* This method gets a table from the font associated with the * This method gets a table from the font associated with
* text. The default implementation gets the table from the font * the text. The default implementation gets the table from
* instance. Subclasses which need to get the tables some other * the font instance. Subclasses which need to get the tables
* way must override this method. * some other way must override this method.
* *
* @param tableTag - the four byte table tag. * @param tableTag - the four byte table tag.
* *
@ -283,127 +263,106 @@ protected:
virtual const void *getFontTable(LETag tableTag) const; virtual const void *getFontTable(LETag tableTag) const;
/** /**
* This method does character to glyph mapping. The default * This method does character to glyph mapping. The default implementation
* implementation uses the font instance to do the mapping. It * uses the font instance to do the mapping. It will allocate the glyph and
* will allocate the glyph and character index arrays if they're * character index arrays if they're not already allocated. If it allocates the
* not already allocated. If it allocates the character index * character index array, it will fill it it.
* array, it will fill it it.
* *
* This method supports right to left text with the ability to * This method supports right to left
* store the glyphs in reverse order, and by supporting character * text with the ability to store the glyphs in reverse order, and by supporting
* mirroring, which will replace a character which has a left and * character mirroring, which will replace a character which has a left and right
* right form, such as parens, with the opposite form before * form, such as parens, with the opposite form before mapping it to a glyph index.
* mapping it to a glyph index.
* *
* Input parameters: * Input parameters:
* @param chars - the input character context * @param chars - the input character context
* @param offset - the offset of the first character to be mapped * @param offset - the offset of the first character to be mapped
* @param count - the number of characters to be mapped * @param count - the number of characters to be mapped
* @param reverse - if <code>TRUE</code>, the output will be in * @param reverse - if <code>TRUE</code>, the output will be in reverse order
* reverse order
* @param mirror - if <code>TRUE</code>, do character mirroring * @param mirror - if <code>TRUE</code>, do character mirroring
* @param glyphStorage - the object which holds the per-glyph * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char
* storage. The glyph and char indices arrays will be * indices arrays will be filled in.
* filled in.
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
* *
* @see LEFontInstance * @see LEFontInstance
* *
* @internal * @internal
*/ */
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
le_int32 count, le_bool reverse, le_bool mirror,
LEGlyphStorage &glyphStorage, LEErrorCode &success);
/** /**
* This is a convenience method that forces the advance width of * This is a convenience method that forces the advance width of mark
* mark glyphs to be zero, which is required for proper selection * glyphs to be zero, which is required for proper selection and highlighting.
* and highlighting.
* *
* @param glyphStorage - the object containing the per-glyph * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
* storage. The positions array will be modified.
* @param markFilter - used to identify mark glyphs * @param markFilter - used to identify mark glyphs
* @param success - output parameter set to an error code if the * @param success - output parameter set to an error code if the operation fails
* operation fails
* *
* @see LEGlyphFilter * @see LEGlyphFilter
* *
* @internal * @internal
*/ */
static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
LEGlyphFilter *markFilter, LEErrorCode &success);
/** /**
* This is a convenience method that forces the advance width of * This is a convenience method that forces the advance width of mark
* mark glyphs to be zero, which is required for proper selection * glyphs to be zero, which is required for proper selection and highlighting.
* and highlighting. This method uses the input characters to * This method uses the input characters to identify marks. This is required in
* identify marks. This is required in cases where the font does * cases where the font does not contain enough information to identify them based
* not contain enough information to identify them based on the * on the glyph IDs.
* glyph IDs.
* *
* @param chars - the array of input characters * @param chars - the array of input characters
* @param charCount - the number of input characers * @param charCount - the number of input characers
* @param glyphStorage - the object containing the per-glyph * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
* storage. The positions array will be modified. * @param reverse - <code>TRUE</code> if the glyph array has been reordered
* @param reverse - <code>TRUE</code> if the glyph array has been
* reordered
* @param markFilter - used to identify mark glyphs * @param markFilter - used to identify mark glyphs
* @param success - output parameter set to an error code if the * @param success - output parameter set to an error code if the operation fails
* operation fails
* *
* @see LEGlyphFilter * @see LEGlyphFilter
* *
* @internal * @internal
*/ */
static void adjustMarkGlyphs(const LEUnicode chars[], static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
le_int32 charCount, le_bool reverse,
LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter,
LEErrorCode &success);
public: public:
/** /**
* The destructor. It will free any storage allocated for the * The destructor. It will free any storage allocated for the
* glyph, character index and position arrays by calling the reset * glyph, character index and position arrays by calling the reset
* method. It is declared virtual so that it will be invoked by * method. It is declared virtual so that it will be invoked by the
* the subclass destructors. * subclass destructors.
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
virtual ~LayoutEngine(); virtual ~LayoutEngine();
/** /**
* This method will invoke the layout steps in their correct order * This method will invoke the layout steps in their correct order by calling
* by calling the 32 bit versions of the computeGlyphs and * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods.. It will
* positionGlyphs methods.(It doesn't * call the * compute the glyph, character index and position arrays.
* adjustGlyphPositions method because that doesn't apply for
* default * processing.) It will compute the glyph, character
* index and position arrays.
* *
* @param chars - the input character context * @param chars - the input character context
* @param offset - the offset of the first character to process * @param offset - the offset of the first character to process
* @param count - the number of characters to process * @param count - the number of characters to process
* @param max - the number of characters in the input context * @param max - the number of characters in the input context
* @param rightToLeft - true if the characers are in a right to * @param rightToLeft - TRUE if the characers are in a right to left directional run
* left directional run
* @param x - the initial X position * @param x - the initial X position
* @param y - the initial Y position * @param y - the initial Y position
* @param success - output parameter set to an error code if the * @param success - output parameter set to an error code if the operation fails
* operation fails *
* @return the number of glyphs in the glyph array * @return the number of glyphs in the glyph array
* *
* Note: the glyph, character index and position array can be * Note; the glyph, character index and position array can be accessed
* accessed using the getter method below. * using the getter method below.
*
* @stable ICU 2.8
*/ */
le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
le_int32 count, le_int32 max, le_bool rightToLeft, float x,
float y, LEErrorCode &success);
/** /**
* This method returns the number of glyphs in the glyph * This method returns the number of glyphs in the glyph array. Note
* array. Note that the number of glyphs will be greater than or * that the number of glyphs will be greater than or equal to the number
* equal to the number of characters used to create the * of characters used to create the LayoutEngine.
* LayoutEngine.
* *
* @return the number of glyphs in the glyph array * @return the number of glyphs in the glyph array
* *
@ -412,9 +371,9 @@ public:
le_int32 getGlyphCount() const; le_int32 getGlyphCount() const;
/** /**
* This method copies the glyph array into a caller supplied * This method copies the glyph array into a caller supplied array.
* array. The caller must ensure that the array is large enough * The caller must ensure that the array is large enough to hold all
* to hold all the glyphs. * the glyphs.
* *
* @param glyphs - the destiniation glyph array * @param glyphs - the destiniation glyph array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -424,10 +383,10 @@ public:
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const; void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
/** /**
* This method copies the glyph array into a caller supplied * This method copies the glyph array into a caller supplied array,
* array, ORing in extra bits. (This functionality is needed by * ORing in extra bits. (This functionality is needed by the JDK,
* the JDK, which uses 32 bits pre glyph idex, with the high 16 * which uses 32 bits pre glyph idex, with the high 16 bits encoding
* bits encoding the composite font slot number) * the composite font slot number)
* *
* @param glyphs - the destination (32 bit) glyph array * @param glyphs - the destination (32 bit) glyph array
* @param extraBits - this value will be ORed with each glyph index * @param extraBits - this value will be ORed with each glyph index
@ -435,13 +394,12 @@ public:
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method copies the character index array into a caller * This method copies the character index array into a caller supplied array.
* supplied array. The caller must ensure that the array is large * The caller must ensure that the array is large enough to hold a
* enough to hold a character index for each glyph. * character index for each glyph.
* *
* @param charIndices - the destiniation character index array * @param charIndices - the destiniation character index array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -451,9 +409,9 @@ public:
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const; void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
/** /**
* This method copies the character index array into a caller * This method copies the character index array into a caller supplied array.
* supplied array. The caller must ensure that the array is large * The caller must ensure that the array is large enough to hold a
* enough to hold a character index for each glyph. * character index for each glyph.
* *
* @param charIndices - the destiniation character index array * @param charIndices - the destiniation character index array
* @param indexBase - an offset which will be added to each index * @param indexBase - an offset which will be added to each index
@ -461,14 +419,13 @@ public:
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method copies the position array into a caller supplied * This method copies the position array into a caller supplied array.
* array. The caller must ensure that the array is large enough * The caller must ensure that the array is large enough to hold an
* to hold an X and Y position for each glyph, plus an extra X and * X and Y position for each glyph, plus an extra X and Y for the
* Y for the advance of the last glyph. * advance of the last glyph.
* *
* @param positions - the destiniation position array * @param positions - the destiniation position array
* @param success - set to an error code if the operation fails * @param success - set to an error code if the operation fails
@ -491,8 +448,7 @@ public:
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
LEErrorCode &success) const;
/** /**
* This method frees the glyph, character index and position arrays * This method frees the glyph, character index and position arrays
@ -511,8 +467,7 @@ public:
* @param fontInstance - the font of the text * @param fontInstance - the font of the text
* @param scriptCode - the script of the text * @param scriptCode - the script of the text
* @param languageCode - the language of the text * @param languageCode - the language of the text
* @param success - output parameter set to an error code if the * @param success - output parameter set to an error code if the operation fails
* operation fails
* *
* @return a LayoutEngine which can layout text in the given font. * @return a LayoutEngine which can layout text in the given font.
* *
@ -520,17 +475,30 @@ public:
* *
* @stable ICU 2.8 * @stable ICU 2.8
*/ */
static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
/** /**
* Override of existing call that provides flags to control typography. * Override of existing call that provides flags to control typography.
* @draft ICU 3.4 * @draft ICU 3.4
*/ */
static LayoutEngine *layoutEngineFactory( static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
const LEFontInstance *fontInstance,
le_int32 scriptCode, le_int32 languageCode, /**
le_int32 typo_flags, LEErrorCode &success); * ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,11 +32,20 @@
#ifndef __LAYOUTTABLES_H #ifndef __LAYOUTTABLES_H
#define __LAYOUTTABLES_H #define __LAYOUTTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
U_NAMESPACE_BEGIN
#define ANY_NUMBER 1 #define ANY_NUMBER 1
typedef le_int16 ByteOffset; typedef le_int16 ByteOffset;
typedef le_int16 WordOffset; typedef le_int16 WordOffset;
U_NAMESPACE_END
#endif #endif

View File

@ -39,10 +39,14 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
#define ExtendedComplement(m) ((le_int32) (~((le_uint32) (m)))) #define ExtendedComplement(m) ((le_int32) (~((le_uint32) (m))))
#define SignBit(m) ((ExtendedComplement(m) >> 1) & (le_int32)(m)) #define SignBit(m) ((ExtendedComplement(m) >> 1) & (le_int32)(m))
#define SignExtend(v,m) (((v) & SignBit(m))? ((v) | ExtendedComplement(m)): (v)) #define SignExtend(v,m) (((v) & SignBit(m))? ((v) | ExtendedComplement(m)): (v))
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor)
LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
: StateTableProcessor(morphSubtableHeader) : StateTableProcessor(morphSubtableHeader)
{ {
@ -63,8 +67,7 @@ void LigatureSubstitutionProcessor::beginStateTable()
m = -1; m = -1;
} }
ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
le_int32 &currGlyph, EntryTableIndex index)
{ {
const LigatureSubstitutionStateEntry *entry = &entryTable[index]; const LigatureSubstitutionStateEntry *entry = &entryTable[index];
ByteOffset newState = SWAPW(entry->newStateOffset); ByteOffset newState = SWAPW(entry->newStateOffset);
@ -135,3 +138,5 @@ ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyp
void LigatureSubstitutionProcessor::endStateTable() void LigatureSubstitutionProcessor::endStateTable()
{ {
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __LIGATURESUBSTITUTIONPROCESSOR_H #ifndef __LIGATURESUBSTITUTIONPROCESSOR_H
#define __LIGATURESUBSTITUTIONPROCESSOR_H #define __LIGATURESUBSTITUTIONPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "SubtableProcessor.h" #include "SubtableProcessor.h"
#include "StateTableProcessor.h" #include "StateTableProcessor.h"
#include "LigatureSubstitution.h" #include "LigatureSubstitution.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
#define nComponents 16 #define nComponents 16
@ -54,6 +61,20 @@ public:
LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
virtual ~LigatureSubstitutionProcessor(); virtual ~LigatureSubstitutionProcessor();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 2.8
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.8
*/
static UClassID getStaticClassID();
private: private:
LigatureSubstitutionProcessor(); LigatureSubstitutionProcessor();
@ -68,6 +89,8 @@ protected:
le_int16 m; le_int16 m;
const LigatureSubstitutionHeader *ligatureSubstitutionHeader; const LigatureSubstitutionHeader *ligatureSubstitutionHeader;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
* *
@ -37,6 +38,8 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
{ {
LEGlyphID glyph = glyphIterator->getCurrGlyphID(); LEGlyphID glyph = glyphIterator->getCurrGlyphID();
@ -92,3 +95,5 @@ le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, co
return 0; return 0;
} }
U_NAMESPACE_END

View File

@ -32,12 +32,19 @@
#ifndef __LIGATURESUBSTITUTIONSUBTABLES_H #ifndef __LIGATURESUBSTITUTIONSUBTABLES_H
#define __LIGATURESUBSTITUTIONSUBTABLES_H #define __LIGATURESUBSTITUTIONSUBTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEGlyphFilter.h" #include "LEGlyphFilter.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
#include "GlyphSubstitutionTables.h" #include "GlyphSubstitutionTables.h"
#include "GlyphIterator.h" #include "GlyphIterator.h"
U_NAMESPACE_BEGIN
struct LigatureSetTable struct LigatureSetTable
{ {
le_uint16 ligatureCount; le_uint16 ligatureCount;
@ -59,4 +66,5 @@ struct LigatureSubstitutionSubtable : GlyphSubstitutionSubtable
le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -32,12 +32,19 @@
#ifndef __LIGATURESUBSTITUTION_H #ifndef __LIGATURESUBSTITUTION_H
#define __LIGATURESUBSTITUTION_H #define __LIGATURESUBSTITUTION_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LayoutTables.h" #include "LayoutTables.h"
#include "StateTables.h" #include "StateTables.h"
#include "MorphTables.h" #include "MorphTables.h"
#include "MorphStateTables.h" #include "MorphStateTables.h"
U_NAMESPACE_BEGIN
struct LigatureSubstitutionHeader : MorphStateTableHeader struct LigatureSubstitutionHeader : MorphStateTableHeader
{ {
ByteOffset ligatureActionTableOffset; ByteOffset ligatureActionTableOffset;
@ -65,4 +72,5 @@ enum LigatureActionFlags
lafComponentOffsetMask = 0x3FFFFFFF lafComponentOffsetMask = 0x3FFFFFFF
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -42,6 +42,8 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator,
const LEFontInstance *fontInstance) const const LEFontInstance *fontInstance) const
{ {
@ -65,8 +67,7 @@ le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, Glyp
return 1; return 1;
} }
le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
GlyphPositionAdjustments *glyphPositionAdjustments,
le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
const LEFontInstance *fontInstance) const const LEFontInstance *fontInstance) const
{ {
@ -133,8 +134,7 @@ le_int32 LookupProcessor::selectLookups(const FeatureTable *featureTable, Featur
LookupProcessor::LookupProcessor(const char *baseAddress, LookupProcessor::LookupProcessor(const char *baseAddress,
Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset, Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures)
le_int32 featureMapCount, le_bool orderFeatures)
: lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL),
lookupOrderArray(NULL), lookupOrderCount(0) lookupOrderArray(NULL), lookupOrderCount(0)
{ {
@ -296,3 +296,5 @@ LookupProcessor::~LookupProcessor()
LE_DELETE_ARRAY(lookupOrderArray); LE_DELETE_ARRAY(lookupOrderArray);
LE_DELETE_ARRAY(lookupSelectArray); LE_DELETE_ARRAY(lookupSelectArray);
} }
U_NAMESPACE_END

View File

@ -24,6 +24,7 @@
*/ */
/* /*
*
* *
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* *
@ -32,9 +33,18 @@
#ifndef __LOOKUPPROCESSOR_H #ifndef __LOOKUPPROCESSOR_H
#define __LOOKUPPROCESSOR_H #define __LOOKUPPROCESSOR_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
//#include "Lookups.h"
//#include "Features.h"
U_NAMESPACE_BEGIN
class LEFontInstance; class LEFontInstance;
class LEGlyphStorage; class LEGlyphStorage;
@ -46,13 +56,10 @@ struct GlyphDefinitionTableHeader;
struct LookupSubtable; struct LookupSubtable;
struct LookupTable; struct LookupTable;
class LookupProcessor class LookupProcessor : public UMemory {
{
public: public:
le_int32 process(LEGlyphStorage &glyphStorage, le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance) const;
le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
const LEFontInstance *fontInstance) const;
le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
@ -66,8 +73,7 @@ public:
protected: protected:
LookupProcessor(const char *baseAddress, LookupProcessor(const char *baseAddress,
Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset, Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures);
le_int32 featureMapCount, le_bool orderFeatures);
LookupProcessor(); LookupProcessor();
@ -87,4 +93,5 @@ private:
LookupProcessor &operator=(const LookupProcessor &other); // forbid copying of this class LookupProcessor &operator=(const LookupProcessor &other); // forbid copying of this class
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -34,6 +34,8 @@
#include "LookupTables.h" #include "LookupTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
/* /*
These are the rolled-up versions of the uniform binary search. These are the rolled-up versions of the uniform binary search.
Someday, if we need more performance, we can un-roll them. Someday, if we need more performance, we can un-roll them.
@ -104,3 +106,5 @@ const LookupSingle *BinarySearchLookupTable::lookupSingle(const LookupSingle *en
return NULL; return NULL;
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __LOOKUPTABLES_H #ifndef __LOOKUPTABLES_H
#define __LOOKUPTABLES_H #define __LOOKUPTABLES_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LayoutTables.h" #include "LayoutTables.h"
U_NAMESPACE_BEGIN
enum LookupTableFormat enum LookupTableFormat
{ {
ltfSimpleArray = 0, ltfSimpleArray = 0,
@ -104,4 +111,5 @@ struct TrimmedArrayLookupTable : LookupTable
LookupValue valueArray[ANY_NUMBER]; LookupValue valueArray[ANY_NUMBER];
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -35,6 +35,8 @@
#include "CoverageTables.h" #include "CoverageTables.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const
{ {
if (lookupTableIndex >= SWAPW(lookupCount)) { if (lookupTableIndex >= SWAPW(lookupCount)) {
@ -63,3 +65,5 @@ le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID)
return coverageTable->getGlyphCoverage(glyphID); return coverageTable->getGlyphCoverage(glyphID);
} }
U_NAMESPACE_END

View File

@ -32,9 +32,16 @@
#ifndef __LOOKUPS_H #ifndef __LOOKUPS_H
#define __LOOKUPS_H #define __LOOKUPS_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
enum LookupFlags enum LookupFlags
{ {
lfBaselineIsLogicalEnd = 0x0001, // The MS spec. calls this flag "RightToLeft" but this name is more accurate lfBaselineIsLogicalEnd = 0x0001, // The MS spec. calls this flag "RightToLeft" but this name is more accurate
@ -79,6 +86,5 @@ inline le_int32 LookupSubtable::getGlyphCoverage(LEGlyphID glyphID) const
return getGlyphCoverage(coverageTableOffset, glyphID); return getGlyphCoverage(coverageTableOffset, glyphID);
} }
U_NAMESPACE_END
#endif #endif

View File

@ -33,6 +33,8 @@
#include "LEGlyphStorage.h" #include "LEGlyphStorage.h"
#include "MPreFixups.h" #include "MPreFixups.h"
U_NAMESPACE_BEGIN
struct FixupData struct FixupData
{ {
le_int32 fBaseIndex; le_int32 fBaseIndex;
@ -92,7 +94,7 @@ void MPreFixups::apply(LEGlyphStorage &glyphStorage)
for (i = 0; i < mpreCount; i += 1) { for (i = 0; i < mpreCount; i += 1) {
mpreSave[i] = glyphStorage[mpreIndex + i]; mpreSave[i] = glyphStorage[mpreIndex + i];
indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success); indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success); //charIndices[mpreIndex + i];
} }
for (i = 0; i < moveCount; i += 1) { for (i = 0; i < moveCount; i += 1) {
@ -112,3 +114,5 @@ void MPreFixups::apply(LEGlyphStorage &glyphStorage)
LE_DELETE_ARRAY(mpreSave); LE_DELETE_ARRAY(mpreSave);
} }
} }
U_NAMESPACE_END

View File

@ -32,14 +32,22 @@
#ifndef __MPREFIXUPS_H #ifndef __MPREFIXUPS_H
#define __MPREFIXUPS_H #define __MPREFIXUPS_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
U_NAMESPACE_BEGIN
class LEGlyphStorage; class LEGlyphStorage;
// Might want to make this a private member... // Might want to make this a private member...
struct FixupData; struct FixupData;
class MPreFixups { class MPreFixups : public UMemory
{
public: public:
MPreFixups(le_int32 charCount); MPreFixups(le_int32 charCount);
~MPreFixups(); ~MPreFixups();
@ -53,4 +61,7 @@ private:
le_int32 fFixupCount; le_int32 fFixupCount;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -36,6 +36,8 @@
#include "MarkArrays.h" #include "MarkArrays.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance, le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance,
LEPoint &anchor) const LEPoint &anchor) const
{ {
@ -58,3 +60,5 @@ le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, cons
return markClass; return markClass;
} }
U_NAMESPACE_END

View File

@ -32,10 +32,17 @@
#ifndef __MARKARRAYS_H #ifndef __MARKARRAYS_H
#define __MARKARRAYS_H #define __MARKARRAYS_H
/**
* \file
* \internal
*/
#include "LETypes.h" #include "LETypes.h"
#include "LEFontInstance.h" #include "LEFontInstance.h"
#include "OpenTypeTables.h" #include "OpenTypeTables.h"
U_NAMESPACE_BEGIN
struct MarkRecord struct MarkRecord
{ {
le_uint16 markClass; le_uint16 markClass;
@ -51,4 +58,7 @@ struct MarkArray
LEPoint &anchor) const; LEPoint &anchor) const;
}; };
U_NAMESPACE_END
#endif #endif

View File

@ -40,6 +40,8 @@
#include "GlyphIterator.h" #include "GlyphIterator.h"
#include "LESwaps.h" #include "LESwaps.h"
U_NAMESPACE_BEGIN
LEGlyphID MarkToBasePositioningSubtable::findBaseGlyph(GlyphIterator *glyphIterator) const LEGlyphID MarkToBasePositioningSubtable::findBaseGlyph(GlyphIterator *glyphIterator) const
{ {
if (glyphIterator->prev()) { if (glyphIterator->prev()) {
@ -106,7 +108,6 @@ le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, co
glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition()); glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition());
if (glyphIterator->isRightToLeft()) { if (glyphIterator->isRightToLeft()) {
// dlf flip advance to local coordinate system
glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY); glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY);
} else { } else {
LEPoint baseAdvance; LEPoint baseAdvance;
@ -114,9 +115,10 @@ le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, co
fontInstance->getGlyphAdvance(baseGlyph, pixels); fontInstance->getGlyphAdvance(baseGlyph, pixels);
fontInstance->pixelsToUnits(pixels, baseAdvance); fontInstance->pixelsToUnits(pixels, baseAdvance);
// flip advances to local coordinate system
glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY); glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY);
} }
return 1; return 1;
} }
U_NAMESPACE_END

Some files were not shown because too many files have changed in this diff Show More