HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file ui.FlowFont by barry
expand copy to clipboardexpand
/*
{ "description" : "This is an API that allows the creation of font instances for use with other graphical objects. Note that Dana comes with standard fonts within the resources-ext directory so that the programmer can rely on at least these fonts always being available. See also the SystemInfo API which reports on the default system fonts." }
*/

uses media.PixelMap
uses ui.Color
uses FontMetrics

interface FlowFont {
	/* { "@description" : "Creates a new font instance, from a given font file, using a given font size." } */
	FlowFont(char path[], int size)
	
	/* { "@description" : "Get the font size." } */
	int getSize()
	
	/* { "@description" : "Get the path of the font." } */
	char[] getSource()
	
	/* { "@description" : "Get the FontMetrics of this font." } */
	FontMetrics getFontMetrics()
	
	/* { "@description" : "Get the friendly name of this font." } */
	char[] getFontName()
	
	/* { "@description" : "Get the character spacing affinity of the font (fixed width or variable-width)." } */
	bool isFixedCharacterWidth()
	
	/* { "@description" : "Get the width, in pixels, of the given text as rendered by this font." } */
	int getTextWidth(char text[])
	
	/* { "@description" : "Get a piece of text, rendered with this font on a single line, as a bitmap." } */
	PixelMap getPixels(char text[], Color textColor)

	/* { "@description" : "Free this font's system resources. This function must be called from the main thread of the application. System font resources are NOT automatically cleaned up by a destructor, so this function MUST be called manually to properly free resources." } */
	void destroy()
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n ui.FlowFont -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Standard Library Initialisation