-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CJK in images.Text, add width and height as optional args #11364
Comments
Yes, I can see how that would be useful (even for non CJK languages), but I'm not totally sure how the API would look like.
|
Thank you for having interest.
My first thought was to fit the page title in the blue border of the image.
Japanese is very difficult, so even Japanese people have different opinions on where to cut phrases and words (laughs).
The projects below may be helpful. I initially thought about using it, but it seemed incompatible with the environment I was using, so I wanted to use Hugo's functions. In the case of CJK, this project seems to be output as follows, and it seems that Japanese clauses are not conscious |
Yea, we could do something like that. I guess the left/top margin is somehow covered by the current x/y parameters. What if we make it And retire/alias x/y. |
Plan1I thought about several patterns, but I felt that the optimum was different depending on the person. # config.yaml
params:
opengraph:
x: 120 # images.Text x
y: 240 # images.Text y
bottom_right:
x: 1160
y: 590 Plan2On the other hand, while drawing a diagram, I thought that it might be easier to use if the {{- $img_base = $img_base.Filter (images.Text "あいうえおかき…" (
dict
"color" "#ffffff"
"size" 60
"linespacing" 2
"x" 120
"y" 240
"width" 1040
"height" 350
"font" $font
)
)
-}} Therefore, I personally think that Plan2 may be more beneficial for those who want to use it in the future, so how about this? |
I like plan 2, easy to understand. |
It will be nice, if If introduced, the modified plan 2 will look like this: {{- $img_base = $img_base.Filter (images.Text "あいうえおかき…" (
dict
"color" "#ffffff"
"size" 60
"linespacing" 2
"letterspacing" 1
"x" 120
"y" 240
"width" 1040
"height" 350
"font" $font
)
)
-}} |
It might be useful if some users want to have equally spaced letters in width and height boxes. |
When I started using Hugo, I was really drawn to the "images.Text" feature.
I'm trying to use this to generate images for the Open Graph Protocol.
Since it does not support CJK, it is in a state where it is not wrapped as shown below.
Workaround
As a workaround, it can be handled by separating with spaces at moderate intervals, but I thought it would be easier to use if you could define a text area like a CSS margin.
Could you consider adding it as a feature?
The text was updated successfully, but these errors were encountered: