Skip to content
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

Text alignment should be with respect to descent and ascent lines rather than text bounding box #17

Closed
fryguybob opened this issue Aug 4, 2012 · 3 comments

Comments

@fryguybob
Copy link
Member

(Imported from http://code.google.com/p/diagrams/issues/detail?id=33. Original issue from byor...@gmail.com on June 8, 2011, 05:14:26 PM UTC)

Currently text is aligned with respect to its actual bounding box; instead, it ought to be aligned with respect to a box with left and right edges given by the bounding box and top and bottom edges given by the ascent and descent line of the font. (See
http://cairographics.org/tutorial/#L1understandingtext). The current approach means that different text elements placed next to each other are not vertically aligned. For example, this looks really bad:

{{{
letterBlock c = square # scale 1.5 <> text [c]

example = hcat $ map letterBlock ['a'..'z']
}}}

Also, the code for accomplishing this ought to be factored out of the cairo backend into diagrams-lib so other backends can make use of it.

@fryguybob
Copy link
Member Author

(Imported. Original comment by byor...@gmail.com on January 19, 2012, 10:04:50 PM UTC)

mgsloan fixed this incidentally to making some other improvements to the text API. Yay!

@fryguybob
Copy link
Member Author

(Imported. Original comment by felipe.l...@gmail.com on January 19, 2012, 10:15:40 PM UTC)

Where is this fix? I've looked at diagrams-core and diagrams-lib but didn't find anything.

@fryguybob
Copy link
Member Author

(Imported. Original comment by byor...@gmail.com on January 20, 2012, 02:19:56 PM UTC)

This was a bug specific to the cairo backend, so it's in diagrams-cairo: http://patch-tag.com/r/byorgey/diagrams-cairo/snapshot/hash/20111224013227-57657-9b40845a3aaa990c46a1a4839201e7e29a0af121/patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant