ICU-6022 add an adjustGlyphPositions method to ThaiLayoutEngine that doesn't call adjustMarkGlyphs(). We count on the mark glyphs having an advance width.

X-SVN-Rev: 23557
This commit is contained in:
Eric Mader 2008-03-12 00:05:08 +00:00
parent 1e0eb434bc
commit adb20088d3
2 changed files with 50 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/*
*
* (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
* (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
*
*/
@ -11,6 +11,8 @@
#include "ScriptAndLanguageTags.h"
#include "LEGlyphStorage.h"
#include "KernTable.h"
#include "ThaiShaping.h"
U_NAMESPACE_BEGIN
@ -94,4 +96,28 @@ le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offse
return glyphCount;
}
// This is the same as LayoutEngline::adjustGlyphPositions() except that it doesn't call adjustMarkGlyphs
void ThaiLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
LEGlyphStorage &glyphStorage, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return;
}
if (chars == NULL || offset < 0 || count < 0) {
success = LE_ILLEGAL_ARGUMENT_ERROR;
return;
}
if (fTypoFlags & 0x1) { /* kerning enabled */
static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
KernTable kt(fFontInstance, getFontTable(kernTableTag));
kt.process(glyphStorage);
}
// default is no adjustments
return;
}
U_NAMESPACE_END

View File

@ -1,7 +1,7 @@
/*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
* (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
*
*/
@ -114,6 +114,28 @@ protected:
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEGlyphStorage &glyphStorage, LEErrorCode &success);
/**
* This method does positioning adjustments like accent positioning and
* kerning. The default implementation does nothing. Subclasses needing
* position adjustments must override this method.
*
* Note that this method has both characters and glyphs as input so that
* it can use the character codes to determine glyph types if that information
* isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
* table)
*
* @param chars - the input character context
* @param offset - the offset of the first character to process
* @param count - the number of characters to process
* @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
* @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
* adjusted as needed.
* @param success - output parameter set to an error code if the operation fails
*
* @internal
*/
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
};
U_NAMESPACE_END