Skip to content

Commit

Permalink
Unicorn(s): Remove some Hershey fonts.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gadgetoid committed Oct 24, 2024
1 parent bdd3712 commit 943bc90
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libraries/hershey_fonts/hershey_fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ namespace hershey {
}

const font_t* font(std::string_view font) {
#ifdef PG_HERSHEY_LITE
if(font == "serif") return &timesr;
return &futural;
#else
if(font == "sans") return &futural;
else if(font == "gothic") return &gothgbt;
else if(font == "cursive") return &scripts;
else if(font == "serif_italic") return &timesi;
else if(font == "serif") return &timesr;
return &futural;
#endif
}

inline float deg2rad(float degrees) {
Expand Down
8 changes: 7 additions & 1 deletion micropython/modules/hershey_fonts/micropython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ target_include_directories(usermod_${MOD_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/hershey_fonts
)

target_link_libraries(usermod INTERFACE usermod_${MOD_NAME})
target_link_libraries(usermod INTERFACE usermod_${MOD_NAME})

function(hershey_lite)
target_compile_definitions(usermod_${MOD_NAME} INTERFACE
PG_HERSHEY_LITE=1
)
endfunction()
3 changes: 3 additions & 0 deletions micropython/modules/micropython-cosmic_unicorn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)

# Pico Graphics Essential
include(hershey_fonts/micropython)
# We need to save ~3k somewhere,
# and Hershey fonts don't make sense on these boards
hershey_lite()
include(bitmap_fonts/micropython)
include(picographics/micropython)

Expand Down
3 changes: 3 additions & 0 deletions micropython/modules/micropython-galactic_unicorn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)

# Pico Graphics Essential
include(hershey_fonts/micropython)
# We need to save ~3k somewhere,
# and Hershey fonts don't make sense on these boards
hershey_lite()
include(bitmap_fonts/micropython)
include(picographics/micropython)

Expand Down
3 changes: 3 additions & 0 deletions micropython/modules/micropython-stellar_unicorn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ include(pimoroni_bus/micropython)

# Pico Graphics Essential
include(hershey_fonts/micropython)
# We need to save ~3k somewhere,
# and Hershey fonts don't make sense on these boards
hershey_lite()
include(bitmap_fonts/micropython)
include(picographics/micropython)

Expand Down

0 comments on commit 943bc90

Please sign in to comment.