Exemple #1
0
        public static IEnumerable <GlyphChar[]> ToGlyphs(this Paragraph para)
        {
            var glyphNode  = para.Glyphs.Head;
            var breakNode  = para.Breaks.Head;
            int glyphIndex = 0;

            while (glyphNode != null && breakNode != null)
            {
                GlyphChar[] res = new GlyphChar[breakNode.Value - glyphIndex];
                int         idx = 0;
                while (glyphIndex < breakNode.Value && glyphNode != null)
                {
                    res [idx++] = glyphNode.Value;
                    glyphNode   = glyphNode.Next;
                    glyphIndex++;
                }
                yield return(res);

                breakNode = breakNode.Next;
            }
            if (glyphNode != null)
            {
                yield return(glyphNode.ToArray());
            }
            yield break;
        }
Exemple #2
0
        public bool InsertChar(int pos, char c, IGUIFont font, SpecialCharacterFlags flags)
        {
            GlyphChar g = font.GetGlyph(c, flags);

            if (g.Glyph > 0)
            {
                try {
                    Glyphs.InsertAt(pos, g);
                    NeedsWordWrap = true;
                    return(true);
                } catch (Exception ex) {
                    ex.LogError();
                }
            }
            return(false);
        }
Exemple #3
0
        public bool AppendChar(char c, IGUIFont font, SpecialCharacterFlags flags)
        {
            GlyphChar g = font.GetGlyph(c, flags);

            if (g.Glyph > 0)
            {
                try {
                    Glyphs.AddLast(g);
                    NeedsWordWrap = true;
                    return(true);
                } catch (Exception ex) {
                    ex.LogError();
                }
            }
            return(false);
        }