Example #1
0
        public override GlyphVector CreateGlyph(GlyphTable table)
        {
            var controlPoints = new List <Vector2>();
            var onCurves      = new List <bool>();
            var endPoints     = new List <ushort>();
            var minBounds     = new List <Vector2>();
            var maxBounds     = new List <Vector2>();
            var parts         = new List <GlyphInstance>();

            for (int resultIndex = 0; resultIndex < this.result.Length; resultIndex++)
            {
                ref Composite composite = ref this.result[resultIndex];

                GlyphVector glyph          = table.GetGlyph(composite.GlyphIndex);
                int         pointcount     = glyph.PointCount;
                ushort      endPointOffset = (ushort)controlPoints.Count;
                for (int i = 0; i < pointcount; i++)
                {
                    controlPoints.Add(Vector2.Transform(glyph.ControlPoints[i], composite.Transformation));
                    onCurves.Add(glyph.OnCurves[i]);
                }

                foreach (ushort p in glyph.EndPoints)
                {
                    endPoints.Add((ushort)(p + endPointOffset));
                }
            }
Example #2
0
        public override Glyphs.GlyphVector CreateGlyph(GlyphTable table)
        {
            List <Vector2>       controlPoints = new List <Vector2>();
            List <bool>          onCurves      = new List <bool>();
            List <ushort>        endPoints     = new List <ushort>();
            List <Vector2>       minBounds     = new List <Vector2>();
            List <Vector2>       maxBounds     = new List <Vector2>();
            List <GlyphInstance> parts         = new List <GlyphInstance>();

            foreach (Composite composite in this.result)
            {
                GlyphVector glyph          = table.GetGlyph(composite.GlyphIndex);
                int         pointcount     = glyph.PointCount;
                ushort      endPointOffset = (ushort)controlPoints.Count;
                for (int i = 0; i < pointcount; i++)
                {
                    controlPoints.Add(Vector2.Transform(glyph.ControlPoints[i], composite.Transformation));
                    onCurves.Add(glyph.OnCurves[i]);
                }

                foreach (ushort p in glyph.EndPoints)
                {
                    endPoints.Add((ushort)(p + endPointOffset));
                }
            }

            return(new Glyphs.GlyphVector(controlPoints.ToArray(), onCurves.ToArray(), endPoints.ToArray(), this.bounds));
        }
        public override GlyphVector CreateGlyph(GlyphTable table)
        {
            GlyphVector glyph = default;

            for (int resultIndex = 0; resultIndex < this.result.Length; resultIndex++)
            {
                ref Composite composite = ref this.result[resultIndex];
                glyph = GlyphVector.Append(glyph, GlyphVector.Transform(GlyphVector.DeepClone(table.GetGlyph(composite.GlyphIndex)), composite.Transformation), this.bounds);
            }
Example #4
0
        /// <summary>
        /// Gets the glyph.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <returns>the glyph for a known character.</returns>
        public GlyphInstance GetGlyph(char character)
        {
            ushort idx = this.GetGlyphIndex(character);

            if (this.glyphCache[idx] == null)
            {
                ushort advanceWidth = this.horizontalMetrics.GetAdvancedWidth(idx);
                short  lsb          = this.horizontalMetrics.GetLeftSideBearing(idx);
                Tables.General.Glyphs.GlyphVector vector = this.glyphs.GetGlyph(idx);
                this.glyphCache[idx] = new GlyphInstance(vector.ControlPoints, vector.OnCurves, vector.EndPoints, vector.Bounds, advanceWidth, lsb, this.EmSize, idx);
            }

            return(this.glyphCache[idx]);
        }
Example #5
0
 internal GlyphVectorWithColor(GlyphVector vector, GlyphColor color)
 {
     this.Vector = vector;
     this.Color  = color;
 }