Factorize createSubcontext in TypeWriter to avoid code duplication