1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/KhmerLayoutEngine.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,129 @@
1.4 +
1.5 +/*
1.6 + *
1.7 + * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
1.8 + *
1.9 + * This file is a modification of the ICU file IndicLayoutEngine.h
1.10 + * by Jens Herden and Javier Sola for Khmer language
1.11 + *
1.12 + */
1.13 +
1.14 +#ifndef __KHMERLAYOUTENGINE_H
1.15 +#define __KHMERLAYOUTENGINE_H
1.16 +
1.17 +// #include "LETypes.h"
1.18 +// #include "LEFontInstance.h"
1.19 +// #include "LEGlyphFilter.h"
1.20 +// #include "LayoutEngine.h"
1.21 +// #include "OpenTypeLayoutEngine.h"
1.22 +
1.23 +// #include "GlyphSubstitutionTables.h"
1.24 +// #include "GlyphDefinitionTables.h"
1.25 +// #include "GlyphPositioningTables.h"
1.26 +
1.27 +U_NAMESPACE_BEGIN
1.28 +
1.29 +// class MPreFixups;
1.30 +// class LEGlyphStorage;
1.31 +
1.32 +/**
1.33 + * This class implements OpenType layout for Khmer OpenType fonts, as
1.34 + * specified by Microsoft in "Creating and Supporting OpenType Fonts for
1.35 + * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
1.36 + *
1.37 + * This class overrides the characterProcessing method to do Khmer character processing
1.38 + * and reordering (See the MS spec. for more details)
1.39 + *
1.40 + * @internal
1.41 + */
1.42 +class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
1.43 +{
1.44 +public:
1.45 + /**
1.46 + * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
1.47 + * a particular font, script and language. It takes the GSUB table as a parameter since
1.48 + * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
1.49 + * Khmer OpenType font.
1.50 + *
1.51 + * @param fontInstance - the font
1.52 + * @param scriptCode - the script
1.53 + * @param langaugeCode - the language
1.54 + * @param gsubTable - the GSUB table
1.55 + *
1.56 + * @see LayoutEngine::layoutEngineFactory
1.57 + * @see OpenTypeLayoutEngine
1.58 + * @see ScriptAndLangaugeTags.h for script and language codes
1.59 + *
1.60 + * @internal
1.61 + */
1.62 + KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
1.63 + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
1.64 +
1.65 + /**
1.66 + * This constructor is used when the font requires a "canned" GSUB table which can't be known
1.67 + * until after this constructor has been invoked.
1.68 + *
1.69 + * @param fontInstance - the font
1.70 + * @param scriptCode - the script
1.71 + * @param langaugeCode - the language
1.72 + *
1.73 + * @see OpenTypeLayoutEngine
1.74 + * @see ScriptAndLangaugeTags.h for script and language codes
1.75 + *
1.76 + * @internal
1.77 + */
1.78 + KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
1.79 + le_int32 typoFlags);
1.80 +
1.81 + /**
1.82 + * The destructor, virtual for correct polymorphic invocation.
1.83 + *
1.84 + * @internal
1.85 + */
1.86 + virtual ~KhmerOpenTypeLayoutEngine();
1.87 +
1.88 + /**
1.89 + * ICU "poor man's RTTI", returns a UClassID for the actual class.
1.90 + *
1.91 + * @stable ICU 2.8
1.92 + */
1.93 + virtual UClassID getDynamicClassID() const;
1.94 +
1.95 + /**
1.96 + * ICU "poor man's RTTI", returns a UClassID for this class.
1.97 + *
1.98 + * @stable ICU 2.8
1.99 + */
1.100 + static UClassID getStaticClassID();
1.101 +
1.102 +protected:
1.103 +
1.104 + /**
1.105 + * This method does Khmer OpenType character processing. It assigns the OpenType feature
1.106 + * tags to the characters, and may generate output characters which have been reordered.
1.107 + * It may also split some vowels, resulting in more output characters than input characters.
1.108 + *
1.109 + * Input parameters:
1.110 + * @param chars - the input character context
1.111 + * @param offset - the index of the first character to process
1.112 + * @param count - the number of characters to process
1.113 + * @param max - the number of characters in the input context
1.114 + * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
1.115 + * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
1.116 + * the auxillary data array will be set to the feature tags.
1.117 + *
1.118 + * Output parameters:
1.119 + * @param success - set to an error code if the operation fails
1.120 + *
1.121 + * @return the output character count
1.122 + *
1.123 + * @internal
1.124 + */
1.125 + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
1.126 + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
1.127 +
1.128 +};
1.129 +
1.130 +U_NAMESPACE_END
1.131 +#endif
1.132 +