105 |
float scale) { |
float scale) { |
106 |
Object key = new Integer(start+1472); |
Object key = new Integer(start+1472); |
107 |
s = s.substring(start, end); |
s = s.substring(start, end); |
108 |
|
|
109 |
|
/** |
110 |
|
(Benja:) Ouch. The following line makes a great difference, even though |
111 |
|
that should really not be so. |
112 |
|
|
113 |
|
Without this line, on *my* system (though not Tuomas'!), the text vobs |
114 |
|
added by this method extend from 'start' till 's.length()'-- 'end' |
115 |
|
seems to be ignored. That is, if 's' is "Foo bar baz", 'start' is 4 |
116 |
|
and 'end' is 8, the text shown on the screen is not "bar ", as intended, |
117 |
|
but "bar baz". (The width used in linebreaking is "bar ", though.) |
118 |
|
|
119 |
|
This means two things, apparently: |
120 |
|
o My JVM handles substring() virtually, so 's.substring(start, end)' |
121 |
|
is not a copy of a part of 's', but a subrange of the memory range |
122 |
|
occupied by 's', starting at 'start' and spanning 'end-start' |
123 |
|
characters. '""+s', on the other hand, creates a copy of 's'. |
124 |
|
o Something on the C++ side does not respect the string length passed |
125 |
|
to it by the JVM (it presumably thinks the string is |
126 |
|
NUL-terminated). So, it displays all the text starting at 'start' |
127 |
|
till the end of 's'. |
128 |
|
|
129 |
|
Therefore, please don't remove the following line until you can be sure |
130 |
|
the bug explained above has been fixed... |
131 |
|
**/ |
132 |
|
s = ""+s; |
133 |
|
|
134 |
if(dbg) pa("addVobs: "+start+" "+end+" '"+s+"'"); |
if(dbg) pa("addVobs: "+start+" "+end+" '"+s+"'"); |
135 |
TextVob vob = new TextVob(style, scale, s, key); |
TextVob vob = new TextVob(style, scale, s, key); |
136 |
ch.addBox(vob); |
ch.addBox(vob); |