Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to a prettier font #28

Merged
merged 4 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added fonts/Ubuntu-B.ttf
Binary file not shown.
Binary file added fonts/UbuntuMono-R.ttf
Binary file not shown.
15 changes: 15 additions & 0 deletions fonts/meshviewer.fontdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
font UIText
{
type truetype
source Ubuntu-B.ttf
size 15
resolution 96
}

font LogText
{
type truetype
source UbuntuMono-R.ttf
size 15
resolution 96
}
15 changes: 5 additions & 10 deletions ogre_mesh_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,6 @@ def locateResources(self):
# use parent implementation to locate system-wide RTShaderLib
OgreBites.ApplicationContext.locateResources(self)

# allow override by local resources.cfg
if not self.getFSLayer().fileExists("resources.cfg"):
# look for SdkTrays.zip from the installation. On Windows there is a local resources.cfg
trays_loc = os.path.dirname(self.getFSLayer().getConfigFilePath("resources.cfg"))
trays_loc += "/Media/packs/SdkTrays.zip"
rgm.addResourceLocation(trays_loc, "Zip", RGN_MESHVIEWER)

if self.rescfg:
cfg = Ogre.ConfigFile()
cfg.loadDirect(self.rescfg)
Expand All @@ -516,6 +509,9 @@ def locateResources(self):
# explicitly add mesh location to be safe
if not rgm.resourceLocationExists(self.filedir, Ogre.RGN_DEFAULT):
rgm.addResourceLocation(self.filedir, "FileSystem", Ogre.RGN_DEFAULT)

# add fonts to default resource group
rgm.addResourceLocation(os.path.dirname(__file__) + "/fonts", "FileSystem", RGN_MESHVIEWER)

def loadResources(self):
rgm = Ogre.ResourceGroupManager.getSingleton()
Expand Down Expand Up @@ -555,9 +551,8 @@ def setup(self):
# for picking
self.ray_query = scn_mgr.createRayQuery(Ogre.Ray())

imgui_overlay.addFont("SdkTrays/Value", RGN_MESHVIEWER)
self.logwin.font = ImGui.GetIO().Fonts.AddFontDefault()
self.logwin.font.Scale = round(pixel_ratio)
imgui_overlay.addFont("UIText", RGN_MESHVIEWER)
self.logwin.font = imgui_overlay.addFont("LogText", RGN_MESHVIEWER)

imgui_overlay.show()
Ogre.Overlay.OverlayManager.getSingleton().addOverlay(imgui_overlay)
Expand Down