This may be partially done already, see Monotype.Line()->add_code().
Pretty sure this is done and working, but should verify.