Backport Pasky's changes concerning text_style-related stuff.