buggins / dlangui

Cross Platform GUI for D programming language
Boost Software License 1.0
805 stars 120 forks source link

How to rotate text easily ? #639

Open xucs007 opened 1 year ago

xucs007 commented 1 year ago

If I draw a square MCU pad, with pins on 4 sides. Some pins I might want to label horizontally, others vertically. What's the best way to rotate text?

GrimMaple commented 1 year ago

I don't think dlangui features such a thing. I'm gonna have a closer look, but I don't think there's a solution out of hte box. Just to clarify, do you want a Widget (eg TextWidget) to draw vertically, or do you want a canvas to be able to draw vertical text?

xucs007 commented 1 year ago

Either way is fine. If you think TextWidget is easier to implement, just do it first.

In fact, C# WPF has a "transform" function, which can be applied to many widgets. But I guess that's more complicated to implement.

GrimMaple commented 1 year ago

I'm going to give this an enchancement label and I'll think about how to implement this. If you have ideas - I"ll be more than glad to accept a PR :)

xucs007 commented 1 year ago

Maybe the 2 draw() functions in graphics/fonts.d, can be added with a "direction" parameter, but I still don't know how to realize.

GrimMaple commented 1 year ago

I have investigated a bit. TextWidget uses DrawBuf anyway, so I think both should be updated at the same time. No idea when though