-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61c280b
commit 72eff73
Showing
18 changed files
with
256 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# FontInfo.constructor | ||
|
||
Default constructor for the FontInfo class. | ||
Default constructor for the `FontInfo` class. | ||
|
||
`constructor(font: FontName, size: number)` | ||
```typescript | ||
constructor(font: FontName, size: number) | ||
``` | ||
|
||
`font: FontName` FontName of font to use. Possible values: `FontName.Font5` and `FontName.Font8`. | ||
## Parameters | ||
|
||
`size: number` Multiplier for font. For example, to use a double-sized font, set `size` to 2. | ||
- `font: FontName` [`FontName`](FontName.md) of font to use. | ||
- `size: number` Multiplier for font. For example, to use a double-sized font, set `size` to 2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FontInfo.font property | ||
|
||
Get an `Image.font` object related to the `FontInfo` object. | ||
|
||
```typescript | ||
FontInfo.font: Image.Font | ||
``` | ||
|
||
## Return value | ||
|
||
An `Image.font` object with the properties set in the `FontInfo` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FontInfo.fontName property | ||
|
||
Get a [`FontName`](FontName.md) enum value related to the `FontInfo` object. | ||
|
||
```typescript | ||
FontInfo.fontName: FontName | ||
``` | ||
|
||
## Return value | ||
|
||
A [`FontName`](FontName.md) value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FontInfo.height property | ||
|
||
Get the character height of the `FontInfo` object. | ||
|
||
```typescript | ||
FontInfo.height: number | ||
``` | ||
|
||
## Return value | ||
|
||
A `number` representing the character height of the font used in the `FontInfo` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FontInfo.size property | ||
|
||
Get the multiplier used by the `FontInfo` object. | ||
|
||
```typescript | ||
FontInfo.size: number | ||
``` | ||
|
||
## Return value | ||
|
||
A `number` representing the multiplier used by the `FontInfo` object. For example, if the font is double-sized, `size` will return `2`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# FontInfo.width method | ||
|
||
Calculate the width of a string in pixels. | ||
|
||
```typescript | ||
FontInfo.width(text: string): number | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string` Text to measure. | ||
|
||
## Return value | ||
|
||
A `number` representing the width of the text in pixels. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# FontName enum | ||
|
||
Enumerates the available fonts in the system. | ||
|
||
## Values | ||
- `FontName.Font5` | ||
- `FontName.Font8` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# TextAlignment enum | ||
|
||
Enumerates the possible alignments when wrapping text within a bounding box. | ||
|
||
## Values | ||
|
||
- `TextAlignment.Left` | ||
- `TextAlignment.Center` | ||
- `TextAlignment.Right` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
# Display Strings API | ||
|
||
## Enumerations | ||
|
||
- [`FontName`](FontName.md) | ||
- [`TextAlignment`](TextAlignment.md) | ||
|
||
## `FontInfo` class | ||
|
||
- [`constructor(FontName, number)`](FontInfo.constructor.md) | ||
- **Properties** | ||
- `font` | ||
- `fontName` | ||
- `height` | ||
- `size` | ||
- **Public methods** | ||
- `width(string)` | ||
- [`constructor(FontName, number)`](FontInfo.constructor.md) | ||
- **Properties** | ||
- [`font`](FontInfo.font.md) | ||
- [`fontName`](FontInfo.fontName.md) | ||
- [`height`](FontInfo.height.md) | ||
- [`size`](FontInfo.size.md) | ||
- **Public methods** | ||
- [`width(string)`](FontInfo.width.md) | ||
|
||
## `drawStrings` namespace | ||
- `createFontInfo(FontName, number)` | ||
- `height(FontInfo)` | ||
- `width(string, FontInfo)` | ||
- `write(string, Image, number, number, number, FontInfo)` | ||
- `writeCenter(string, Image, number, number, FontInfo)` | ||
- `writeMultiple(string[], Image, number, number, number, FontInfo, number)` | ||
- `writeMultipleCenter(string[], Image, number, number, FontInfo, number)` | ||
- `writeWrapped(string, Image, number, number, number, number, FontInfo, number, number)` | ||
- [`createFontInfo(FontName, number)`](drawStrings.createFontInfo.md) | ||
- [`height(FontInfo)`](drawStrings.height.md) | ||
- [`width(string, FontInfo)`](drawStrings.width.md) | ||
- [`write(string, Image, number, number, number, FontInfo)`](drawStrings.write.md) | ||
- [`writeCenter(string, Image, number, number, FontInfo)`](drawStrings.writeCenter.md) | ||
- [`writeMultiple(string[], Image, number, number, number, FontInfo, number)`](drawStrings.writeMultiple.md) | ||
- [`writeMultipleCenter(string[], Image, number, number, FontInfo, number)`](drawStrings.writeMultipleCenter.md) | ||
- [`writeWrapped(string, Image, number, number, number, number, FontInfo, number, number)`](drawStrings.writeWrapped.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# createFontInfo function | ||
|
||
Create a `FontInfo` object. Used in the Blocks interface. | ||
|
||
```typescript | ||
drawStrings.createFontInfo(font: FontName, | ||
size: number = 0): FontInfo | ||
``` | ||
|
||
## Parameters | ||
- `font: FontName` A value from the [`FontName`](FontName.md) enum. | ||
- `size: number` Multiplier for font. For example, to use a double-sized font, set `size` to 2. | ||
|
||
## Return value | ||
|
||
A `FontInfo` object representing the requested font. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# height function | ||
|
||
Get the character height of the `FontInfo` object. Used in the Blocks interface. | ||
|
||
```typescript | ||
drawStrings.height(fi: FontInfo): number | ||
``` | ||
|
||
## Parameters | ||
|
||
- `fi: FontInfo` The `FontInfo` object of interest. | ||
|
||
## Return value | ||
|
||
A `number` representing the character height of the font used in the `FontInfo` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# width function | ||
|
||
Calculate the width of a string in pixels. Used in the Blocks interface. | ||
|
||
```typescript | ||
drawStrings.width(text: string, fi: FontInfo): number | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string` Text to measure. | ||
- `fi: FontInfo` `FontInfo` object to use when calculating width. | ||
|
||
## Return value | ||
|
||
A `number` representing the width of the text in pixels. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# write function | ||
|
||
Draw a string on the given image. | ||
|
||
```typescript | ||
drawStrings.write(text: string, img: Image, x: number, | ||
y: number, color: number, fi: FontInfo): void | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string` String to draw. | ||
- `img: Image` Drawing canvas. | ||
- `x: number` Horizontal coordinate for top-left of string. | ||
- `y: number` Vertical coordinate for top-left of string. | ||
- `color: number` Color to use when drawing text. | ||
- `fi: FontInfo` Font to use. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# writeCenter function | ||
|
||
Draw a string on the given image centered horizontally. | ||
|
||
```typescript | ||
drawStrings.writeCenter(text: string, img: Image, | ||
y: number, color: number, fi: FontInfo): void | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string` String to draw. | ||
- `img: Image` Drawing canvas. | ||
- `y: number` Vertical coordinate for top of string. | ||
- `color: number` Color to use when drawing text. | ||
- `fi: FontInfo` Font to use. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# writeMultiple function | ||
|
||
Draw an array of strings on the given image. | ||
|
||
```typescript | ||
drawStrings.writeMultiple(text: string[], img: Image, | ||
x: number, y: number, | ||
color: number, fi: FontInfo, spacing: number = 1): void | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string[]` Strings to draw. | ||
- `img: Image` Drawing canvas. | ||
- `x: number` Horizontal coordinate for top-left of string. | ||
- `y: number` Vertical coordinate for top-left of string. | ||
- `color: number` Color to use when drawing text. | ||
- `fi: FontInfo` Font to use. | ||
- `spacing: number` Number of pixels to skip between strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# writeMultipleCenter function | ||
|
||
Draw an array of strings on the given image centered horizontally. | ||
|
||
```typescript | ||
drawStrings.writeMultipleCenter(text: string[], img: Image, | ||
y: number, color: number, fi: FontInfo): void | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string[]` Strings to draw. | ||
- `img: Image` Drawing canvas. | ||
- `y: number` Vertical coordinate for top of first string. | ||
- `color: number` Color to use when drawing text. | ||
- `fi: FontInfo` Font to use. | ||
- `spacing: number` Number of pixels to skip between strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# writeWrapped function | ||
|
||
Wrap a string within a bounding box. | ||
|
||
```typescript | ||
drawStringswriteWrapped(text: string, img: Image, | ||
x1: number, y1: number, x2: number, y2: number, | ||
align: TextAlignment, color: number, fi: FontInfo, | ||
startChar: number = 0, spacing: number = 0): number | ||
``` | ||
|
||
## Parameters | ||
|
||
- `text: string` String to draw. | ||
- `img: Image` Drawing canvas. | ||
- `x1: number` Horizontal coordinate of top-left of bounding box. | ||
- `y1: number` Vertical coordinate of top-left of bounding box. | ||
- `x2: number` Horizontal coordinate of bottom-right of bounding box. | ||
- `y2: number` Vertical coordinate of bottom-right of bounding box. | ||
- `align: TextAlignment` Value from the [`TextAlignment`](TextAlignment.md) enum for the alignment of text within bounding box. | ||
- `color: number` Color to use when drawing text. | ||
- `fi: FontInfo` Font to use. | ||
- `startChar: number` Starting character of string. | ||
- `spacing: number` Pixels to skip between lines. | ||
|
||
## Return value | ||
|
||
A `number` representing the next character that needs to be drawn; -1 if the text fits within bounding box. |