Skip to content

Commit c5aa36b

Browse files
committed
Readme: Mention possible values for text aligning
1 parent e7b4060 commit c5aa36b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,15 @@ Out of the box you can write text to your canvas like this:
417417
```js
418418
this.canvas.getContext('2d').fillStyle = '#ffffff'; // The color of the text you are going to be displaying
419419
this.canvas.getContext('2d').font = 'bold ' + (24) + 'pt Arial'; // Pattern: weight [size]size_unit font_name
420-
this.canvas.getContext('2d').textAlign = 'center';
421-
this.canvas.getContext('2d').textBaseline = 'middle';
420+
this.canvas.getContext('2d').textAlign = 'center'; // possible values: left, right, center, start (locale dependent), end (locale dependent)
421+
this.canvas.getContext('2d').textBaseline = 'middle'; // possible values: middle, top, bottom, alphabetic, hanging, ideographic
422422
this.canvas.getContext('2d').fillText('Hello Nin!', x_position_on_canvas, y_position_on_canvas);
423423
```
424424

425425
Beware that this will not replace any text previously drawn. To obtain a blank slate you have to either clear or draw over previously shown text.
426426

427+
Reference for styling of text drawn with `fillText`: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text#Styling_text .
428+
427429
## Linting
428430

429431
The frontend part of this project uses ESLint for linting.

0 commit comments

Comments
 (0)