예제 #1
0
        public void PrintJapaneseLetter(UChar letter, float length)
        {
            var cb = _writer.DirectContent;

            //実際にフォントを適用
            ApplyFont();

            //印字。ただし一部の文字についてはフォント変更。
            BaseFont specialFont = null;

            if (Array.IndexOf(symbols, letter) != -1)
            {
                specialFont = _symbolFont;
            }
            if (specialFont != null)
            {
                cb.SetFontAndSize(specialFont, _fontSize);
            }

            var voffset = +new GlyphMetric(letter, length).VerticalOffset;

            if (!_emdashRenderer.Send(cb, _fontSize, _xtlm, MyYTLM + voffset, letter, length))
            {
                string letterAsString = letter.ToString();
                SetAppropriateTextMatrix(letter, voffset, cb);
                cb.ShowText(letterAsString);
            }
            if (specialFont != null)
            {
                cb.SetFontAndSize(_font, _fontSize);
            }

            _deltaY += length;
        }
예제 #2
0
        public void PrintJapaneseLetter(UChar letter, float length)
        {
            var deltaY = new GlyphMetric(letter, length).VerticalOffset;

            DrawString(letter.ToString(), _x, _y - deltaY, _graphics, _fontCache);
            _y += length;
        }
예제 #3
0
        public void PrintJapaneseLetter(UChar letter, float length)
        {
            var cb = _writer.DirectContent;

            //実際にフォントを適用
            ApplyFont();

            //印字。ただし一部の文字についてはフォント変更。
            BaseFont specialFont = null;
            if (Array.IndexOf(symbols, letter) != -1)
            {
                specialFont = _symbolFont;
            }
            if (specialFont != null) cb.SetFontAndSize(specialFont, _fontSize);

            var voffset = +new GlyphMetric(letter, length).VerticalOffset;
            if (!_emdashRenderer.Send(cb, _fontSize, _xtlm, MyYTLM + voffset, letter, length))
            {
                string letterAsString = letter.ToString();
                SetAppropriateTextMatrix(letter, voffset, cb);
                cb.ShowText(letterAsString);
            }
            if (specialFont != null) cb.SetFontAndSize(_font, _fontSize);

            _deltaY += length;
        }
예제 #4
0
        public void TestMaxExpansion(/* char* par */)
        {
            int               unassigned = 0xEFFFD;
            String            rule       = "&a < ab < c/aba < d < z < ch";
            RuleBasedCollator coll       = null;

            try
            {
                coll = new RuleBasedCollator(rule);
            }
            catch (Exception e)
            {
                Warnln("Fail to create RuleBasedCollator");
                return;
            }
            char   ch  = (char)0;
            String str = ch + "";

            CollationElementIterator iter = coll.GetCollationElementIterator(str);

            while (ch < 0xFFFF)
            {
                int count = 1;
                ch++;
                str = ch + "";
                iter.SetText(str);
                int order = iter.Previous();

                // thai management
                if (order == 0)
                {
                    order = iter.Previous();
                }

                while (iter.Previous() != CollationElementIterator.NULLORDER)
                {
                    count++;
                }

                if (iter.GetMaxExpansion(order) < count)
                {
                    Errln("Failure at codepoint " + ch + ", maximum expansion count < " + count);
                }
            }

            // testing for exact max expansion
            ch = (char)0;
            while (ch < 0x61)
            {
                str = ch + "";
                iter.SetText(str);
                int order = iter.Previous();

                if (iter.GetMaxExpansion(order) != 1)
                {
                    Errln("Failure at codepoint 0x" + (ch).ToHexString()
                          + " maximum expansion count == 1");
                }
                ch++;
            }

            ch  = (char)0x63;
            str = ch + "";
            iter.SetText(str);
            int temporder = iter.Previous();

            if (iter.GetMaxExpansion(temporder) != 3)
            {
                Errln("Failure at codepoint 0x" + (ch).ToHexString()
                      + " maximum expansion count == 3");
            }

            ch  = (char)0x64;
            str = ch + "";
            iter.SetText(str);
            temporder = iter.Previous();

            if (iter.GetMaxExpansion(temporder) != 1)
            {
                Errln("Failure at codepoint 0x" + (ch).ToHexString()
                      + " maximum expansion count == 1");
            }

            str = UChar.ToString(unassigned);
            iter.SetText(str);
            temporder = iter.Previous();

            if (iter.GetMaxExpansion(temporder) != 2)
            {
                Errln("Failure at codepoint 0x" + (ch).ToHexString()
                      + " maximum expansion count == 2");
            }


            // testing jamo
            ch  = (char)0x1165;
            str = ch + "";
            iter.SetText(str);
            temporder = iter.Previous();

            if (iter.GetMaxExpansion(temporder) > 3)
            {
                Errln("Failure at codepoint 0x" + (ch).ToHexString()
                      + " maximum expansion count < 3");
            }

            // testing special jamo &a<\u1165
            rule = "\u0026\u0071\u003c\u1165\u002f\u0071\u0071\u0071\u0071";

            try
            {
                coll = new RuleBasedCollator(rule);
            }
            catch (Exception e)
            {
                Errln("Fail to create RuleBasedCollator");
                return;
            }
            iter = coll.GetCollationElementIterator(str);

            temporder = iter.Previous();

            if (iter.GetMaxExpansion(temporder) != 6)
            {
                Errln("Failure at codepoint 0x" + (ch).ToHexString()
                      + " maximum expansion count == 6");
            }
        }
예제 #5
0
 public void PrintJapaneseLetter(UChar letter, float length)
 {
     var deltaY = new GlyphMetric(letter, length).VerticalOffset;
     DrawString(letter.ToString(), _x, _y - deltaY, _graphics, _fontCache);
     _y += length;
 }