<commit_before>import sys
import os
import time

from pyglet.window import *
from pyglet.window.event import *
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
from pyglet import text

from ctypes import *

w1 = Window(width=400, height=200)

sample = text.layout_html('''<font size="26"><i>Hello</i>,
    <b>World</b>.<br>gVAWAVA. <b><i>Mr.</i></b> T.</font>''')

exit_handler = ExitHandler()
w1.push_handlers(exit_handler)

c = clock.Clock(10)

glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0, w1.width, 0, w1.height, -1, 1)
glEnable(GL_COLOR_MATERIAL)

glMatrixMode(GL_MODELVIEW)
glClearColor(1, 1, 1, 1)
r = 0

while not exit_handler.exit:
    c.tick()
    w1.dispatch_events()

    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()

    text.begin()
    sample.draw((200, 100), (text.Align.center, text.Align.center))
    text.end()

    w1.flip()
<commit_msg>fix text_test example<commit_after>import sys
import os
import time

from pyglet.window import *
from pyglet.window.event import *
from pyglet.GL.VERSION_1_1 import *
from pyglet import clock

from pyglet.text import *
from pyglet.layout import *

from ctypes import *

w = Window(width=400, height=200)

layout = render_html('''<p style="font-size: 26px"><strong>hello</strong>
    <em>world</em></p>''')
layout.render_device.width = 400
layout.render_device.height = 200
layout.layout()

exit_handler = ExitHandler()
w.push_handlers(exit_handler)

c = clock.Clock(10)

glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0, w.width, 0, w.height, -1, 1)
glMatrixMode(GL_MODELVIEW)
glClearColor(1, 1, 1, 1)

while not exit_handler.exit:
    c.tick()
    w.dispatch_events()

    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()

    glTranslatef(10, 100, 0)#, (text.Align.center, text.Align.center))
    layout.draw()

    w.flip()

{'fraction_non_alphanumeric': 0.13908355795148247, 'fraction_numerical': 0.03611859838274933, 'mean_word_length': 4.693251533742331, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514363', 'n_tokens_mistral': 763, 'n_tokens_neox': 707, 'n_words': 148}