njtierney / syn

syn - the thesaurus
http://syn.njtierney.com/
51 stars 4 forks source link

create hex sticker #21

Closed njtierney closed 5 years ago

njtierney commented 5 years ago

Here's the current code:

logo_text <- paste0(syn::syn("synonym"), collapse = ", ") %>%
  clipr::write_clip()

# paste into keynote and fiddle with a hex border

library(magick)
#> Linking to ImageMagick 6.9.9.39
#> Enabled features: cairo, fontconfig, freetype, lcms, pango, rsvg, webp
#> Disabled features: fftw, ghostscript, x11

# here::here("syn-hex/syn-hex-words.png")

img_syn <- image_read("/Users/ntie0001/github/njtierney/scratchpad/syn-hex/syn-hex-words.png") %>%
  image_trim() %>%
  image_transparent(color = "white")

print(img_syn)
#>   format width height colorspace matte filesize density
#> 1    PNG   579    669       sRGB  TRUE        0   72x72

library(showtext)
#> Loading required package: sysfonts
#> Loading required package: showtextdb
## Loading Google fonts (http://www.google.com/fonts)
# font_add_google("Gochi Hand", "gochi")
# font_add_google("Schoolbell", "bell")
# font_add_google("Lobster", "lobster")
# font_add_google("Happy Monkey", "monkey")
# font_add_google("Fira Sans", "fira")
# font_add_google("Just Another Hand", "hand1")
# font_add_google("Indie Flower", "indie")
font_add_google("Great Vibes", "vibes")

hexSticker::sticker(subplot = img_syn,
                    s_x = 1,
                    s_y = 1,
                    s_width = 1.75,
                    s_height = 1.75,
                    package = "Syn",
                    p_x = 1,
                    p_y = 1.1,
                    p_color = "black",
                    p_family = "vibes",
                    p_size = 20,
                    h_size = 1.2,
                    h_fill = "#ffffff",
                    h_color = "#000000",
                    filename = "syn-hex/syn-hex.png")
#> Error in grDevices::dev.off(): QuartzBitmap_Output - unable to open file 'syn-hex/syn-hex.png'

image_read("/Users/ntie0001/github/njtierney/scratchpad/syn-hex/syn-hex.png")

Created on 2018-11-27 by the reprex package (v0.2.1)