VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Properties
VisimBox.Renderer.Render2D.Font Class Reference
Inheritance diagram for VisimBox.Renderer.Render2D.Font:

List of all members.

## Public Member Functions
| Font (System.Drawing.Font systemfont)
| Creates font from system font, exports standard ascii characters.
| Font (System.Drawing.Font systemfont, char[] characters)
| Creates font from system font, using specified characters.
void | CreateFromFont (System.Drawing.Font systemfont, char[] characters)
| Creates font from system font with specified characters.
void | CreateFromFont (System.Drawing.Font systemfont, int start=32, int end=128)
| Creates font from system font, using standard ASCII character set (from 32 ' ' to 128) if no other parameters are added.
SpriteInfo[] | GetTextSprites (int x, int y, string str)
| Returns simple block of sprites for text (without any limiting)
SpriteBatch | GetTextSprites (string str, int maxwidth=0, int maxheight=0)
| Returns batch of the sprites for text.
void | DrawText (IRenderContext rc, int x, int y, string text)
| Simple text drawing on selected coordinate.
void | DrawText (IRenderContext rc, int x, int y, int maxwidth, int maxheight, string text)
| Draw text on selected coordinate with specified max size of the text block.
int | LetterWidth (char ch)
| Returns width of the letter (including space after the letter)
int | GetLineWidth (string str)
| Returns width of the string line in pixels.
void | GetTextArea (int x, int y, string str, out int maxx, out int maxy)
| Calculates text area taken by the text (for text with more lines). Resulting area is from x/y to maxx/maxxy.
string | RepageToString (int width, string str)
| Repages string (inserts end of line characters) so maximal width will be only specified size in pixels.
List< string > | Repage (int width, string str)
| Reformats string to several lines so they can be shown in specified screen width.
string[] | Repage (int width, int height, string str)
| Reformats string to several pages so each page would fit inside specified window.
void | Clear ()
void | Dispose ()
virtual void | AddReference (IResourceConsumer consumer)
| Adds reference to this resource.
virtual void | RemoveReference (IResourceConsumer consumer)
| Removes reference to this resource.
virtual bool | ReplaceReferences (IResource newresource)
| Manager wants to replace this resource by another - resource should inform all of it's consumers that it's being replaced and update references based on their response It should also check if new resource is of compatible type.
void | ResourceDisposing (IResource resource)
| Callback for resource disposing - just before releasing itself from memory resource will call all it's consumers to notify them it will be no longer valid.
bool | ResourceReplaced (IResource original, IResource newresource)
| Resource was replaced by another resource. Consumers can decide to keep new resource instead or hold to original value. If consumers wants to hold new resource instead, it should change it's pointers and return true, references in resources will be automatically updated. If false, consumer is not interested in new resource - depending on the nature of replace it may then get ResourceDisposing callback.
## Protected Member Functions
| Font ()
virtual void | DisposeConsumers ()
## Protected Attributes
Texture | _Texture
Dictionary< char, FontLetter > | Letters
string | _FileName
List< IResourceConsumer > | Consumers = new List<IResourceConsumer>()
## Properties
int | Height`[get, set]`
| Height of the font in pixels.
virtual bool | AlwaysStay`[get, set]`
| If true, resource will stay in memory even if it's not referenced.
ResourceType | ResourceType`[get]`
| Type of the resource - font.
ResourceUsage | Usage`[get]`
| Usage of the font.
string | FileName`[get, set]`
| Filename of the font.
int | References`[get]`
| Number of current references.
int | NullReferences`[get]`
| Returns number of null generic references.

## Constructor & Destructor Documentation

VisimBox.Renderer.Render2D.Font.Font | ( |  | ) | `[protected]`

VisimBox.Renderer.Render2D.Font.Font | ( | System.Drawing.Font | systemfont | ) |

Creates font from system font, exports standard ascii characters.

Parameters:

  systemfont | System.Drawing.Font

VisimBox.Renderer.Render2D.Font.Font | ( | System.Drawing.Font | systemfont,
|  | char[] | characters
| ) |  |

Creates font from system font, using specified characters.

Parameters:

  systemfont | System.Drawing.Font

## Member Function Documentation

virtual void VisimBox.Renderer.Render2D.Font.AddReference | ( | IResourceConsumer | consumer | ) | `[virtual]`

Adds reference to this resource.

Parameters:

  consumer | Consumer of resource

Implements VisimBox.Resources.IResource.

void VisimBox.Renderer.Render2D.Font.Clear | ( |  | ) |

void VisimBox.Renderer.Render2D.Font.CreateFromFont | ( | System.Drawing.Font | systemfont,
|  | int | start = `32`,
|  | int | end = `128`
| ) |  |

Creates font from system font, using standard ASCII character set (from 32 ' ' to 128) if no other parameters are added.

Parameters:

  systemfont | System.Drawing.Font
  start | First character
  end | Last character

void VisimBox.Renderer.Render2D.Font.CreateFromFont | ( | System.Drawing.Font | systemfont,
|  | char[] | characters
| ) |  |

Creates font from system font with specified characters.

Parameters:

  font |
  characters |

void VisimBox.Renderer.Render2D.Font.Dispose | ( |  | ) |

virtual void VisimBox.Renderer.Render2D.Font.DisposeConsumers | ( |  | ) | `[protected, virtual]`

void VisimBox.Renderer.Render2D.Font.DrawText | ( | IRenderContext | rc,
|  | int | x,
|  | int | y,
|  | string | text
| ) |  |

Simple text drawing on selected coordinate.

Parameters:

  x | X coordinate
  y | Y coordinate
  text | text

void VisimBox.Renderer.Render2D.Font.DrawText | ( | IRenderContext | rc,
|  | int | x,
|  | int | y,
|  | int | maxwidth,
|  | int | maxheight,
|  | string | text
| ) |  |

Draw text on selected coordinate with specified max size of the text block.

Parameters:

  x | X coordinate
  y | Y coordinate
  maxheight | Maximal height of the text block
  maxwidth | Maximal width of the text block
  text | text

int VisimBox.Renderer.Render2D.Font.GetLineWidth | ( | string | str | ) |

Returns width of the string line in pixels.

Parameters:

  str | String to measure

Returns:
  String width

void VisimBox.Renderer.Render2D.Font.GetTextArea | ( | int | x,
|  | int | y,
|  | string | str,
|  | out int | maxx,
|  | out int | maxy
| ) |  |

Calculates text area taken by the text (for text with more lines). Resulting area is from x/y to maxx/maxxy.

Parameters:

  x | Starting x
  y | Starting y
  str | text
  maxx | Maximal X value
  maxy | Maximal Y value

SpriteBatch VisimBox.Renderer.Render2D.Font.GetTextSprites | ( | string | str,
|  | int | maxwidth = `0`,
|  | int | maxheight = `0`
| ) |  |

Returns batch of the sprites for text.

Parameters:

  str | Text to convert to sprites
  maxwidth | maximal allowed width (if 0, no limit)
  maxheight | maximal allowed height (if 0, no limit)

Returns:
  SpriteBatch with text

SpriteInfo [] VisimBox.Renderer.Render2D.Font.GetTextSprites | ( | int | x,
|  | int | y,
|  | string | str
| ) |  |

Returns simple block of sprites for text (without any limiting)

Parameters:

  x | Required starting X position
  y | Required starting Y position
  str | text to convert

Returns:
  Block of sprites for each letter

int VisimBox.Renderer.Render2D.Font.LetterWidth | ( | char | ch | ) |

Returns width of the letter (including space after the letter)

Parameters:

  ch | Required letter

Returns:
  Width in pixels or zero if font doesn't contain letter

virtual void VisimBox.Renderer.Render2D.Font.RemoveReference | ( | IResourceConsumer | consumer | ) | `[virtual]`

