Closed cbrake closed 5 years ago
re: MeasureString
not returning the actual value - do you have an example of that?
Looking at the code I think there may be a bug in the fixed-width code that gives an extra pixel when drawing to characters that use the full "charWith" - the measurement code short-circuits drawing for fixed-width fonts so that would cause this difference. I'd rather fix the bug than cement the behavior in docs!
Let's not add the doc.go to cmd though, it's really just a workaround for godoc's quirks. Since fontgen
isn't intended to be a general tool I don't think it is important to expose it in docs.
Thanks for contributing!
yes, agreed it would be best if MeasureString is accurate, so I'll take another look at that. I was not sure what you intended.
Fine on doc.go.
May be a bit until I get back around to this, but I'll try to get back to you.
I just copy-pasta'd DrawRune's head to MeasureRune - does that address it?
Your change to DrawRune does not seem to fix it. I added example code to this branch:
https://github.com/cbrake/pixfont/tree/tightpixel15-example
You can run the test by:
go run examples/tightpixel15/*
In the example I'm rendering the string: "ai"
It is returning the same width for each character.
(using go 1.11 here)
ok thanks for that test case, it definitely helped narrow it down. I believe 3716a538 fixes that issue! source of the problem was actually the initial value of bitMask
and not w
- whoops.
that fixes it -- cleaning up pull request now ...
pull request updated to address concerns in your 1st comment. Thanks for the MeasureString fix!
library is working great -- thanks!