diff options
author | Dees Troy <dees_troy@teamw.in> | 2014-02-25 21:35:56 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2014-02-26 15:52:05 +0100 |
commit | 31218ec952173a707f97cfb7c7211ab79d8471f1 (patch) | |
tree | 0732c1c27a0bbf5dc7703e463a65a1351412e1e0 /minuitwrp/graphics.c | |
parent | Remove unneeded logging (diff) | |
download | android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar.gz android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar.bz2 android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar.lz android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar.xz android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.tar.zst android_bootable_recovery-31218ec952173a707f97cfb7c7211ab79d8471f1.zip |
Diffstat (limited to 'minuitwrp/graphics.c')
-rw-r--r-- | minuitwrp/graphics.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c index ddff571fe..3a35c587c 100644 --- a/minuitwrp/graphics.c +++ b/minuitwrp/graphics.c @@ -311,6 +311,30 @@ int gr_measureEx(const char *s, void* font) return total; } +int gr_maxExW(const char *s, void* font, int max_width) +{ + GRFont* fnt = (GRFont*) font; + int total = 0; + unsigned pos; + unsigned off; + + if (!fnt) fnt = gr_font; + + while ((off = *s++)) + { + off -= 32; + if (off < 96) { + max_width -= (fnt->offset[off+1] - fnt->offset[off]); + if (max_width > 0) { + total++; + } else { + return total; + } + } + } + return total; +} + unsigned character_width(const char *s, void* pFont) { GRFont *font = (GRFont*) pFont; |