# Processing text shifting issue

**URL:** <https://discourse.processing.org/t/processing-text-shifting-issue/20307>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [April 30, 2020, 4:50pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307 "2020-04-30T16:50:42Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 4:50pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/1 "2020-04-30T16:50:42Z")

</div>

Hi i have issue with text() command

[![](https://gebreee.000webhostapp.com/ques.png) ](https://gebreee.000webhostapp.com/ques.png)

 ![qu](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ea50945ee16fd925c8fae82fa217d6745a3d06e1.png)

here is a sorce code

//Ascii Video Player  
String[] video;  
int heig,widt;  
int d;  
int textSizes=7;  
void setup(){  
size(800,600);  
video = loadStrings(“sss.txt”);  
frameRate(30);  
String[] s = split(video[0],’,’);  
d=0;  
heig=int(s[1]);  
widt=int(s[0]);  
// println(“Playing audio”);  
.// println(“audio is started”);  
textSize(textSizes);  
//textAlign(CENTER);  
}  
void draw(){  
background(255);  
fill(0);  
drawScreen();  
//d+=1;  
}  
void keyPressed(){  
println(d);  
if(key == ’ '){  
d=287;  
}  
}  
void drawScreen(){  
try{  
for(int i=0;i\<heig;i++){  
text(video[d_heig+i],20,i_textSizes);  
}  
}catch(ArrayIndexOutOfBoundsException e){  
d=0;  
}  
}

I looked into sss.txt file and it looks in there just fine.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 4:55pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/2 "2020-04-30T16:55:09Z")

</div>

Welcome to the forum! Could you please describe what issue you are having exactly?

Also please show us the contents of `sss.txt`.

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:01pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/3 "2020-04-30T17:01:23Z")

</div>

i already shown

 ![qu](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ea50945ee16fd925c8fae82fa217d6745a3d06e1.png)

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:03pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/4 "2020-04-30T17:03:37Z")

</div>

Ah, okay. Still, what is the error you are facing?

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:05pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/5 "2020-04-30T17:05:53Z")

</div>

Maybe i should show more pictures to describe the issue

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 30, 2020, 5:09pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/6 "2020-04-30T17:09:02Z")

</div>

Perhaps you should explain in words rather than relying on members making the correct assumptions from the pictures.

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:11pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/7 "2020-04-30T17:11:12Z")

</div>

The main issue is that the text keeps shiffting to the right, but in the file there isn’t any spaces or aditional characters.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:12pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/8 "2020-04-30T17:12:29Z")

</div>

So you are reading the text from a file, and when you’re trying to display it in Processing it is shifted to the right?

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:15pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/9 "2020-04-30T17:15:05Z")

</div>

yes, that’s exactly what i was talking about.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:19pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/10 "2020-04-30T17:19:43Z")

</div>

Then you need to give as the contents of `sss.txt` **as text, not an image** because without that your code just straight up crashes.

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:30pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/11 "2020-04-30T17:30:28Z")

</div>

[https://gebreee.000webhostapp.com/sss.txt](https://gebreee.000webhostapp.com/sss.txt)

I’m not going to give a whole file because it’s like 160 megs.

For some reason it shifts there to.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:34pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/12 "2020-04-30T17:34:15Z")

</div>

> [@some](#):
>
> there isn’t any spaces or aditional characters

> [@some](#):
>
> For some reason it shifts there to

That’s probably because there actually are spaces in the file. How else would it be indented in the file directly?

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:35pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/13 "2020-04-30T17:35:10Z")

</div>

o i mean it’s because of my browser window. I think

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:36pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/14 "2020-04-30T17:36:26Z")

</div>

There are actual spaces before every line in the text file.

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:37pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/15 "2020-04-30T17:37:25Z")

</div>

Take a look in the file as a source code.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:40pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/16 "2020-04-30T17:40:21Z")

</div>

What do you mean by as source code? Just in regular text-editor? Because I’ve done that.

---

<div class="post-metadata">

**Author:** ![some](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@some](https://discourse.processing.org/u/some)\
**Post date:** [April 30, 2020, 5:42pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/17 "2020-04-30T17:42:28Z")

</div>

like that

before url add view-source:

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 30, 2020, 5:45pm UTC](https://discourse.processing.org/t/processing-text-shifting-issue/20307/18 "2020-04-30T17:45:12Z")

</div>

I’m sorry, but I don’t think I can help you.
