summaryrefslogtreecommitdiff
path: root/sys/src/libdraw/stringwidth.c
AgeCommit message (Collapse)Author
2014-03-10libdraw: fix zero stringwidth() bugcinap_lenrek
stringwidth() and string() sometimes failed spuriously due to the wrong assumption that cachechars() will only fail when a different subfont is needed. in fact, cachechars() can fail for other reasons like when it resizes the fontcache (or fails todo so). theres also the case when loadchar() is unable to translate a character and returns 0. this case needs to be differentiated from such temporary conditions like fontcache resize or subfont load to stop the retry loop in string() and stringwidth(). now cachechars() returns -1 to indicate that it cannot proceed and we test this in string() and stringwidth() to skip over untranslatable characters to make progress instead of retrying.
2014-01-10libdraw: cleanup string() and stringwidth()cinap_lenrek
getting rid of the goto at the end of the while loop by moving the if(subfontnae) case before the cachechars() call.
2014-01-06libdraw: fix stringwidth problemscinap_lenrek
cachechars() used to skip over characters on its own when loadchar() could not find the character or a PJW replacement. this resulted in wrong width calculation. now we just return and handle the case inside _string and _stringwidth. fix subfont leak in stringwidth() remove annoying prints in stringwidth()
2011-09-05libdraw: fix old subfont leakcinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen