示例#1
0
        protected CharacterGeometry InternalGetCharacterGeometryForCaching(char textChar, FontX font)
        {
            var charOutline = InternalGetCharacterOutlineForCaching(textChar, font); // get the - already simplified - polygonal shape of the character

            var polygons = charOutline.Outline;

            var polygonsWithNormal = new List <PolygonClosedWithNormalsD2D>(polygons.Select(poly => new PolygonClosedWithNormalsD2D(poly))); // get the polygons with normal, used to form the walls of the character

            var indexedTriangles = Triangulate(polygons);                                                                                    // Triangles that can be used for the front and the back side of the character

            var result = new CharacterGeometry(
                polygonsWithNormal, indexedTriangles,
                charOutline.FontSize, charOutline.LineSpacing, charOutline.Baseline,
                charOutline.AdvanceWidth, charOutline.LeftSideBearing, charOutline.RightSideBearing);

            return(result);
        }
示例#2
0
		protected CharacterGeometry InternalGetCharacterGeometryForCaching(char textChar, FontX font)
		{
			var charOutline = InternalGetCharacterOutlineForCaching(textChar, font); // get the - already simplified - polygonal shape of the character

			var polygons = charOutline.Outline;

			var polygonsWithNormal = new List<PolygonClosedWithNormalsD2D>(polygons.Select(poly => new PolygonClosedWithNormalsD2D(poly))); // get the polygons with normal, used to form the walls of the character

			var indexedTriangles = Triangulate(polygons); // Triangles that can be used for the front and the back side of the character

			var result = new CharacterGeometry(
				polygonsWithNormal, indexedTriangles,
				charOutline.FontSize, charOutline.LineSpacing, charOutline.Baseline,
				charOutline.AdvanceWidth, charOutline.LeftSideBearing, charOutline.RightSideBearing);

			return result;
		}