Skip to content

Commit fdb3ec4

Browse files
committed
add more methods to the Text class
1 parent 5e6ca28 commit fdb3ec4

31 files changed

+697
-22
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ name: Changelog
33
index: 4
44
---
55

6+
## 3.6.0
7+
8+
- 🚀 Feat: Add method `setTextSize` to the Text-class
9+
10+
```java
11+
Text myText = new Text();
12+
myText.setTextSize(48);
13+
```
14+
15+
- 🚀 Feat: Allow custom fonts for Text-objects. Custom fonts can be added like a costume for a Sprite-object. Each Text-object does have a default font named `default`.
16+
17+
```java
18+
Text myText = new Text();
19+
myText.addFont("playful", "opensans.odt");
20+
myText.switchFont("playful");
21+
22+
// get the text-object, which is used for the think and speak bubble
23+
Text spriteText = new Sprite().getText();
24+
```
25+
26+
- 📝 Docs: Add example `Shakespeare` which shows the usage of the new methods of the Text-class
27+
628
## 3.5.0
729

830
- 💻 OS: Added Linux ARM 32-bit and ARM 64-bit versions

docs/de/book/examples/shakespeare.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Shakespeare
3+
lang: de
4+
---
5+
6+
# Shakespeare
7+
8+
Ein Beispiel, das die Nutzung der Text-Klasse zeigt.
9+
10+
![shakespeare example](/assets/shakespeare.gif)
11+
12+
## Quelltext
13+
14+
- Java: https://github.com/openpatch/scratch-for-java/tree/main/examples/java/Shakespeare
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"name": "addFont()",
5+
"scratchblock": "add font (name) (file path)",
6+
"class": "Text",
7+
"description": "Fügt eine Schriftart dem Text hinzu.",
8+
"syntax": [
9+
".addFont(name, filePath)"
10+
],
11+
"returns": "void",
12+
"parameters": [
13+
{
14+
"name": "name",
15+
"description": "Der Name der Schriftart",
16+
"type": "String"
17+
},
18+
{
19+
"name": "filePath",
20+
"description": "Der Pfad zur Schriftartdatei. Die Datei muss im ttf oder otf format vorliegen.",
21+
"type": "String"
22+
}
23+
]
24+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"scratchblock": "font [number v]",
5+
"name": "getCurrentFontIndex()",
6+
"class": "Text",
7+
"description": "Gibt den aktuellen index der Schriftart zurück.",
8+
"syntax": [".getCurrentFontIndex()"],
9+
"returns": "int"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"scratchblock": "font [name v]",
5+
"name": "getCurrentFontName()",
6+
"class": "Text",
7+
"description": "Gibt den Namen der aktuellen Schriftart zurück.",
8+
"syntax": [".getCurrentFontName()"],
9+
"returns": "String"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"scratchblock": "next font",
5+
"name": "nextFont()",
6+
"class": "Text",
7+
"description": "Wechselt die Schriftart zur nächsten in der Liste.",
8+
"syntax": [".nextFont()"],
9+
"returns": "void"
10+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"name": "setTextSize()",
5+
"class": "Text",
6+
"description": "Setzt die Größe des Textes.",
7+
"syntax": [".setTextSize(size)"],
8+
"returns": "void",
9+
"parameters": [
10+
{
11+
"name": "size",
12+
"description": "Die Größe des Textes",
13+
"type": "int"
14+
}
15+
]
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"template": "method",
3+
"related": [],
4+
"scratchblock": "switch font to [ v]",
5+
"name": "switchFont()",
6+
"class": "Text",
7+
"description": "Wechselt die Schriftart aus eine bestimmte.",
8+
"syntax": [".switchFont(name)"],
9+
"returns": "void",
10+
"parameters": [
11+
{
12+
"name": "name",
13+
"description": "Der Name der Schriftart",
14+
"type": "String"
15+
}
16+
]
17+
}

docs/de/public/assets/shakespear.gif

17.5 MB
Loading

docs/en/book/examples/shakespeare.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Shakespeare
3+
---
4+
5+
# Shakespeare
6+
7+
An example showing the use of the Text class.
8+
9+
![shakespeare example](/assets/shakespeare.gif)
10+
11+
## Source Code
12+
13+
- Java: https://github.com/openpatch/scratch-for-java/tree/main/examples/java/Shakespeare

0 commit comments

Comments
 (0)