mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Android TextRenderer: Add try {} around loading the Roboto font. Also improve an unrelated assert.
This commit is contained in:
parent
1ac580b726
commit
f1cbf1ba96
2 changed files with 11 additions and 7 deletions
|
@ -74,8 +74,8 @@ VulkanPushPool::Block VulkanPushPool::CreateBlock(size_t size) {
|
|||
_assert_(result == VK_SUCCESS);
|
||||
|
||||
result = vmaMapMemory(vulkan_->Allocator(), block.allocation, (void **)(&block.writePtr));
|
||||
_assert_msg_(result == VK_SUCCESS, "VulkanPushPool: Failed to map memory (result = %s)", VulkanResultToString(result));
|
||||
|
||||
_assert_msg_(result == VK_SUCCESS, "VulkanPushPool: Failed to map memory (result = %s, size = %d)", VulkanResultToString(result), (int)size);
|
||||
_assert_msg_(block.writePtr != nullptr, "VulkanPushPool: Failed to map memory on block of size %d", (int)block.size);
|
||||
return block;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,16 @@ public class TextRenderer {
|
|||
}
|
||||
|
||||
public static void init(Context ctx) {
|
||||
robotoCondensed = Typeface.createFromAsset(ctx.getAssets(), "Roboto-Condensed.ttf");
|
||||
if (robotoCondensed != null) {
|
||||
Log.i(TAG, "Successfully loaded Roboto Condensed");
|
||||
textPaint.setTypeface(robotoCondensed);
|
||||
} else {
|
||||
Log.e(TAG, "Failed to load Roboto Condensed");
|
||||
try {
|
||||
robotoCondensed = Typeface.createFromAsset(ctx.getAssets(), "Roboto-Condensed.ttf");
|
||||
if (robotoCondensed != null) {
|
||||
Log.i(TAG, "Successfully loaded Roboto Condensed");
|
||||
textPaint.setTypeface(robotoCondensed);
|
||||
} else {
|
||||
Log.e(TAG, "Failed to load Roboto Condensed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception when loading typeface. shouldn't happen but is reported. We just fall back." + e);
|
||||
}
|
||||
highContrastFontsEnabled = Settings.Secure.getInt(ctx.getContentResolver(), "high_text_contrast_enabled", 0) == 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue