Nicer font for ImGui overlay
This commit is contained in:
parent
eec6444e3d
commit
cf83c1b499
3 changed files with 19 additions and 0 deletions
|
|
@ -59,6 +59,21 @@ namespace vks
|
||||||
// Create font texture
|
// Create font texture
|
||||||
unsigned char* fontData;
|
unsigned char* fontData;
|
||||||
int texWidth, texHeight;
|
int texWidth, texHeight;
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
float scale = (float)vks::android::screenDensity / (float)ACONFIGURATION_DENSITY_MEDIUM;
|
||||||
|
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, "Roboto-Medium.ttf", AASSET_MODE_STREAMING);
|
||||||
|
if (asset) {
|
||||||
|
size_t size = AAsset_getLength(asset);
|
||||||
|
assert(size > 0);
|
||||||
|
char *fontAsset = new char[size];
|
||||||
|
AAsset_read(asset, fontAsset, size);
|
||||||
|
AAsset_close(asset);
|
||||||
|
io.Fonts->AddFontFromMemoryTTF(fontAsset, size, 14.0f * scale);
|
||||||
|
delete[] fontAsset;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
io.Fonts->AddFontFromFileTTF("./../data/Roboto-Medium.ttf", 16.0f);
|
||||||
|
#endif
|
||||||
io.Fonts->GetTexDataAsRGBA32(&fontData, &texWidth, &texHeight);
|
io.Fonts->GetTexDataAsRGBA32(&fontData, &texWidth, &texHeight);
|
||||||
VkDeviceSize uploadSize = texWidth*texHeight * 4 * sizeof(char);
|
VkDeviceSize uploadSize = texWidth*texHeight * 4 * sizeof(char);
|
||||||
|
|
||||||
|
|
|
||||||
4
data/Robot-Medium-license.txt
vendored
Normal file
4
data/Robot-Medium-license.txt
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Roboto-Medium.ttf
|
||||||
|
Apache License 2.0
|
||||||
|
by Christian Robertson
|
||||||
|
https://fonts.google.com/specimen/Roboto
|
||||||
BIN
data/Roboto-Medium.ttf
vendored
Normal file
BIN
data/Roboto-Medium.ttf
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue