Newer
Older
exporter / Packer / FontCodepointData.as
package Packer
{
	import flash.display.*;
	import flash.geom.*;

	public class FontCodepointData
	{
		public var Codepoint;
		
		public var DestinationNode:RectangleNode = null;		
		public var References = 0;
		
		public var Offset:Point = new Point();
		
		public var CodepointWidth = 0;
		
		public var FromOtherFont = false;
		
		// comes from another font
		public var FromFont:BitmapFont;
		public var FromFontIndex = 0;
		
		// comes from this font
		public var Data:BitmapData = null;
		
		public function FontCodepointData(codepoint)
		{
			this.Codepoint = codepoint;
		}
		
		public function InitFromOtherFont(fromFont:BitmapFont, index)
		{
			this.FromOtherFont = true;
			this.FromFont = fromFont;
			this.FromFontIndex = index;
			
			var otherData:FontCodepointData = fromFont.CodepointData[index];
			this.CodepointWidth = otherData.CodepointWidth;
			this.Offset = otherData.Offset;
		}
		
		public function Init(data:BitmapData, offset:Point, codepointWidth)
		{
			this.FromOtherFont = false;
			this.Data = data;
			this.Offset = offset;
			this.CodepointWidth = codepointWidth;
		}
	}
}