import Texture from "../textures/Texture";
import TextOptions from "./TextOptions";
import TextFormat from "./TextFormat";
import ITextCompositor from "./ITextCompositor";
import BitmapCharLocation from "./BitmapCharLocation";
import BitmapChar from "./BitmapChar";
import MeshStyle from "../styles/MeshStyle";
import Sprite from "../display/Sprite";
import MeshBatch from "../display/MeshBatch";
import Vector from "openfl/Vector";
declare namespace starling.text {
	/**
	 *  The BitmapFont class parses bitmap font files and arranges the glyphs
	 *  *  in the form of a text.
	 *  *
	 *  *  The class parses the XML format as it is used in the 
	 *  *  <a href="http://www.angelcode.com/products/bmfont/">AngelCode Bitmap Font Generator</a> or
	 *  *  the <a href="http://glyphdesigner.71squared.com/">Glyph Designer</a>. 
	 *  *  This is what the file format looks like:
	 *  *
	 *  *  <pre> 
	 *  *  &lt;font&gt;
	 *  *    &lt;info face="BranchingMouse" size="40" /&gt;
	 *  *    &lt;common lineHeight="40" /&gt;
	 *  *    &lt;pages&gt;  &lt;!-- currently, only one page is supported --&gt;
	 *  *      &lt;page id="0" file="texture.png" /&gt;
	 *  *    &lt;/pages&gt;
	 *  *    &lt;chars&gt;
	 *  *      &lt;char id="32" x="60" y="29" width="1" height="1" xoffset="0" yoffset="27" xadvance="8" /&gt;
	 *  *      &lt;char id="33" x="155" y="144" width="9" height="21" xoffset="0" yoffset="6" xadvance="9" /&gt;
	 *  *    &lt;/chars&gt;
	 *  *    &lt;kernings&gt; &lt;!-- Kerning is optional --&gt;
	 *  *      &lt;kerning first="83" second="83" amount="-4"/&gt;
	 *  *    &lt;/kernings&gt;
	 *  *  &lt;/font&gt;
	 *  *  </pre>
	 *  *  
	 *  *  Pass an instance of this class to the method <code>registerBitmapFont</code> of the
	 *  *  TextField class. Then, set the <code>fontName</code> property of the text field to the 
	 *  *  <code>name</code> value of the bitmap font. This will make the text field use the bitmap
	 *  *  font.  
	 *  
	 */
	export class BitmapFont implements ITextCompositor {
		/**
		 *  Creates a bitmap font from the given texture and font data.
		 *      *  If you don't pass any data, the "mini" font will be created.
		 *      *
		 *      * @param texture  The texture containing all the glyphs.
		 *      * @param fontData Typically an XML file in the standard AngelCode format. Override the
		 *      *                 the 'parseFontData' method to add support for additional formats.
		 *      
		 */
		constructor(texture?: Texture, fontData?: any);
		/**
		 *  Use this constant for the <code>fontSize</code> property of the TextField class to 
		 *      * render the bitmap font in exactly the size it was created. 
		 */
		static readonly NATIVE_SIZE = -1;
		/**
		 *  The font name of the embedded minimal bitmap font. Use this e.g. for debug output. 
		 */
		static readonly MINI = "mini";
		/**
		 *  Disposes the texture of the bitmap font! 
		 */
		dispose(): void;
		/**
		 *  Returns a single bitmap char with a certain character ID. 
		 */
		getChar(charID: number): BitmapChar;
		/**
		 *  Adds a bitmap char with a certain character ID. 
		 */
		addChar(charID: number, bitmapChar: BitmapChar): void;
		/**
		 *  Returns a vector containing all the character IDs that are contained in this font. 
		 */
		getCharIDs(result?: Vector<number>): Vector<number>;
		/**
		 *  Checks whether a provided string can be displayed with the font. 
		 */
		hasChars(text: string): boolean;
		/**
		 *  Creates a sprite that contains a certain text, made up by one image per char. 
		 */
		createSprite(width: number, height: number, text: string, format: TextFormat, options?: TextOptions): Sprite;
		/**
		 *  Draws text into a QuadBatch. 
		 */
		fillMeshBatch(meshBatch: MeshBatch, width: number, height: number, text: string, format: TextFormat, options?: TextOptions): void;
		/**
		 *  @inheritDoc 
		 */
		clearMeshBatch(meshBatch: MeshBatch): void;
		/**
		 *  @inheritDoc 
		 */
		getDefaultMeshStyle(previousStyle: MeshStyle, format: TextFormat, options: TextOptions): MeshStyle;
		/**
		 *  Arranges the characters of text inside a rectangle, adhering to the given settings.
		 *      *  Returns a Vector of BitmapCharLocations.
		 *      *
		 *      *  <p>BEWARE: This method uses an object pool for the returned vector and all
		 *      *  (returned and temporary) BitmapCharLocation instances. Do not save any references and
		 *      *  always call <code>BitmapCharLocation.rechargePool()</code> when you are done processing.
		 *      *  </p>
		 *      
		 */
		arrangeChars(width: number, height: number, text: string, format: TextFormat, options: TextOptions): Vector<BitmapCharLocation>;
		/**
		 *  The name of the font as it was parsed from the font file. 
		 */
		get name(): string;
		/**
		 *  The native size of the font. 
		 */
		get size(): number;
		/**
		 *  The type of the bitmap font. @see starling.text.BitmapFontType @default standard 
		 */
		get type(): string;
		set type(value: string)
		get_type(): string;
		set_type(value: string): string;
		/**
		 *  If the font uses a distance field texture, this property returns its spread (i.e.
		 *      *  the width of the blurred edge in points). 
		 */
		get distanceFieldSpread(): number;
		set distanceFieldSpread(value: number)
		get_distanceFieldSpread(): number;
		set_distanceFieldSpread(value: number): number;
		/**
		 *  The height of one line in points. 
		 */
		get lineHeight(): number;
		/**
		 *  The smoothing filter that is used for the texture. 
		 */
		get smoothing(): string;
		set smoothing(value: string)
		/**
		 *  The baseline of the font. This property does not affect text rendering;
		 *      * it's just an information that may be useful for exact text placement. 
		 */
		get baseline(): number;
		set baseline(value: number)
		/**
		 *  An offset that moves any generated text along the x-axis (in points).
		 *      * Useful to make up for incorrect font data. @default 0. 
		 */
		get offsetX(): number;
		set offsetX(value: number)
		/**
		 *  An offset that moves any generated text along the y-axis (in points).
		 *      * Useful to make up for incorrect font data. @default 0. 
		 */
		get offsetY(): number;
		set offsetY(value: number)
		/**
		 *  The width of a "gutter" around the composed text area, in points.
		 *      *  This can be used to bring the output more in line with standard TrueType rendering:
		 *      *  Flash always draws them with 2 pixels of padding. @default 0.0 
		 */
		get padding(): number;
		set padding(value: number)
	}
}
export default starling.text.BitmapFont;