jashkenas / ruby-processing

Code as Art, Art as Code. Processing and Ruby are meant for each other.
http://github.com/jashkenas/ruby-processing/wikis
Other
1.28k stars 94 forks source link

Is there a text_width bug or what is wrong on this code? #77

Closed marcel12bell closed 10 years ago

marcel12bell commented 11 years ago

string = "dddddddddddddddd" textlen = text_width(string) text string, 100, 100 line 100+textlen, 89, 100+textlen, 102

string2 ="drawerrormmmmmmm" textlen2 = text_width(string2) text string2, 100, 120 line 100+textlen2, 109, 100+textlen2, 122

monkstone commented 11 years ago
def setup
  size 400, 200
  string = "dddddddddddddddd"
  textlen = text_width(string)
  text string, 100, 100
  stroke 0
  line 100+textlen, 89, 100+textlen, 102

  string2 ="drawerrormmmmmmm"
  textlen2 = text_width(string2)
  text string2, 100, 120
  line 100+textlen2, 109, 100+textlen2, 122
end

width

Looks OK to me!!!!

marcel12bell commented 11 years ago

screen

marcel12bell commented 11 years ago

... it only worked one time! now the same error. perhaps osx related buck? Update: I'm getting closer to reproduce the right display...

Answer: It's not "stroke 0". And the short example code did not work here, but in my app I had to change the size option and put it also in the draw methode...

monkstone commented 11 years ago

v. strange your display did look a bit wonky in the first place note, how my line really matches text. If you have a retina display you really need 7u40 java, even then I'm not sure processing guys fixed it. Here is link that might help? @marcel12bell https://forum.processing.org/topic/strange-textwidth-behavior-ideas

monkstone commented 10 years ago

@marcel12bell can you check if the problem persist with latest release (2.3.0)

marcel12bell commented 10 years ago

I had to update the sha1 checksum for processing-2.1 and jruby in the rakefile, there where recent updates... After installing the new version the problem still persists. Sorry for the news...

monkstone commented 10 years ago

@marcel12bell Thanks for checking, I know where I went wrong with the checksum, I corrected checksum in master first. But then I needed to check the Rakefile (in my develop), because zipped folders had changed. So I copied develop Rakefile over master (reversing my checksum doh!).
Just for completeness I re-ran above test on linux, and now I see slight error myself, black-line inside leg of last 'm' clearly not as bad as your case, but an error. However when I use P2D renderer (instead of default JAVA2D), alignment is spot on again. This won't help you because in my experience watch does not work with P2D renderer.

monkstone commented 10 years ago

The P2D renderer is now usable with rp5 watch (using development version of processing ie pre processing-1.1.2 and the latest ruby-processing from rubygems.org). I just retested above code with both P2D and Java2D (on my linux box) and alingment was good with both. @marcel12bell

marcel12bell commented 10 years ago

cool, I'll check it next week!

monkstone commented 9 years ago

Hi @marcel12bell if you are still interested @benfry reports that processing-3.0 is working OK https://github.com/processing/processing/issues/2175#issuecomment-130485239 to use that you will need to use JRubyArt instead of ruby-processing, which is staying on processing-2.2.1.