Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with a word that is too big. #9

Open
Victorinox13 opened this issue Apr 8, 2024 · 1 comment
Open

Issue with a word that is too big. #9

Victorinox13 opened this issue Apr 8, 2024 · 1 comment

Comments

@Victorinox13
Copy link

I came across a missing feature while running your code. The word it was processing was, counterintuitive. At first I tought I had a bug so I began debugging it.

` if id == 37:
print(text)
print(words)
while i < len(words):
words[i] = words[i].strip() ## REMOVES SPACES -> " hello " -> "hello"
if words[i] == "":
print(words[i])
print("is empty")
i = i+1
continue
if words[i] == " ":
print(words[i])
print("is empty")
i = i+1
continue

            length_in_pixels = (len(words[i]) + 1) * char_width 
            print("length in pixels: ", length_in_pixels, words[i])
            time.sleep(1)
            remaining_pixels = width - length_in_pixels
            print("remaining in pixels: ", remaining_pixels, words[i])

            #if remaining_pixels <= 0:

            time.sleep(1)
            line = words[i] 
            while remaining_pixels > 0:
                print("fired remaining while loop again")
                i =i+ 1 
                if i >= len(words):
                    print("i >= len(words")
                    time.sleep(1)
                    break
                length_in_pixels = (len(words[i]) + 1) * char_width
                remaining_pixels -= length_in_pixels
                if remaining_pixels < 0:
                    print("remaining_pixels < 0")
                    time.sleep(1)
                    continue
                else:
                    
                    line += " " + words[i]
                    time.sleep(1)
                    print(line)
            
            line_array = [line, int(start) + 15, int(len(line) / total_chars * total_frames) + int(start) + 15]
            start = int(len(line) / total_chars * total_frames) + int(start)
            lines.append(line_array)
            self.text_array.append(line_array)
         `

What I got then is:

This feels really counterintuitive.
['', 'This', 'feels', 'really', 'counterintuitive.']

is empty
length in pixels: 165 This
remaining in pixels: 381.29999999999995 This
fired remaining while loop again
This feels
fired remaining while loop again
remaining_pixels < 0
length in pixels: 231 really
remaining in pixels: 315.29999999999995 really
fired remaining while loop again
remaining_pixels < 0
length in pixels: 594 counterintuitive.
remaining in pixels: -47.700000000000045 counterintuitive.
length in pixels: 594 counterintuitive.
remaining in pixels: -47.700000000000045 counterintuitive.
length in pixels: 594 counterintuitive.
remaining in pixels: -47.700000000000045 counterintuitive.

You should make it a feature where the font scale is scaled down when remaining pixels goes negative.

@zubu007
Copy link
Owner

zubu007 commented Jul 10, 2024

Nice catch. Would you like to work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants