I agree with JJMack. Also, Adobe Illustrator could do that too.
Note: in your example, I feel that those gradients go too dark, for the text - I would have done a gradient, with only about 50% of the density, there - but that is just me.
Use Type Tool to create a large '2'.
Do Layer > Type > Convert to Shape.
Target the vector mask of the Shape.
Activate Rectangle Tool and ensure it is in Shape or Path mode and Add to Shape Area mode.
Draw a rectangle inside the targeted vector mask, with same height as the '2'.
Use Path Selection Tool tool to align rectangle and '2'. Snapping to guides dragged from the ruler may help with that.
Switch to Direct Selection Tool, right-click on left edge of rectangle path and pick Add Anchor Point from the context menu. Drag that new anchor and bottom-left anchor to make the shape below.