clone TextFormat on assignment

also fix a bug when calculating the TextLineMetrics