Open sbinet opened 9 years ago
additionally, migrating from code.google.com/p/jamslam-freetype-go
to github.com/golang/freetype
would perhaps help reducing dependency creep (at least from gonum/plot
point of view as one of our dependencies is already using the github.com/golang/freetype
package)
(gentle) ping? is this repo still maintained?
@sbinet It is, but it's going to move slowly. This in particular might take me some time to do, because freetype is also used in Wingo.
ok. thanks for the update :)
My comment from duplicate #32:
It seems that the package requires the Context.MeasureString method which iirc was not available in "code.google.com/p/freetype-go/freetype".Context. I assume this was the original reason the "jamslam-" variant was used.
I have had similar requirements in the past. And I have used "jamslam" to meet them. Most recently when dealing with and trying to avoid code.google.com I found that I could achieve the MeasureString functionality by combining "github.com/golang/freetype" and "golang.org/x/image/font". You can look at my code. There is some weird rendering stuff going on in that program. But if you just trace back the types from the call site it should be fairly straightforward.
I think what it would boil down to in xgraphics/text.go would be something like the following (with some additional logic to create a font.Drawer):
w := f.MeasureString(text) h := int(c.PointToFixed(fontSize) >> 6)
The height calculation is basically the same thing that "jamslam" is doing.
@bmatsuo Thanks for that comment, that's really helpful. I'll make sure to get this fixed up soon. (I'm still using and relying on go get
to work day-to-day, so it'll really get fixed.)
FYI, I am "jamslam." :P It was an old nick of mine. Worst case scenario, I'll just put that code on Github.
FYI, I am "jamslam."
:open_mouth: Your code is prolific @BurntSushi (edit: :wink:).
Is your primary concern not breaking wingo? Have you considered vendoring its dependencies? If not with GO15VENDOREXPERIMENT
than godep
can allow the command to remain available though go get
using import path rewrites.
I haven't used xgraphics or related packages. But at a naive glance it doesn't seem too difficult to make the change. I could potentially write a pull request if you want.
@bmatsuo That is pretty much my primary concern. And AFAIK, there are others using xgbutil
, so I don't want to break them either. Unfortunately, I never quite figured out how to write good tests for X, so everything has to be tested by me manually. In retrospect, that was a really big mistake, because I am a huge bottleneck.
If you want to submit a PR, that'd be awesome. But I will find a way to fix it either way (I cannot live without Wingo), and your comment was already helpful enough, so don't sweat it!
time's up.
is anybody working on this?
if not, I'll try to give a stab at it following https://github.com/BurntSushi/xgbutil/issues/30#issuecomment-157301674
(in the meantime, I had to remove gonum/plot
support for x11
as it was failing our travis builds)
@sbinet Gah, I fell way behind. I might be able to get to it this weekend. But yes, I'll be forced to do it at some point since I need go get
to work for Wingo.
I at least have the build working again by importing graphics-go and freetype-go into github in commit 41e40dc1422bc8d5fd2de329c5621234bc3be17e. I didn't actually migrate to updates in the API though, so I'll leave this issue open, but hopefully it's enough to get gonum/plot
working again on x11!
I know it's been years, but here's an attempt to make the switch: https://github.com/jezek/xgbutil/pull/2 🙂.
with the move of
code.google.com/p/go-freetype
togithub.com/golang/freetype
there has been some API changes, namely the move togolang.org/x/image/math/fixed
to express font sizes.more info here: https://groups.google.com/d/topic/golang-nuts/tr-MftD7kbo/discussion
could you please migrate to that new API? it's blocking
gonum/plot
: gonum/plot#216thanks.