Removes reference to this resource.

Parameters:

  consumer | Consumer of resource

Implements VisimBox.Resources.IResource.

List<string> VisimBox.Renderer.Render2D.Font.Repage | ( | int | width,
|  | string | str
| ) |  |

Reformats string to several lines so they can be shown in specified screen width.

Parameters:

  width | Requested pixel width
  str | String to repage

Returns:
  List of lines

string [] VisimBox.Renderer.Render2D.Font.Repage | ( | int | width,
|  | int | height,
|  | string | str
| ) |  |

Reformats string to several pages so each page would fit inside specified window.

Parameters:

  width |
  height |

Returns:

string VisimBox.Renderer.Render2D.Font.RepageToString | ( | int | width,
|  | string | str
| ) |  |

Repages string (inserts end of line characters) so maximal width will be only specified size in pixels.

Parameters:

  width | Maximal pixel width
  str | String to repage

Returns:
  Repaged string

virtual bool VisimBox.Renderer.Render2D.Font.ReplaceReferences | ( | IResource | newresource | ) | `[virtual]`

Manager wants to replace this resource by another - resource should inform all of it's consumers that it's being replaced and update references based on their response It should also check if new resource is of compatible type.

Parameters:

  newresource | New resource

Returns:
  True if resource is compatible type and all consumers accepted resource changing, false otherwise

Implements VisimBox.Resources.IResource.

void VisimBox.Renderer.Render2D.Font.ResourceDisposing | ( | IResource | resource | ) |

Callback for resource disposing - just before releasing itself from memory resource will call all it's consumers to notify them it will be no longer valid.

Parameters:

  resource | Resource which is being disposed

Implements VisimBox.Resources.IResourceConsumer.

bool VisimBox.Renderer.Render2D.Font.ResourceReplaced | ( | IResource | original,
|  | IResource | newresource
| ) |  |

Resource was replaced by another resource. Consumers can decide to keep new resource instead or hold to original value. If consumers wants to hold new resource instead, it should change it's pointers and return true, references in resources will be automatically updated. If false, consumer is not interested in new resource - depending on the nature of replace it may then get ResourceDisposing callback.

Parameters:

  original | Original resource registered with consumer
  newresource | New resource

Returns:
  Consumer must return true if it want's to change reference to newresource, otherwise false.

Implements VisimBox.Resources.IResourceConsumer.

## Member Data Documentation

string VisimBox.Renderer.Render2D.Font._FileName`[protected]`

Texture VisimBox.Renderer.Render2D.Font._Texture`[protected]`

List<IResourceConsumer> VisimBox.Renderer.Render2D.Font.Consumers = new List<IResourceConsumer>()`[protected]`

Dictionary<char, FontLetter > VisimBox.Renderer.Render2D.Font.Letters`[protected]`

## Property Documentation

virtual bool VisimBox.Renderer.Render2D.Font.AlwaysStay`[get, set]`

If true, resource will stay in memory even if it's not referenced.

Implements VisimBox.Resources.IResource.

string VisimBox.Renderer.Render2D.Font.FileName`[get, set]`

Filename of the font.

Implements VisimBox.Resources.IResource.

int VisimBox.Renderer.Render2D.Font.Height`[get, set]`

Height of the font in pixels.

int VisimBox.Renderer.Render2D.Font.NullReferences`[get]`

Returns number of null generic references.

Implements VisimBox.Resources.IResource.

int VisimBox.Renderer.Render2D.Font.References`[get]`

Number of current references.

Implements VisimBox.Resources.IResource.

ResourceType VisimBox.Renderer.Render2D.Font.ResourceType`[get]`

Type of the resource - font.

Implements VisimBox.Resources.IResource.

ResourceUsage VisimBox.Renderer.Render2D.Font.Usage`[get]`

Usage of the font.

Implements VisimBox.Resources.IResource.

The documentation for this class was generated from the following file:

- Font.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events