Resolves: #i124453# check if the resulting polygon...

has already exceeded the number of points (2^16) that can be handled by a tools
polygon

(cherry picked from commit 804e547d70552fd64e1344d538427f8898824b43)

Change-Id: I437a84493e264f7b650561599170e831da20c9aa
(cherry picked from commit a9582c05f854cad02710178ab7fa79498573269e)
(cherry picked from commit ab71a4512557b7290cd7b1b4923463052acf164e)
Related: #i124516# handle bad surrogate pairs gracefully on Windows

When running into invalid Unicode surrogate pairs the text layout code on
Windows ran into massive problems like crashes. This change detects the
situation of an invalid surrogate pair and falls back to treat it as
a simple character instead of requesting a complex glyph fallback.

(cherry picked from commit 913f1fc4b1362f6e91595af5ae10c4cba79fd355)

Change-Id: I2988f4b64061d0a5df211f6f0f04b1f235fcd6a5
(cherry picked from commit 67688d3118b1a361d5dbdaa78e918815c163d75c)