Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-12-07 14:49:53 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-12-07 18:53:02 +0300
commite71d715b9b0c55aea7ef4fc88642eecd6e7b58c3 (patch)
tree1cd92998eb1c72ea11d1764025f4414787b90fa7 /docs
parente61cdf335f9d102621c37d0d366da61afa698c99 (diff)
Add custom font support to images.Text
Fixes #9253
Diffstat (limited to 'docs')
-rw-r--r--docs/content/en/functions/images/index.md16
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/content/en/functions/images/index.md b/docs/content/en/functions/images/index.md
index 274072dba..1cf69ee78 100644
--- a/docs/content/en/functions/images/index.md
+++ b/docs/content/en/functions/images/index.md
@@ -42,6 +42,8 @@ The above will overlay `$logo` in the upper left corner of `$img` (at position `
### Text
+{{< new-in "0.90.0" >}}
+
Using the `Text` filter, you can add text to an image.
{{% funcsig %}}
@@ -50,7 +52,7 @@ images.Text TEXT DICT)
The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
-```
+```go-html-template
{{ $img := resources.Get "/images/background.png"}}
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
"color" "#ffffff"
@@ -61,6 +63,18 @@ The following example will add the text `Hugo rocks!` to the image with the spec
))}}
```
+You can load a custom font if needed. Load the font as a Hugo `Resource` and set it as an option:
+
+```go-html-template
+
+{{ $font := resources.Get "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
+{{ $img := resources.Get "/images/background.png"}}
+{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
+ "font" $font
+))}}
+```
+
+
### Brightness
{{% funcsig %}}