Protect against invalid text.

SkFont::countText returns -1 to let the user know that the text was not
valid in the encoding specified. Users need to check for this and act
appropriately. Otherwise in debug and assert will probably fire and in
release unexpected things may happen.

Change-Id: I6ce91aa3d978fe5265b659f759b4023b81da261f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258639
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
3 files changed