public static LetterVector[] GetLetter(char letter, float scale)
        {
            int index = FindLetter(letter);

            if (index == -1)
                return null;

            int vectorStart = GetVectorStart(index);
            int vectorEnd = vectorStart + VectorFontData.vectorCount[index] * 4;

            int size = (vectorEnd - vectorStart) / 4;
            LetterVector[] vectors = new LetterVector[size];

            int ind = 0;
            for (int vector = vectorStart; vector < vectorEnd; vector += 4) {
                int x1 = (int) Math.Round(VectorFontData.Vectors[vector] * scale);
                int y1 = (int) Math.Round(-VectorFontData.Vectors[vector + 1] * scale);
                int x2 = (int) Math.Round(VectorFontData.Vectors[vector + 2] * scale);
                int y2 = (int) Math.Round(-VectorFontData.Vectors[vector + 3] * scale);
                vectors[ind] = new LetterVector(new Point(x1, y1), new Point(x2, y2));
                ind++;
            }

            return(vectors);
        }
示例#2
0
        public static LetterVector[] GetLetter(char letter, float scale)
        {
            int index = FindLetter(letter);

            if (index == -1)
            {
                return(null);
            }

            int vectorStart = GetVectorStart(index);
            int vectorEnd   = vectorStart + VectorFontData.vectorCount[index] * 4;

            int size = (vectorEnd - vectorStart) / 4;

            LetterVector[] vectors = new LetterVector[size];

            int ind = 0;

            for (int vector = vectorStart; vector < vectorEnd; vector += 4)
            {
                int x1 = (int)Math.Round(VectorFontData.Vectors[vector] * scale);
                int y1 = (int)Math.Round(-VectorFontData.Vectors[vector + 1] * scale);
                int x2 = (int)Math.Round(VectorFontData.Vectors[vector + 2] * scale);
                int y2 = (int)Math.Round(-VectorFontData.Vectors[vector + 3] * scale);
                vectors[ind] = new LetterVector(new Point(x1, y1), new Point(x2, y2));
                ind++;
            }

            return(vectors);
        }