コード例 #1
0
        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);
        }
コード例 #2
0
        //            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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
 public RelativeDirection Minus2ndDirection(BaseDirection bd)
 {
     Direct = Direct - (int)bd;
     return(this);
 }
コード例 #6
0
 public RelativeDirection Minus1stDirection(BaseDirection bd)
 {
     Direct = Direct - (int)bd * 0x10;
     return(this);
 }
コード例 #7
0
 public RelativeDirection Add2ndDirection(BaseDirection bd)
 {
     Direct = Direct + (int)bd;
     return(this);
 }
コード例 #8
0
 public RelativeDirection Add1stDirection(BaseDirection bd)
 {
     Direct = Direct + (int)bd * 0x10;
     return(this);
 }
コード例 #9
0
 public bool Is2ndDirection(BaseDirection bd)
 {
     return((Direct & (int)bd) == (int)bd);
 }
コード例 #10
0
 public bool Is1stDirection(BaseDirection bd)
 {
     return((Direct & (int)bd * 0x10) == (int)bd * 0x10);
 }