Skip to content

Unicorn(s): Remove some Hershey fonts. #1025

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

Closed
wants to merge 1 commit into from
Closed
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
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