Skip to content

How to align the bottom of text naturally? #26

Description

@jeaye

Firstly, thanks for this very neat lib. I'm trying to use it to procedurally generate benchmarking charts for jank, a Clojure dialect on LLVM.

It looks like dali aligns the bottom of text based on the pixel, rather than where that text would sit on a line. This is made clear by introducing a y into some text. dali will shift up the position of the whole text, rather than letting the tail of the y sit "below the line".

Minimal example

[:dali/page {:font-size 15}
 [:dali/stack {:id :text-stack
               :position [20 20]
               :direction :right
               :gap 10}
  [:dali/align {:axis :bottom}
   [:rect {:fill :none} :_ [50 20]]
   [:text {} "Initial"]]
  [:dali/align {:axis :bottom}
   [:rect {:fill :none} :_ [50 20]]
   [:text {} "Initially"]]]

 [:dali/place {:relative-to [:text-stack :bottom]}
  [:line {:stroke :black}
   [0 0]
   [150 0]]]]

minimal example

Real world issue

This becomes an eye sore when I'm trying to generate bar charts, since not all of them are aligned (see "Initial" and "Tagged" below -- because of the "g").

bar chart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions