Skip to content
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

Change logo font and improve rendering workflow #45

Merged
merged 1 commit into from
Feb 3, 2025
Merged
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
Binary file modified docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/scripts/logo-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions docs/scripts/logo.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
sysfonts::font_add_google("Zilla Slab", "pf", regular.wt = 500)

hexSticker::sticker(
subplot = ~ plot.new(),
s_x = 1,
s_y = 1,
s_width = 0.1,
s_height = 0.1,
package = "tinytopics",
package = "",
p_x = 1,
p_y = 1,
p_size = 26,
h_size = 1.2,
p_family = "pf",
p_color = "#3F8CCC",
h_fill = "#FFF9F2",
h_color = "#3F8CCC",
Expand Down
44 changes: 43 additions & 1 deletion docs/scripts/logo.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
#!/bin/bash

# Generate logo
# Generate logo background
Rscript docs/scripts/logo.R
if [ -f "Rplots.pdf" ]; then
rm Rplots.pdf
fi

# Generate text image and compose with background due to
# limited ligatures support in hexSticker and ImageMagick.
if [[ "$OSTYPE" == "darwin"* ]]; then
CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
CHROME_BIN="/c/Program Files/Google/Chrome/Application/chrome.exe"
else
CHROME_BIN="/usr/bin/google-chrome"
fi

if [ ! -f "$CHROME_BIN" ]; then
echo "Chrome/Chromium not found at $CHROME_BIN"
exit 1
fi

alias chrome="\"$CHROME_BIN\""

chrome --headless \
--disable-gpu \
--no-margins \
--no-pdf-header-footer \
--print-to-pdf-no-header \
--print-to-pdf=docs/scripts/logo-text.pdf \
docs/scripts/logo-text.svg

pdfcrop --quiet \
docs/scripts/logo-text.pdf docs/scripts/logo-text.pdf

magick -density 2000 docs/scripts/logo-text.pdf \
-resize 25% \
-alpha set -background none -channel A \
-evaluate multiply 1.3 +channel \
-transparent white \
docs/scripts/logo-text.png

magick docs/assets/logo.png docs/scripts/logo-text.png \
-gravity center \
-geometry +5-0 \
-composite docs/assets/logo.png

rm docs/scripts/logo-text.pdf docs/scripts/logo-text.png

# Optimize PNG
pngquant docs/assets/logo.png \
--force \
Expand Down