openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.95k stars 2.55k forks source link

ofDrawBitmapString draws from bottom left #271

Open kylemcdonald opened 13 years ago

kylemcdonald commented 13 years ago

bottom left corner is inconsistent with every other drawing command in OF, should be top left instead.

ofTheo commented 13 years ago

arggg - that will break so much!! :)

.... but agreed, logic makes sense. however it would be a SUPER rough one to change. hmm, Zach, Arturo??

kylemcdonald commented 13 years ago

yeah unlike ofSetColor, which is confined to only a handful of the apps, ofDrawBitmapString shows up in pretty much everything. including ofxControlPanel ;)

but i think for consistency's sake this is something that should be changed. for some of these smaller issues that are non-backwards-compatible, maybe it's best to just get a few people together some day and do a wardrive through the OF core.

arturoc commented 13 years ago

what about this? now tht ofDrawBitmapString has some options perhaps it can be a parameter? the default would be top left but it could be changed to bottom left for backwards compatibility

ofTheo commented 13 years ago

@arturoc hmm I disagree - both ttf and ofDrawBitmapString do bottom left for a good reason. baseline is the normal reference point for drawing with type.

processing defaults to baseline ( which is what we have ). see: http://processing.org/reference/textAlign_.html

I think an equivilant of text align could be VERY useful though. ( centered text etc )

arturoc commented 13 years ago

mmh, yeah that makes sense. we should move to a higher level library like pango and solve also utf issues anyway, not for 007 though : )

El dom, 13-03-2011 a las 14:11 -0700, ofTheo escribió:

@arturoc hmm I disagree - both ttf and ofDrawBitmapString do bottom left for a good reason. baseline is the normal reference point for drawing with type.

processing defaults to baseline ( which is what we have ). see: http://processing.org/reference/textAlign_.html

I think an equivilant of text align could be VERY useful though. ( centered text etc 0

https://github.com/openframeworks/openFrameworks/issues/271#comment_866867

kylemcdonald commented 13 years ago

yeah, i've reversed my position on this now as well -- i'm with theo, it should be 'baseline' rendering, same as processing's default. but the other options would be very welcome. i suggest 008 be dedicated solely to utf compatibility, and 009 solely to namespace migration ;)

kylemcdonald commented 13 years ago

i was just working with ofDrawBitmapString() and i'm not convinced it's actually at 'baseline' right now.

http://i52.tinypic.com/2ugjrex_th.png

that's from this code:

ofBackground(0);
ofSetColor(255);
ofNoFill();
ofRect(100, 100, 100, 100);
ofDrawBitmapString("++||--__qpgFy\nM\n*\n`\n~\n^\n%\n#\n,\n-", 100, 100);

so it's actually 2 pixels too low. or 3 depending on where you think the _ should be.

this explains why, whenever you try to draw text on a line, or on a rect, it always intersects it rather than sitting on top... i'm sure you ran into this, theo, while working on ofxControlPanel... :)

rdwong commented 8 years ago

So... I guess no central text alignment on ofDrawBitmapString? 😄

oxillo commented 4 years ago

Hi,

We are trying to clean out the many issues that we have. Many versions of OF have been released since this was issued.

Can you help us by checking if this issue is still present in the latest version ?

In case of inactivity, we'll close this issue by end of january, 2020.

Thanks

bakercp commented 4 years ago

This is still an issue but should be considered alongside a deprecation strategy as part of a 1.0 strategy as it would have a lot of repercussions.