Hey everyone, I’ve been working with the graphics object to create a print layout, and could really use some tips since I am entirely new to graphics. I was mainly wondering if people enter the xy coordinates explicitly for each line of text, or if they tend to use some sort of counter to keep track of that.
Like I said, I am entirely new to this graphics stuffs, and could use any tips you have in general
Thanks!
Thank you Dave and Martin.
Dave, even though it is crude, your example really points me in the right direction.
Martin, thanks for the suggestion, I’ll have to look into that book a little bit
If you’re going to draw circles and curves, it’s almost impossible to get sharp/smooth edges.
A very easy trick I use is; Instead of drawing straight on the Canvas, I create a larger picture and then draw the final resized picture on the canvas.
@Tim Hare
Not sure if this is the same thing but I’m currently struggling with properly Top -Aligning text in a canvas. Whatever I try, I always have some blank space above the characters.
How do you calculate the baseline? And is that the real baseline or the descent?
TextAscent is the baseline… but most fonts have some space above even the tallest characters…
One thing I have found, is that OSX measures everything in POINTS (regardless of what you set TEXTUNIT to) and Windows uses Points or Pixels (but Integer values only), AND the sizes are NOT consistent between the two
Hmm… I can’t argue because you’re the expert in this but I thought ‘textascent’ is the distance between the baseline (somewhere close to the bottom) and the textheight/top.
So I figured that the filler space at the top is the same space between baseline and bottom. That’s why I jumped when Tim said he was able to calculate baseline.
And about the difference between windows and OSX, that’s not cool.
We need some better framework tools to work with this because it’s a real pita now.
That space above your text is room for diacritical marks above a capital letter. TextAscent gives you a true baseline. The text sits on that line, with descenders going below it. I’ve never had any trouble aligning text given the tools Xojo provides, but then, my needs are probably different than yours.
From what I can see, TextAscent reflects correctly the instructions in the fonts. As Tim said, it does not reflect the top of uppercase characters, but the top of accents above them.
On Canvas, the results are identical as far as I can tell with identical fonts.
Where issues start presenting is with controls, singularly labels, where text does not appear at the same position to the top.
I do not believe it is the fault of Xojo, since they use the native controls, but simply the result of differences betweens platforms.
One solution I found was to use a ContainerControl subclass on Windows, where not only the label is transparent as default, but also where the label is positioned so it renders the same way as on Mac.
Id say it depends on the target platform. On iOS and OS X, InterpolationQuality, Flatness and FontSmoothing (if you declare them) should allow good quality without oversampling, and Im almost certain the other platforms have similar features too. But without declares or plug-ins: Yes, tricky at least.