draw_callback_px in specified area

Using the Python code below which draws the text and shape shown in these screenshots, I want to clip the graphics outside the red box shown in my second image so it is not drawn.

Goal:

import bpy, blf, bgl, gpu

class Test_operator(bpy.types.Operator):
bl_idname = "object.test_operator"
bl_label = "test"

def draw_callback_px(self, op, context):
self.draw_rec(500, 800, 200, 400, (0.2,0.2,0.2,1.0)) # Window A
self.draw_rec(500, 800, 400, 428, (0.1,0.1,0.1,1.0)) # Title bar B
font_id = 1
blf.size(font_id, 53, 72)
blf.position(font_id, 500, 300, 0)
blf.draw(font_id, self.text)

def draw_rec(self, left, right, bottom, top, color):

vert = ((left, bottom), (left, top), (right, top), (right, bottom))

bgl.glEnable(bgl.GL_BLEND)
indices=((0, 1, 2), (0, 2, 3)))
bgl.glDisable(bgl.GL_BLEND)

def modal(self, context, event):
context.area.tag_redraw()
if event.type in {"ESC"}:
bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
return {'CANCELLED'}
return {'RUNNING_MODAL'}

def invoke(self, context, event):
self.text = "Hello World"

args = (self, context)
self.draw_callback_px, args, 'WINDOW', 'POST_PIXEL'
)
return {'RUNNING_MODAL'}

def register():
bpy.utils.register_class(Test_operator)
def unregister():
bpy.utils.unregister_class(Test_operator)
if __name__ == "__main__":
register()

• Is your goal to clip everything outside the precise red box you included in your second screenshot (which would cause the left vertical line of the "H" to disappear, as well as the right half of the "r", and the entire top darker part of the background rectangle)? Or is your red rectangle imprecise and your intention is to actually just clip text so it doesn't draw past the background rectangle? Jan 7 '21 at 9:06

        bgl.glEnable(bgl.GL_SCISSOR_TEST)