Skip to content

Commit 264f9f7

Browse files
committed
Unicorn(s): Remove some Hershey fonts.
Since Hershey fonts make virtually no sense on these low-resolution displays, remove all but Serif/Sans to make up for the additional flash usage of MicroPython 1.24.0 / Pico SDK 2.0.0.
1 parent 12b4e79 commit 264f9f7

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

libraries/hershey_fonts/hershey_fonts.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ namespace hershey {
2828
}
2929

3030
const font_t* font(std::string_view font) {
31+
#ifdef PG_HERSHEY_LITE
32+
if(font == "serif") return &timesr;
33+
return &futural;
34+
#else
3135
if(font == "sans") return &futural;
3236
else if(font == "gothic") return &gothgbt;
3337
else if(font == "cursive") return &scripts;
3438
else if(font == "serif_italic") return &timesi;
3539
else if(font == "serif") return &timesr;
3640
return &futural;
41+
#endif
3742
}
3843

3944
inline float deg2rad(float degrees) {

micropython/modules/hershey_fonts/micropython.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@ target_include_directories(usermod_${MOD_NAME} INTERFACE
1212
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/hershey_fonts
1313
)
1414

15-
target_link_libraries(usermod INTERFACE usermod_${MOD_NAME})
15+
target_link_libraries(usermod INTERFACE usermod_${MOD_NAME})
16+
17+
function(hershey_lite)
18+
target_compile_definitions(usermod_${MOD_NAME} INTERFACE
19+
PG_HERSHEY_LITE=1
20+
)
21+
endfunction()

micropython/modules/micropython-cosmic_unicorn.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)
1313

1414
# Pico Graphics Essential
1515
include(hershey_fonts/micropython)
16+
# We need to save ~3k somewhere,
17+
# and Hershey fonts don't make sense on these boards
18+
hershey_lite()
1619
include(bitmap_fonts/micropython)
1720
include(picographics/micropython)
1821

micropython/modules/micropython-galactic_unicorn.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)
1313

1414
# Pico Graphics Essential
1515
include(hershey_fonts/micropython)
16+
# We need to save ~3k somewhere,
17+
# and Hershey fonts don't make sense on these boards
18+
hershey_lite()
1619
include(bitmap_fonts/micropython)
1720
include(picographics/micropython)
1821

micropython/modules/micropython-stellar_unicorn.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)
1313

1414
# Pico Graphics Essential
1515
include(hershey_fonts/micropython)
16+
# We need to save ~3k somewhere,
17+
# and Hershey fonts don't make sense on these boards
18+
hershey_lite()
1619
include(bitmap_fonts/micropython)
1720
include(picographics/micropython)
1821

0 commit comments

Comments
 (0)