/// <summary>
        ///TrueType outline, transform normal
        /// </summary>
        /// <param name="glyph"></param>
        /// <param name="m00"></param>
        /// <param name="m01"></param>
        /// <param name="m10"></param>
        /// <param name="m11"></param>
        internal static void TtfTransformWith2x2Matrix(Glyph glyph, float m00, float m01, float m10, float m11)
        {
            //http://stackoverflow.com/questions/13188156/whats-the-different-between-vector2-transform-and-vector2-transformnormal-i
            //http://www.technologicalutopia.com/sourcecode/xnageometry/vector2.cs.htm

            //change data on current glyph
            float new_xmin = 0;
            float new_ymin = 0;
            float new_xmax = 0;
            float new_ymax = 0;

            GlyphPointF[] glyphPoints = glyph.GlyphPoints;
            for (int i = 0; i < glyphPoints.Length; ++i)
            {
                GlyphPointF p = glyphPoints[i];
                float       x = p.P.X;
                float       y = p.P.Y;

                float newX, newY;
                //please note that this is transform normal***
                glyphPoints[i] = new GlyphPointF(
                    newX       = (float)Math.Round((x * m00) + (y * m10)),
                    newY       = (float)Math.Round((x * m01) + (y * m11)),
                    p.onCurve);

                //short newX = xs[i] = (short)Math.Round((x * m00) + (y * m10));
                //short newY = ys[i] = (short)Math.Round((x * m01) + (y * m11));
                //------
                if (newX < new_xmin)
                {
                    new_xmin = newX;
                }
                if (newX > new_xmax)
                {
                    new_xmax = newX;
                }
                //------
                if (newY < new_ymin)
                {
                    new_ymin = newY;
                }
                if (newY > new_ymax)
                {
                    new_ymax = newY;
                }
            }
            //TODO: review here
            glyph.Bounds = new Bounds(
                (short)new_xmin, (short)new_ymin,
                (short)new_xmax, (short)new_ymax);
        }
예제 #2
0
 internal bool dbugIsEqualsWith(GlyphPointF another)
 {
     return(this.P == another.P && this.onCurve == another.onCurve);
 }