summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2014-09-07 15:01:56 +0200
committerDees Troy <dees_troy@teamw.in>2014-10-14 15:06:56 +0200
commit76ee903d84d5b477016fb6ed6bdee1a21e237903 (patch)
treeb5e773d53ce727911db18ba12d1e96b690c78c54 /gui
parentFix exfat-fuse handling (diff)
downloadandroid_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar.gz
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar.bz2
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar.lz
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar.xz
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.tar.zst
android_bootable_recovery-76ee903d84d5b477016fb6ed6bdee1a21e237903.zip
Diffstat (limited to 'gui')
-rw-r--r--gui/Android.mk11
-rw-r--r--gui/console.cpp2
-rw-r--r--gui/devices/1024x600/res/ui.xml2
-rw-r--r--gui/devices/1024x768/res/ui.xml2
-rw-r--r--gui/devices/1080x1920/res/ui.xml6
-rw-r--r--gui/devices/1200x1920/res/ui.xml6
-rw-r--r--gui/devices/1280x800/res/ui.xml2
-rw-r--r--gui/devices/1440x2560/res/ui.xml6
-rw-r--r--gui/devices/1600x2560/res/ui.xml6
-rw-r--r--gui/devices/1920x1200/res/ui.xml2
-rw-r--r--gui/devices/240x240/res/ui.xml6
-rw-r--r--gui/devices/2560x1600/res/ui.xml2
-rw-r--r--gui/devices/280x280/res/ui.xml6
-rw-r--r--gui/devices/320x320/res/ui.xml6
-rw-r--r--gui/devices/320x480/res/ui.xml6
-rw-r--r--gui/devices/480x800/res/ui.xml6
-rw-r--r--gui/devices/480x854/res/ui.xml6
-rw-r--r--gui/devices/540x960/res/ui.xml6
-rw-r--r--gui/devices/720x1280/res/ui.xml6
-rw-r--r--gui/devices/800x1280/res/ui.xml6
-rw-r--r--gui/devices/800x480/res/ui.xml2
-rw-r--r--gui/devices/common/res/fonts/RobotoCondensed-Regular.ttfbin0 -> 125332 bytes
-rw-r--r--gui/fileselector.cpp2
-rw-r--r--gui/input.cpp2
-rw-r--r--gui/listbox.cpp2
-rw-r--r--gui/partitionlist.cpp2
-rw-r--r--gui/resources.cpp67
-rw-r--r--gui/resources.hpp9
-rw-r--r--gui/slidervalue.cpp2
-rw-r--r--gui/text.cpp2
30 files changed, 133 insertions, 58 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index 52d5f5573..baae3edf8 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -59,6 +59,9 @@ endif
ifeq ($(TW_OEM_BUILD), true)
LOCAL_CFLAGS += -DTW_OEM_BUILD
endif
+ifeq ($(TW_DISABLE_TTF), true)
+ LOCAL_CFLAGS += -DTW_DISABLE_TTF
+endif
ifeq ($(DEVICE_RESOLUTION),)
$(warning ********************************************************************************)
@@ -104,6 +107,13 @@ ifeq ($(TW_CUSTOM_THEME),)
else
TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
endif
+
+ifeq ($(TW_DISABLE_TTF), true)
+ TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)/res/fonts/*.ttf
+else
+ TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)/res/fonts/*.dat
+endif
+
TWRP_RES_GEN := $(intermediates)/twrp
ifneq ($(TW_USE_TOOLBOX), true)
TWRP_SH_TARGET := /sbin/busybox
@@ -116,6 +126,7 @@ $(TWRP_RES_GEN):
cp -fr $(TWRP_RES_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)/res/
cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)/res/
$(TWRP_COMMON_XML)
+ $(TWRP_REMOVE_FONT)
mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
diff --git a/gui/console.cpp b/gui/console.cpp
index 897c58203..aad392ca3 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -177,7 +177,7 @@ GUIConsole::GUIConsole(xml_node<>* node) : GUIObject(node)
}
}
- gr_getFontDetails(mFont, &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
SetActionPos(mRenderX, mRenderY, mRenderW, mRenderH);
SetRenderPos(mConsoleX, mConsoleY);
return;
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index 87248a686..4d6f3178f 100644
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index 407e18b31..29f169089 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml
index 0d547a6e9..95c48a513 100644
--- a/gui/devices/1080x1920/res/ui.xml
+++ b/gui/devices/1080x1920/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-40" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-40" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-40" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml
index 0778692c7..428880d76 100644
--- a/gui/devices/1200x1920/res/ui.xml
+++ b/gui/devices/1200x1920/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-40" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-40" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-40" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index bfb1a3a3a..6f6c2bd36 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1440x2560/res/ui.xml b/gui/devices/1440x2560/res/ui.xml
index ae25d33c8..fe55dfdbf 100644
--- a/gui/devices/1440x2560/res/ui.xml
+++ b/gui/devices/1440x2560/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-50" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-50" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-50" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="50" fallback="Roboto-Condensed-50" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="50" fallback="Roboto-Condensed-50" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="50" fallback="Roboto-Condensed-50" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1600x2560/res/ui.xml b/gui/devices/1600x2560/res/ui.xml
index 9703881e3..8561b2ddf 100644
--- a/gui/devices/1600x2560/res/ui.xml
+++ b/gui/devices/1600x2560/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-40" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-40" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-40" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Condensed-40" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index d8d8a7d5b..3e8c9f13f 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-30" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Regular-30" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml
index 4cc25dd87..294e5951b 100644
--- a/gui/devices/240x240/res/ui.xml
+++ b/gui/devices/240x240/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-12" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-12" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-12" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index ca0d8838e..cb0c12e1f 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-40" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="40" fallback="Roboto-Regular-40" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/280x280/res/ui.xml b/gui/devices/280x280/res/ui.xml
index 5a705a0e9..99532edcb 100644
--- a/gui/devices/280x280/res/ui.xml
+++ b/gui/devices/280x280/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-12" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-12" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-12" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="12" fallback="Roboto-Condensed-12" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/320x320/res/ui.xml b/gui/devices/320x320/res/ui.xml
index a9be8c985..f66852942 100644
--- a/gui/devices/320x320/res/ui.xml
+++ b/gui/devices/320x320/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-14" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-14" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-14" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-14" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-14" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-14" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index 57baf5ff3..cccd5b3b4 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-16" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-14" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-14" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-16" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-14" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="14" fallback="Roboto-Condensed-14" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index aad982291..940ad4333 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
- <resource name="mediumfont" type="font" filename="Roboto-Regular-20" />
- <resource name="filelist" type="font" filename="Roboto-Regular-20" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index ea0cf77cd..dce1d8843 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
- <resource name="mediumfont" type="font" filename="Roboto-Regular-20" />
- <resource name="filelist" type="font" filename="Roboto-Regular-20" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index 58d6c9df6..37c3e26d5 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Regular-20" />
- <resource name="mediumfont" type="font" filename="Roboto-Regular-20" />
- <resource name="filelist" type="font" filename="Roboto-Regular-25" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-20" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="20" fallback="Roboto-Regular-25" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="qhd-menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index f44998f66..a7ff19285 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-30" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-30" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-30" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index b074931b6..e0036bfc5 100644
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -14,9 +14,9 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-30" />
- <resource name="mediumfont" type="font" filename="Roboto-Condensed-30" />
- <resource name="filelist" type="font" filename="Roboto-Condensed-30" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
+ <resource name="mediumfont" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
+ <resource name="filelist" type="font" filename="RobotoCondensed-Regular.ttf" size="30" fallback="Roboto-Condensed-30" />
<resource name="top_bar" type="image" filename="top-bar.jpg" />
<resource name="main_button" type="image" filename="menu-button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index 0ee0e94fc..9acb7a112 100644
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -14,7 +14,7 @@
</include>
<resources>
- <resource name="font" type="font" filename="Roboto-Condensed-16" />
+ <resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="16" fallback="Roboto-Condensed-16" />
<resource name="base" type="image" filename="background.jpg" />
<resource name="main_button" type="image" filename="button" />
<resource name="file_icon" type="image" filename="file" />
diff --git a/gui/devices/common/res/fonts/RobotoCondensed-Regular.ttf b/gui/devices/common/res/fonts/RobotoCondensed-Regular.ttf
new file mode 100644
index 000000000..b9fc49c95
--- /dev/null
+++ b/gui/devices/common/res/fonts/RobotoCondensed-Regular.ttf
Binary files differ
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 4f90ca3a8..cf7a9a908 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -333,7 +333,7 @@ GUIFileSelector::GUIFileSelector(xml_node<>* node) : GUIObject(node)
}
// Retrieve the line height
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
mLineHeight = mFontHeight;
mHeaderH = mFontHeight;
diff --git a/gui/input.cpp b/gui/input.cpp
index 61b0cff1f..84ee17b16 100644
--- a/gui/input.cpp
+++ b/gui/input.cpp
@@ -139,7 +139,7 @@ GUIInput::GUIInput(xml_node<>* node)
attr = child->first_attribute("resource");
if (attr) {
mFont = PageManager::FindResource(attr->value());
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
}
}
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index e09ec5391..851b37348 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -271,7 +271,7 @@ GUIListBox::GUIListBox(xml_node<>* node) : GUIObject(node)
}
// Retrieve the line height
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
mLineHeight = mFontHeight;
mHeaderH = mFontHeight;
diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp
index 317e17805..2d464e1b6 100644
--- a/gui/partitionlist.cpp
+++ b/gui/partitionlist.cpp
@@ -273,7 +273,7 @@ GUIPartitionList::GUIPartitionList(xml_node<>* node) : GUIObject(node)
}
// Retrieve the line height
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
mLineHeight = mFontHeight;
mHeaderH = mFontHeight;
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 8d430b1ec..4fce0ca44 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -65,27 +65,82 @@ FontResource::FontResource(xml_node<>* node, ZipArchive* pZip)
: Resource(node, pZip)
{
std::string file;
+ xml_attribute<>* attr;
mFont = NULL;
if (!node)
return;
- if (node->first_attribute("filename"))
- file = node->first_attribute("filename")->value();
+ attr = node->first_attribute("filename");
+ if (!attr)
+ return;
+
+ file = attr->value();
- if (ExtractResource(pZip, "fonts", file, ".dat", TMP_RESOURCE_NAME) == 0)
+#ifndef TW_DISABLE_TTF
+ if(file.size() >= 4 && file.compare(file.size()-4, 4, ".ttf") == 0)
{
- mFont = gr_loadFont(TMP_RESOURCE_NAME);
- unlink(TMP_RESOURCE_NAME);
+ m_type = TYPE_TTF;
+
+ attr = node->first_attribute("size");
+ if(!attr)
+ return;
+
+ int size = atoi(attr->value());
+ int dpi = 300;
+
+ attr = node->first_attribute("dpi");
+ if(attr)
+ dpi = atoi(attr->value());
+
+ if (ExtractResource(pZip, "fonts", file, "", TMP_RESOURCE_NAME) == 0)
+ {
+ mFont = gr_ttf_loadFont(TMP_RESOURCE_NAME, size, dpi);
+ unlink(TMP_RESOURCE_NAME);
+ }
+ else
+ {
+ file = std::string("/res/fonts/") + file;
+ mFont = gr_ttf_loadFont(file.c_str(), size, dpi);
+ }
}
else
+#endif
{
- mFont = gr_loadFont(file.c_str());
+ m_type = TYPE_TWRP;
+
+ if(file.size() >= 4 && file.compare(file.size()-4, 4, ".ttf") == 0)
+ {
+ attr = node->first_attribute("fallback");
+ if (!attr)
+ return;
+
+ file = attr->value();
+ }
+
+ if (ExtractResource(pZip, "fonts", file, ".dat", TMP_RESOURCE_NAME) == 0)
+ {
+ mFont = gr_loadFont(TMP_RESOURCE_NAME);
+ unlink(TMP_RESOURCE_NAME);
+ }
+ else
+ {
+ mFont = gr_loadFont(file.c_str());
+ }
}
}
FontResource::~FontResource()
{
+ if(mFont)
+ {
+#ifndef TW_DISABLE_TTF
+ if(m_type == TYPE_TTF)
+ gr_ttf_freeFont(mFont);
+ else
+#endif
+ gr_freeFont(mFont);
+ }
}
ImageResource::ImageResource(xml_node<>* node, ZipArchive* pZip)
diff --git a/gui/resources.hpp b/gui/resources.hpp
index 874836e52..3cb528176 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -38,6 +38,14 @@ typedef enum {
class FontResource : public Resource
{
public:
+ enum Type
+ {
+ TYPE_TWRP,
+#ifndef TW_DISABLE_TTF
+ TYPE_TTF,
+#endif
+ };
+
FontResource(xml_node<>* node, ZipArchive* pZip);
virtual ~FontResource();
@@ -46,6 +54,7 @@ public:
protected:
void* mFont;
+ Type m_type;
};
class ImageResource : public Resource
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index 5b4d57f1c..700d7d5d7 100644
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -198,7 +198,7 @@ GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
}
}
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, (unsigned*) &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
if(mShowCurr)
{
diff --git a/gui/text.cpp b/gui/text.cpp
index c594f4824..29d7ad948 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -97,7 +97,7 @@ GUIText::GUIText(xml_node<>* node)
mLastValue = parseText();
if (mLastValue != mText) mIsStatic = 0;
- gr_getFontDetails(mFont ? mFont->GetResource() : NULL, (unsigned*) &mFontHeight, NULL);
+ mFontHeight = gr_getMaxFontHeight(mFont ? mFont->GetResource() : NULL);
return;
}