Add Atkinson Hyperlegible Mono font support

PiperOrigin-RevId: 937799904
Change-Id: I89e4652cc45afdd9a55b3042395c4a56c70289fb
This commit is contained in:
Yuval Tassa
2026-06-25 00:15:35 -07:00
committed by Copybara-Service
parent 4b8a8fae92
commit b6a0db7a17
5 changed files with 62 additions and 0 deletions
@@ -0,0 +1,28 @@
# Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(MUJOCO_DEP_VERSION_atkinson_hyperlegible_mono
154d50362016cc3e873eb21d242cd0772384c8f9
CACHE STRING "Tag/version of `atkinson_hyperlegible_mono` to be fetched."
)
mark_as_advanced(MUJOCO_DEP_VERSION_atkinson_hyperlegible_mono)
include(FindOrFetch)
fetchpackage(
PACKAGE_NAME atkinson_hyperlegible_mono
GIT_REPO https://github.com/googlefonts/atkinson-hyperlegible-next-mono.git
GIT_TAG ${MUJOCO_DEP_VERSION_atkinson_hyperlegible_mono}
CUSTOM_CMAKE "${CMAKE_SOURCE_DIR}/cmake/third_party_deps/atkinson_hyperlegible_mono/CMakeLists.txt"
)
@@ -0,0 +1,15 @@
# Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Data-only package.
+7
View File
@@ -84,6 +84,13 @@ static void InitImGui(SDL_Window* window, float content_scale,
constexpr ImWchar icon_ranges[] = {0xf000, 0xf3ff, 0x000}; constexpr ImWchar icon_ranges[] = {0xf000, 0xf3ff, 0x000};
io.Fonts->AddFontFromMemoryTTF(data, size, 13.f, &icon_cfg, icon_ranges); io.Fonts->AddFontFromMemoryTTF(data, size, 13.f, &icon_cfg, icon_ranges);
ImFontConfig mono_cfg;
mono_cfg.FontDataOwnedByAtlas = false;
font = mju_openResource("", "font:AtkinsonHyperlegibleMono-Regular.ttf", nullptr,
nullptr, 0);
size = mju_readResource(font, const_cast<const void**>(&data));
io.Fonts->AddFontFromMemoryTTF(data, size, 14.f, &mono_cfg);
// Note: we purposefully do not "close" the font resources as ImGui may // Note: we purposefully do not "close" the font resources as ImGui may
// need them again to resize fonts. // need them again to resize fonts.
} }
+11
View File
@@ -17,6 +17,7 @@ cmake_minimum_required(VERSION 3.16)
include(third_party_deps/dear_imgui) include(third_party_deps/dear_imgui)
include(third_party_deps/implot) include(third_party_deps/implot)
include(third_party_deps/atkinson_hyperlegible_next) include(third_party_deps/atkinson_hyperlegible_next)
include(third_party_deps/atkinson_hyperlegible_mono)
include(third_party_deps/font_awesome) include(third_party_deps/font_awesome)
# Common configuration shared between mujoco_studio and mujoco_live. # Common configuration shared between mujoco_studio and mujoco_live.
@@ -81,6 +82,16 @@ function(configure_studio_target TARGET_NAME)
${STUDIO_ASSETS_DIR} ${STUDIO_ASSETS_DIR}
COMMENT "Copying fontawesome-webfont.ttf to build directory" COMMENT "Copying fontawesome-webfont.ttf to build directory"
) )
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${STUDIO_ASSETS_DIR}
COMMAND ${CMAKE_COMMAND}
-E copy
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../_deps/atkinson_hyperlegible_mono-src/fonts/ttf/AtkinsonHyperlegibleMono-Regular.ttf"
${STUDIO_ASSETS_DIR}/AtkinsonHyperlegibleMono-Regular.ttf
COMMENT "Copying AtkinsonHyperlegibleMono-Regular font to build directory"
)
# Filament backend requires additional files to be copied into an "assets" folder. # Filament backend requires additional files to be copied into an "assets" folder.
if(MUJOCO_USE_FILAMENT) if(MUJOCO_USE_FILAMENT)
+1
View File
@@ -143,6 +143,7 @@ var Module = {
"assets/fontawesome-webfont.ttf", "assets/fontawesome-webfont.ttf",
"assets/ibl.ktx", "assets/ibl.ktx",
"assets/AtkinsonHyperlegibleNext[wght].ttf", "assets/AtkinsonHyperlegibleNext[wght].ttf",
"assets/AtkinsonHyperlegibleMono-Regular.ttf",
"assets/pbr.filamat", "assets/pbr.filamat",
"assets/pbr_transparent.filamat", "assets/pbr_transparent.filamat",
"assets/pbr_packed.filamat", "assets/pbr_packed.filamat",