How can we render the unicode string? What would be a proper algorithm?
\nx = start_x\ny = start_y\nwith all glyph elements ge in the vector:\n print unicode ge.g at x,y\n x = x + ge.ax\n y = y + ge.ay\n
At least the above algorithm does not lead to a proper result. It looks more like this (first row):
\n
Also the scaling of ax and ay is not clear (in the screenshot ax/ay are divided by 4)
\nEdit: Fixed algorithm
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"You are spot on.
\nI don't know your system. You can connect back to the Unicode via the cluster cl
member of the json. See:
https://harfbuzz.github.io/clusters.html
","upvoteCount":0,"url":"https://github.com/harfbuzz/harfbuzz/discussions/5362#discussioncomment-13455236"}}}-
Thanks for providing hb-shape. It looks like a solution for our rendering problems in u8g2, but we are wondering how to use the JSON output of hb-shape. Also the manual at https://harfbuzz.github.io/utilities.html#utilities-command-line-hbshape does not really describe the meaning of the JSON result. The question is: How would a render algorithm look like, that makes use of the JSON output of hb-shape. Example (from olikraus/u8g2#2656) Goal is to render "नमस्ते" With [
{"g":2345,"cl":0,"dx":0,"dy":0,"ax":64,"ay":0,"xb":0,"yb":44,"w":64,"h":-40},
{"g":2351,"cl":1,"dx":0,"dy":0,"ax":64,"ay":0,"xb":0,"yb":44,"w":64,"h":-40},
{"g":2361,"cl":2,"dx":0,"dy":0,"ax":64,"ay":0,"xb":0,"yb":44,"w":64,"h":-40},
{"g":2382,"cl":2,"dx":0,"dy":0,"ax":0,"ay":0,"xb":-28,"yb":4,"w":16,"h":-12},
{"g":2341,"cl":4,"dx":0,"dy":0,"ax":64,"ay":0,"xb":0,"yb":44,"w":64,"h":-40},
{"g":2376,"cl":4,"dx":0,"dy":0,"ax":0,"ay":0,"xb":-52,"yb":56,"w":24,"h":-12}
] How can we render the unicode string? What would be a proper algorithm?
At least the above algorithm does not lead to a proper result. It looks more like this (first row): Also the scaling of ax and ay is not clear (in the screenshot ax/ay are divided by 4) Edit: Fixed algorithm |
Beta Was this translation helpful? Give feedback.
-
Accumulate ax and ay as you are, but draw each glyph at x+ge.dx and y+ge.dy. You might need to set font size on hb-shape. |
Beta Was this translation helpful? Give feedback.
You are spot on.
I don't know your system. You can connect back to the Unicode via the cluster
cl
member of the json. See:https://harfbuzz.github.io/clusters.html