summaryrefslogtreecommitdiffstats
path: root/minuitwrp/truetype.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-10-05 17:16:27 +0200
committerDees Troy <dees_troy@teamw.in>2015-10-16 22:57:35 +0200
commitb7a54a30167f211647222c0a2f90b369e0e33e32 (patch)
treefa6464e7a16456936de1cfaa087fcfc2f9564ff2 /minuitwrp/truetype.c
parentUnion sepolicy within TWRP to make SELinux permissive (diff)
downloadandroid_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar.gz
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar.bz2
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar.lz
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar.xz
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.tar.zst
android_bootable_recovery-b7a54a30167f211647222c0a2f90b369e0e33e32.zip
Diffstat (limited to 'minuitwrp/truetype.c')
-rw-r--r--minuitwrp/truetype.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/minuitwrp/truetype.c b/minuitwrp/truetype.c
index 8f62ff26b..d9ed0198b 100644
--- a/minuitwrp/truetype.c
+++ b/minuitwrp/truetype.c
@@ -265,6 +265,21 @@ exit:
return res;
}
+void *gr_ttf_scaleFont(void *font, int max_width, int measured_width)
+{
+ if (!font)
+ return NULL;
+
+ TrueTypeFont *f = font;
+ float scale_value = (float)(max_width) / (float)(measured_width);
+ int new_size = ((int)((float)f->size * scale_value)) - 1;
+ if (new_size < 1)
+ new_size = 1;
+ const char* file = f->key->path;
+ int dpi = f->dpi;
+ return gr_ttf_loadFont(file, new_size, dpi);
+}
+
static bool gr_ttf_freeFontCache(void *key, void *value, void *context)
{
TrueTypeCacheEntry *e = value;