public Line(string text, BaseDirection direction) { if (string.IsNullOrEmpty(text)) { throw (new ArgumentException("Text is empty.")); } _text = text; _offset = 0; _length = text.Length; Paragraph paragraph = new Paragraph(text, direction); Initialize(paragraph.Types, paragraph.Levels, paragraph.BaseLevel); }
// Shaper.applyKerning(fontProgram, text); internal static byte[] GetBidiLevels(BaseDirection baseDirection, int[] unicodeIds) { if (!TYPOGRAPHY_MODULE_INITIALIZED) { logger.Warn("Cannot find advanced typography module, which was implicitly required by one of the layout properties" ); } else { byte direction; switch (baseDirection) { case BaseDirection.LEFT_TO_RIGHT: { direction = 0; break; } case BaseDirection.RIGHT_TO_LEFT: { direction = 1; break; } case BaseDirection.DEFAULT_BIDI: default: { direction = 2; break; } } int len = unicodeIds.Length; byte[] types = (byte[])CallMethod(TYPOGRAPHY_PACKAGE + BIDI_CHARACTER_MAP, GET_CHARACTER_TYPES, new Type[] { typeof(int[]), typeof(int), typeof(int) }, unicodeIds, 0, len); // byte[] types = BidiCharacterMap.getCharacterTypes(unicodeIds, 0, len); byte[] pairTypes = (byte[])CallMethod(TYPOGRAPHY_PACKAGE + BIDI_BRACKET_MAP, GET_BRACKET_TYPES, new Type[] { typeof(int[]), typeof(int), typeof(int) }, unicodeIds, 0, len); // byte[] pairTypes = BidiBracketMap.getBracketTypes(unicodeIds, 0, len); int[] pairValues = (int[])CallMethod(TYPOGRAPHY_PACKAGE + BIDI_BRACKET_MAP, GET_BRACKET_VALUES, new Type[] { typeof(int[]), typeof(int), typeof(int) }, unicodeIds, 0, len); // int[] pairValues = BidiBracketMap.getBracketValues(unicodeIds, 0, len); Object bidiReorder = CallConstructor(TYPOGRAPHY_PACKAGE + BIDI_ALGORITHM, new Type[] { typeof(byte[]), typeof( byte[]), typeof(int[]), typeof(byte) }, types, pairTypes, pairValues, direction); // BidiAlgorithm bidiReorder = new BidiAlgorithm(types, pairTypes, pairValues, direction); return((byte[])CallMethod(TYPOGRAPHY_PACKAGE + BIDI_ALGORITHM, GET_LEVELS, bidiReorder, new Type[] { typeof( int[]) }, new int[] { len })); } // return bidiReorder.getLevels(new int[]{len}); return(null); }
public Paragraph(string text, BaseDirection direction) { if (string.IsNullOrEmpty(text)) { throw (new ArgumentException("Text is empty.")); } _text = text; _direction = direction; _types = new CharType[text.Length]; _levels = new byte[text.Length]; BidiChain chain = new BidiChain(); DetermineTypes(chain); DetermineBaseLevel(chain); DetermineLevels(chain); }
/// <summary> /// This attribute specifies the base direction of directionally neutral text /// (i.e., text that doesn't have inherent directionality as defined in Unicode) /// in an element's content and attribute values. /// </summary> /// <param name="baseDirection">base direction</param> /// <returns>this element</returns> public virtual T SetBaseDirection(BaseDirection baseDirection) { SetProperty(Property.BASE_DIRECTION, baseDirection); return((T)(Object)this); }
public RelativeDirection Minus2ndDirection(BaseDirection bd) { Direct = Direct - (int)bd; return(this); }
public RelativeDirection Minus1stDirection(BaseDirection bd) { Direct = Direct - (int)bd * 0x10; return(this); }
public RelativeDirection Add2ndDirection(BaseDirection bd) { Direct = Direct + (int)bd; return(this); }
public RelativeDirection Add1stDirection(BaseDirection bd) { Direct = Direct + (int)bd * 0x10; return(this); }
public bool Is2ndDirection(BaseDirection bd) { return((Direct & (int)bd) == (int)bd); }
public bool Is1stDirection(BaseDirection bd) { return((Direct & (int)bd * 0x10) == (int)bd * 0x10); }