dbuenzli / vg

Declarative 2D vector graphics for OCaml
http://erratique.ch/software/vg
ISC License
91 stars 12 forks source link

How to right-align text? #24

Closed mjambon closed 5 years ago

mjambon commented 5 years ago

Assuming horizontal, left-to-right text, I couldn't find a way to place the right-end of the text where I want.

I wasn't sure where to ask the question, so I asked on StackOverflow. Feel free to delete this Github ticket.

PS: the library and its documentation is a real pleasure to use. Thank you.

dbuenzli commented 5 years ago

Basically Vg does not provide this, it's a low level API and I don't think it's the right place to provide it. A longer discussion about this here.

pveber commented 5 years ago

In case it may help, I reused a code written by @dbuenzli to form a module named Vg_text, which provides a function to calculate the length of a given text (I failed to expand this to height calculation though). This module can be found in a beta lib I'm working on.