Skip to content

Commit

Permalink
a little more on text geometry interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
machenmusik committed Jan 27, 2017
1 parent 7d004de commit 3915324
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions docs/components/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,39 @@ or the text can auto-scale the geometry to fit the text.
[geometryimg]: https://cloud.githubusercontent.com/assets/674727/22358470/218689d6-e3f4-11e6-9e00-62c9cb7867da.png
![Geometry Alignments][geometryimg]

To have the geometry automatically scale with the text, set the geometry
component's `width` and `height` properties to `auto`:
To have the text component's `width` property automatically scale
to match the geometry component's `width`, do not specify a `width`
for the text component:

```html
<a-entity
<a-entity position="0 1 -2"
geometry="primitive: plane; width: 4; height: auto"
material="color: blue"
text="value: This text will be 4 units wide."></a-entity>
```

To have the geometry automatically scale with the text,
set the geometry component's `width` and `height` properties to `auto`,
and set the text component's `width` as desired.
In this example, the plane's `width` will be set to 4 units,
and its `height` will be set to match the actual height of the text:

```html
<a-entity position="0 1 -2"
geometry="primitive: plane; height: auto; width: auto"
text="value: Auto scale!"></a-entity>
material="color: blue"
text="width: 4; value: This text will be 4 units wide."></a-entity>
```

Note that if neither `geometry` nor `text` specify a width,
the text `width` property will default to 1 unit (meter),
and the geometry `width` property will then become 1 unit as well.

```html
<a-entity position="0 1 -2"
geometry="primitive: plane"
material="color: blue"
text="value: 1-wide\ndefault."></a-entity>
```

### Custom Fonts
Expand Down

0 comments on commit 3915324

Please sign in to comment.