From 82353179281e4d53455e2d35b8e6c346626349cc Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Mon, 21 Mar 2011 20:48:42 +0000 Subject: [PATCH] ICU-8318 disable hebrew ligatures, add symbolic constants for typo flags X-SVN-Rev: 29676 --- icu4c/source/layout/LayoutEngine.cpp | 13 +++++++++---- icu4c/source/layout/LayoutEngine.h | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/icu4c/source/layout/LayoutEngine.cpp b/icu4c/source/layout/LayoutEngine.cpp index c13a08eb362..c815c83c855 100644 --- a/icu4c/source/layout/LayoutEngine.cpp +++ b/icu4c/source/layout/LayoutEngine.cpp @@ -1,8 +1,5 @@ - /* - * - * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved - * + * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved */ #include "LETypes.h" @@ -38,6 +35,9 @@ U_NAMESPACE_BEGIN /* Leave this copyright notice here! It needs to go somewhere in this library. */ static const char copyright[] = U_COPYRIGHT_STRING; +const le_int32 LayoutEngine::kTypoFlagKern = 0x1; +const le_int32 LayoutEngine::kTypoFlagLiga = 0x2; + const LEUnicode32 DefaultCharMapper::controlChars[] = { 0x0009, 0x000A, 0x000D, /*0x200C, 0x200D,*/ 0x200E, 0x200F, @@ -554,6 +554,11 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success); break; + case hebrScriptCode: + // Disable hebrew ligatures since they have only archaic uses, see ticket #8318 + result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags & ~kTypoFlagLiga, gsubTable, success); + break; + case hangScriptCode: result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success); break; diff --git a/icu4c/source/layout/LayoutEngine.h b/icu4c/source/layout/LayoutEngine.h index b109e64e74d..2cb81584243 100644 --- a/icu4c/source/layout/LayoutEngine.h +++ b/icu4c/source/layout/LayoutEngine.h @@ -1,8 +1,5 @@ - /* - * - * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved - * + * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved */ #ifndef __LAYOUTENGINE_H @@ -65,6 +62,12 @@ class LEGlyphStorage; * @stable ICU 2.8 */ class U_LAYOUT_API LayoutEngine : public UObject { +public: + /** Flag to request kerning. */ + static const le_int32 kTypoFlagKern; + /** Flag to request ligatures. */ + static const le_int32 kTypoFlagLiga; + protected: /** * The object which holds the glyph storage @@ -122,8 +125,8 @@ protected: * @param fontInstance - the font for the text * @param scriptCode - the script 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. + * @param typoFlags - the typographic control flags for the text (a bitfield). Use kTypoFlagKern + * if kerning is desired, kTypoFlagLiga if ligature formation is desired. Others are reserved. * @param success - set to an error code if the operation fails * * @see LEFontInstance @@ -131,9 +134,9 @@ protected: * * @internal */ - LayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, - le_int32 languageCode, + LayoutEngine(const LEFontInstance *fontInstance, + le_int32 scriptCode, + le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success); @@ -493,4 +496,3 @@ public: U_NAMESPACE_END #endif -