Skip to content

Commit

Permalink
Change to a prettier font (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillermo Ojea Quintana <[email protected]>
Co-authored-by: Pavel Rojtberg <[email protected]>
  • Loading branch information
3 people authored Feb 25, 2024
1 parent 0671dc4 commit 6219af8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
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

0 comments on commit 6219af8

Please sign in to comment.