Text shaping is a complex problem, especially when scripts other than the simple western ones are involved. The current industry standard is HarfBuzz which is written in C++. Given that HarfBuzz uses reference counting as its memory-management technique, it is bound to have performance problems. Furthermore, the use of generic functions should result in simpler code.
This library should support at least OpenType fonts. These fonts contain shaping information that the library can use.