Giter Site home page Giter Site logo

fontawesome's Introduction


CRAN status R build status Package Site Coverage status

The project has reached a stable, usable state and is being actively developed. Monthly Downloads Total Downloads

Contributor Covenant


The fontawesome R package makes it very easy to insert Font Awesome icons into R Markdown documents and Shiny apps (or, anywhere else you need to put them).

Examples

The fa() function can be used to insert an FA icon. For example, we can get the r-project icon in steelblue:

fa(name = "r-project", fill = "steelblue")
#> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 581 512" class="rfa" style="height:0.75em;fill:steelblue;position:relative;"><path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"/></svg>

As can be seen, what we really get from the function is an SVG object that represents the icon. This can be directly used within R Markdown with:

{text} `r fa(...)` {text}

Font Awesome SVG icons are great to use instead of <i> tags + font files for a few reasons:

  • There is less overhead in a Shiny app or R Markdown document since an <i> tag requires computation to obtain the icon (<svg> tags represent the actual icon)
  • Using <i> tags has a 'being online' requirement since network activity is necessary for resolving these tags (SVGs in fontawesome are stored in the package, so, no Internet connectivity is necessary for that)
  • There are styling options available for SVG that aren't there for icon fonts

R Markdown

Here is an example R Markdown document that includes Font Awesome icons:

---
title: "Font Awesome in R Markdown"
output: html_document
---

```{r load_packages, message=FALSE, warning=FALSE, include=FALSE} 
library(fontawesome)
```

# Just a few tests with `r fa("font-awesome-logo-full", fill = "forestgreen")`

It works well in headings...

# `r fa("r-project", fill = "steelblue")` H1 Heading

## `r fa("r-project", fill = "steelblue")` H2 Heading

### `r fa("r-project", fill = "steelblue")` H3 Heading

#### `r fa("r-project", fill = "steelblue")` H4 Heading

##### `r fa("r-project", fill = "steelblue")` H5 Heading

...and works equally well within inline text: `r fa("r-project", fill = "steelblue")`.

This will appear, when knit, as:

Shiny

Here’s a Shiny app (from the Shiny Gallery) that’s been slightly modified to incorporate Font Awesome icons in the text above the three search fields:

library(shiny)
library(DT)
library(ggplot2)
library(fontawesome)

ui <- fluidPage(

  titlePanel("Basic DataTable"),

  # Create a new Row in the UI for selectInputs
  fluidRow(

    column(
      width = 4,
      selectInput(
        inputId = "man",
        label = tags$p(fa("car", fill = "purple"), "Manufacturer:"),
        choices = c(
          "All",
          unique(as.character(mpg$manufacturer))))
    ),

    column(
      width = 4,
      selectInput(
        inputId = "trans",
        label = tags$p(fa("car", fill = "forestgreen"), "Transmission:"),
        choices = c(
          "All",
          unique(as.character(mpg$trans))))
    ),

    column(
      width = 4,
      selectInput(
        inputId = "cyl",
        label = tags$p(fa("car", fill = "steelblue"), "Cylinders:"),
        choices = c(
          "All",
          unique(as.character(mpg$cyl))))
    )
  ),

  # Create a new row for the table.
  fluidRow(
    dataTableOutput("table")
  )
)

server <- function(input, output) {

  # Filter data based on selections
  output$table <- renderDataTable({

    data <- mpg
    if (input$man != "All") {
      data <- data[data$manufacturer == input$man,]
    }
    if (input$cyl != "All") {
      data <- data[data$cyl == input$cyl,]
    }
    if (input$trans != "All") {
      data <- data[data$trans == input$trans,]
    }
    data
  })
}

shinyApp(ui = ui, server = server)

The Shiny app will look something like this:

Please note that using shiny::icon() in place of fontawesome::fa() will still work. Internally, the icon() function will call fontawesome's fa_i() function, which generates an old-school <i> tag for the icon.

Installation

Want to try this out? The fontawesome package can be installed from CRAN:

install.packages("fontawesome")

Also, you can install the development version of fontawesome from GitHub:

devtools::install_github("rstudio/fontawesome")

If you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an issue.

Code of Conduct

Please note that the rstudio/fontawesome project is released with a contributor code of conduct.
By participating in this project you agree to abide by its terms.

🏛️ Governance

This project is primarily maintained by Rich Iannone. Other authors may occasionally assist with some of these duties.

fontawesome's People

Contributors

berrij avatar cderv avatar cpsievert avatar indrajeetpatil avatar jcheng5 avatar rich-iannone avatar schloerke avatar wch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fontawesome's Issues

Selectize example (not an issue)

Hello,

Here I did an example of font-awesome icons in the items of a selectizeInput.
This is not an issue, just wanted to share. And maybe you have some comments, perhaps an easier way ?

Cheers.

Feature request: inherit style of element

Right now if I leave the color blank fa("robot", fill=NULL) then the color ends up being #000000. I would really like it to be the color of whatever element it's contained in (like if it's in the middle of an h1 block then have it take the same color as that text). It doesn't seem like there is a way to do this--can that functionality be added?

Decimals not supported in width and height attributes

It looks like the function get_length_value_unit doesn't work with decimals (e.g. "1.5em"). I'd suggest modifying the regex a little bit. As a suggestion:

get_length_value_unit <- function(css_length) {

  if (!grepl("^[0-9]+(\\.[0-9]+)?[a-z]+$", css_length)) {

    stop(
      "Values provided to `height` and `width` must have a value followed by a length unit",
      call. = FALSE
    )
  }

  unit <- sub("^[0-9]+(\\.[0-9]+)?", "", css_length)

  if (!(unit %in% css_length_units)) {
    stop(
      "The provided CSS length unit is not valid.",
      call. = FALSE
    )
  }

  list(
    value = as.numeric(sub("[a-z]+$", "", css_length)),
    unit = unit
  )
}

Cheers.

Error: could not find function "file.edit"

devtools::install_github("rstudio/fontawesome")
Downloading GitHub repo rstudio/fontawesome@master
✔ checking for file ‘/private/var/folders/pm/v1r05mm553z8cv0t4p2x8cf00000gn/T/RtmpTAm6ML/remotes1715474502c28/rstudio-fontawesome-ba97af5/DESCRIPTION’ ...
─ preparing ‘fontawesome’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘fontawesome_0.1.0.tar.gz’

Error: could not find function "file.edit"
Execution halted
Error: Failed to install 'fontawesome' from GitHub:
(converted from warning) installation of package ‘/var/folders/pm/v1r05mm553z8cv0t4p2x8cf00000gn/T//RtmpTAm6ML/file171543b8331c0/fontawesome_0.1.0.tar.gz’ had non-zero exit status
Called from: value[3L]

Update styles

The fa_i function is using "fa" as the style (except when the name appears in the brands list). However, "fa" is depreciated in FontAwesome 5 (see https://fontawesome.com/v5.15/how-to-use/on-the-web/referencing-icons/basic-use). The default is now "fas". While "fa" currently will resolve to "fas", it is unclear for how long this will last. Additionally, there are other styles, such as "far" which do have free icons (e.g., "far fa-square") which are getting re-written (see #68). Perhaps a solution would be to add an argument for the style ("far", "fas", "fab", etc.) that has a default of "far" and a check/resolve against "fa".

Consider storing data in .R files instead of sysdata.rda

One drawback of using sysdata.rda is that every time we do an update, it results in the repo growing by ~800kB, because that's how big the sysdata.rda file is, and git can't store the changes efficiently, since the file is a compressed binary.

If we store the information as inline CSV data in a .R file, it will result in efficient diffs. Another significant benefit is that it makes the package smaller -- when I tried storing the data this way, the built source package was about 900KB, compared to 1.2MB when sysdata.rda is used.

This will also allow us to remove the .csv files from the data-raw directory, since that's essentially redundant information.

Here's a rough sketch of how to do it. I had to fiddle with the delimiter and quote escaping to make it happy (and I wasn't able to make the quotes come out right using readr)

load("R/sysdata.rda")

# Generate the semicolon-delimited content in a textConnection, and save to a
# variable named csv_content.
tc <- textConnection("csv_content", "w")
write.table(fa_tbl, tc, sep = ";", row.names = FALSE, quote = FALSE)
close(tc)

cat('# Generated by fontawesome-update.R; do not edit by hand.
fa_tbl2 <- read.table(textConnection(
r"{',
  file = "fa_tbl.R")
cat(csv_content, file = "fa_tbl.R", sep = "\n", append = TRUE)
cat(
  '}"), header = TRUE, quote = "", sep = ";", stringsAsFactors = FALSE)\n',
  file = "fa_tbl.R",
  append = TRUE
)

source('fa_tbl.R')

Checking for differences, the types aren't the same, but it's OK.

waldo::compare(fa_tbl, fa_tbl2)
#> `old$min_x` is a double vector (0, 0, 0, 0, 0, ...)
#> `new$min_x` is an integer vector (0, 0, 0, 0, 0, ...)
#>
#> `old$min_y` is a double vector (0, 0, 0, 0, 0, ...)
#> `new$min_y` is an integer vector (0, 0, 0, 0, 0, ...)
#>
#> `old$width` is a double vector (448, 448, 640, 384, 512, ...)
#> `new$width` is an integer vector (448, 448, 640, 384, 512, ...)
#>
#> `old$height` is a double vector (512, 512, 512, 512, 512, ...)
#> `new$height` is an integer vector (512, 512, 512, 512, 512, ...)

The idea is that this code would go in the update script, and generate .R files in the R/ directory. It'll also be important in that script to check that the data going in and coming out are the same. (In the real script, we'd probably want to fix up the int/double types either before writing or after reading.)

Can't change right margin with margin_right

I noticed that all my icons were slightly pushed to the left with the newest version of fontawesome. I attempted to change this via the new margin_right argument and, well, nothing happened, no matter what value I used.

I delved a tiny bit into the code and as far as I can tell that argument is never used in within the fa() function. Instead the right margin is hard-coded at ".2em". Am I missing something?

Compiling for inline text but not headings?

Using the examples in the READMe, inserting an icon inline using:

r fa("r-project", fill = "steelblue")` my text

compiles as expected but as a heading, compiling fails suggesting missing arguments.

# `r fa("r-project", fill = "steelblue")` my text

! Argument of \@sectioncolor has an extra }.
<inserted text> 
                \par 
l.140 my text}{ my text}}\label{my-text}}

Allow fractional height and width attributes

Discussed in #71

Originally posted by tuttoaposto November 3, 2021
The function get_length_value_unit() supports integer length (e.g. 1em) but not fractional length (e.g. 0.88em) in V0.2.2. Is it possible to get this updated 🙏 and make fontawesome really awesome 🌟?? This can be achieved by, for example, changing

grepl("^[0-9]+[a-z]+$", css_length)
to
grepl("^[0-9]+[.][0-9]+)?[a-z]+$", css_length)

and

unit <- sub("^[0-9]+", "", css_length)
to
unit <- sub("^[0-9]+([.][0-9]+)?", "", css_length)

Thanks you!

Package size is very large

I just tried building the source package, and it's very large: 3897165 bytes.

There are a number of files that seem like they may not be necessary, notably tests/manual_tests/test.html, and many of the font files (I seem to remember that we only need one font file format?).

-rw-r--r--  0 winston staff    1312 Mar 17 10:44 fontawesome/DESCRIPTION
-rw-r--r--  0 winston staff      47 Mar  3 08:33 fontawesome/LICENSE
-rw-r--r--  0 winston staff     178 Mar 17 10:44 fontawesome/NAMESPACE
-rw-r--r--  0 winston staff     157 Mar  3 08:33 fontawesome/NEWS.md
drwxr-xr-x  0 winston staff       0 Mar 17 10:44 fontawesome/R/
-rw-r--r--  0 winston staff    7285 Mar 17 10:44 fontawesome/R/fa.R
-rw-r--r--  0 winston staff    1107 Mar 17 10:44 fontawesome/R/fa_html_dependency.R
-rw-r--r--  0 winston staff    5335 Mar 17 10:44 fontawesome/R/fa_i.R
-rw-r--r--  0 winston staff    2265 Mar 17 10:44 fontawesome/R/fa_metadata.R
-rw-r--r--  0 winston staff    2976 Mar  3 08:33 fontawesome/R/fa_png.R
-rw-r--r--  0 winston staff     428 Mar  3 08:33 fontawesome/R/knit_print.R
-rw-r--r--  0 winston staff     955 Mar 17 10:44 fontawesome/R/print.R
-rw-r--r--  0 winston staff  792391 Mar 17 10:44 fontawesome/R/sysdata.rda
-rw-r--r--  0 winston staff     868 Mar 17 10:44 fontawesome/R/utils.R
-rw-r--r--  0 winston staff      81 Mar 17 10:44 fontawesome/R/version_fontawesome.R
-rw-r--r--  0 winston staff    1046 Mar 17 10:44 fontawesome/R/zzz.R
-rw-r--r--  0 winston staff    6619 Mar  3 08:33 fontawesome/README.md
-rw-r--r--  0 winston staff     330 Mar  3 08:35 fontawesome/fontawesome.sublime-project
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/apps/
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/apps/138-icon-fontawesome/
-rw-r--r--  0 winston staff    1097 Mar  3 08:33 fontawesome/inst/apps/138-icon-fontawesome/app.R
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/fontawesome/
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/fontawesome/css/
-rw-r--r--  0 winston staff   73625 Mar  3 08:33 fontawesome/inst/fontawesome/css/all.css
-rw-r--r--  0 winston staff   59344 Mar  3 08:33 fontawesome/inst/fontawesome/css/all.min.css
-rw-r--r--  0 winston staff   41312 Mar  3 08:33 fontawesome/inst/fontawesome/css/v4-shims.css
-rw-r--r--  0 winston staff   26702 Mar  3 08:33 fontawesome/inst/fontawesome/css/v4-shims.min.css
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/
-rw-r--r--  0 winston staff  136822 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-brands-400.eot
-rw-r--r--  0 winston staff  747545 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-brands-400.svg
-rw-r--r--  0 winston staff  136516 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-brands-400.ttf
-rw-r--r--  0 winston staff   92136 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-brands-400.woff
-rw-r--r--  0 winston staff   78472 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-brands-400.woff2
-rw-r--r--  0 winston staff   34350 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-regular-400.eot
-rw-r--r--  0 winston staff  144714 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-regular-400.svg
-rw-r--r--  0 winston staff   34052 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-regular-400.ttf
-rw-r--r--  0 winston staff   16776 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-regular-400.woff
-rw-r--r--  0 winston staff   13588 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-regular-400.woff2
-rw-r--r--  0 winston staff  204814 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-solid-900.eot
-rw-r--r--  0 winston staff  917575 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-solid-900.svg
-rw-r--r--  0 winston staff  204528 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-solid-900.ttf
-rw-r--r--  0 winston staff  104280 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-solid-900.woff
-rw-r--r--  0 winston staff   80252 Mar  3 08:33 fontawesome/inst/fontawesome/webfonts/fa-solid-900.woff2
drwxr-xr-x  0 winston staff       0 Mar 17 10:44 fontawesome/man/
-rw-r--r--  0 winston staff    3561 Mar 17 10:44 fontawesome/man/fa.Rd
-rw-r--r--  0 winston staff    1209 Mar 17 10:44 fontawesome/man/fa_html_dependency.Rd
-rw-r--r--  0 winston staff    2724 Mar 17 10:44 fontawesome/man/fa_i.Rd
-rw-r--r--  0 winston staff    1468 Mar 17 10:44 fontawesome/man/fa_metadata.Rd
-rw-r--r--  0 winston staff    1918 Mar  3 08:33 fontawesome/man/fa_png.Rd
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/man/figures/
-rw-r--r--  0 winston staff  179382 Mar  3 08:33 fontawesome/man/figures/fontawesome_rmd.png
-rw-r--r--  0 winston staff  406296 Mar  3 08:33 fontawesome/man/figures/fontawesome_shiny_app.png
-rw-r--r--  0 winston staff   99825 Mar  3 08:33 fontawesome/man/figures/logo.svg
-rw-r--r--  0 winston staff     588 Mar  3 08:33 fontawesome/man/print.fontawesome.Rd
drwxr-xr-x  0 winston staff       0 Mar  3 08:33 fontawesome/tests/
drwxr-xr-x  0 winston staff       0 Mar 17 10:44 fontawesome/tests/manual_tests/
-rw-r--r--  0 winston staff    1346 Mar 17 10:44 fontawesome/tests/manual_tests/shiny-test-fa.R
-rw-r--r--  0 winston staff    1352 Mar 17 10:44 fontawesome/tests/manual_tests/shiny-test-fa_i.R
-rw-r--r--  0 winston staff     695 Mar 17 10:44 fontawesome/tests/manual_tests/test.Rmd
-rw-r--r--  0 winston staff 2131253 Mar 17 10:44 fontawesome/tests/manual_tests/test.html
drwxr-xr-x  0 winston staff       0 Mar 17 10:44 fontawesome/tests/testthat/
-rw-r--r--  0 winston staff      66 Mar  3 08:33 fontawesome/tests/testthat.R
-rw-r--r--  0 winston staff    3981 Mar 17 10:44 fontawesome/tests/testthat/test-fa_icon.R

issue with Travis

Dear Rich,

Thanks for this package which solves a lot of non displaying icons issues in https://github.com/DivadNojnarg/bs4Dash.

However, since I included it in the imports of my package, I end up with a Travis building error:

Rscript -e 'deps <- devtools::dev_package_deps(dependencies = NA);devtools::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'
missing: fontawesome

Regards

David

Add testing of the internal `fa_tbl` object

An object that is regenerated often (table with FA icon metadata and SVG code) needs to be checked on an ongoing basis to ensure there are no irregularities in the source data or the processing code. Specifically there needs to be multiple checks for consistency across metadata and checks that the SVG is valid and is also consistent.

Full names not being respected in fa_i

Currently, full names of icons aren't being respected by the fa_i function. For example fa_i("far fa-sqaure") will get translated to <i class="fa fa-far fa-square"></i>. In essence, fa_i is prepending "fa" as the style and to the name, regardless of whether or not a full name is provided.

A solution would be examine whether the submitted name is a full name or shortened, potentially by checking whether there is a space in the name. If a full name is provided, then that should be used for the internal iconClass object rather than the paste0 output.

`fa_png()` silently fails if rsvg is not installed

For example (with rsvg not installed):

fontawesome::fa_png('r-project')
.Last.value
#> NULL

It should throw an error if rsvg is not installed (unless we have some other way to convert to png). The help page should also say that rsvg is required for this.

Rpres can't use fontawesome anymore

The following code doesn't work anymore in .Rpres (I put '' everywhere in order to turn off markdown formatting)

test1 ok
'===================================='
'{r}' 'iris[1:2,1:2]' ''

test2 ko
'===================================='
'<'p style="text-align:center">r fontawesome::fa("r-project", fill = "blue", height = "60px")</p'>'
'{r}' iris[1:2,1:2] ''

Error message :

Erreur dans if (to %in% c("html", "html4", "html5", "slidy", "revealjs", :

l'argument est de longueur nulle

Appels : knit ... inline_exec -> hook_eval -> knit_print -> knit_print.fontawesome

Integration with gt

This is a great (and underrated) package and I stumbled onto it pretty much by accident. I use gt quite a bit and it could benefit by some integration with this package. Are there plans to provide examples and/or expanded support for fontawesome in gt?

reduce dependencies

This set of dependencies seems quite large:

Imports:
    dplyr (>= 0.7.4),
    glue (>= 1.2.0),
    htmltools (>= 0.3.6),
    knitr (>= 1.20),
    magrittr,
    rlang (>= 0.2.0),
    stringr (>= 1.3.0)

It seems like for what we are doing here a much more minimal set of dependencies should be required. Could we pare this down?

Request: Functions to download newer/pro versions

It would be useful if this package had functions to download newer versions of Font-Awesome and store them in (say) rappdirs::user_data_dir().

Similarly, it would be nice to have a way for users to use Pro icons, providing that they've paid for them, of course.

The tricky part is that we'd want this to work with Rmds and Shiny apps that are deployed on remote servers.

Utilize fontawesome icon as a floating icon without the marker

Is it possible to place a fontawesome icon as simply a floating icon on my map, with no marker? Or is it possible to add a marker with no "tail" (so the marker is simply a circle/square/etc rather than a pin)? Basically, I want to utilize fontawesome icons on specific lat/long coordinates but do not want markers underneath them. From searching through stackoverflow, I do not seem to be the only one who has had this question, but I did not find any available solutions. Thank you!!

For example, I would want this to just be the briefcase hovering over these coordinates with either no marker or just a circle/square (with no "tail") underneath.

library(shiny)
library(leaflet)
library(fontawesome)

ui <- fluidPage(
    
    mainPanel(
      leafletOutput("map", height = 700),
      width = 9
    )
  )

server <- function(input, output) {
  
  awesomeIcon <- reactive({
    makeAwesomeIcon(icon = "briefcase", library = "fa", iconColor = "black")
  })


  output$map <- renderLeaflet({
    leaflet()%>%addProviderTiles("Esri.WorldGrayCanvas")%>%
      addAwesomeMarkers(lng = -74.96, lat = 39.77, icon = awesomeIcon(), popup = "test")
  })
  
}

shinyApp(ui = ui, server = server)
#> 
#> Listening on http://127.0.0.1:8461

Created on 2020-11-08 by the reprex package (v0.3.0)

Update LICENSE and LICENSE.md files

The LICENSE and LICENSE.md files require an update since the year value in both of those are 2018. Also, the company name needs an update as well.

unable to install fontawesome for rstudio in ubuntu 18.04

Hello,

I am new to R, and it is my first time trying to use it in linux. I am trying to run an app that I installed from shiny gallery. It uses font awesome.

I tried installing fontawesome using the command - devtools::install_github("rstudio/fontawesome")

But it fails.

I have tried using by installing emojifont and then doing load.fontawesome(), but in this case I am not able to use the fa() function.

I am not sure where is the issue? Is it something specific to linux? or is it something specific to the rstudio version I am using?

Any help from you will be greatly appreciated.

Minor, example shiny in README.md didn't output the table

Changed the server to below, to make it work:

server <- function(input, output) {
  # Filter data based on selections
  output$table <- renderDataTable({
    data <- mpg
    if (input$man != "All") {
      data <- data[data$manufacturer == input$man,]
    }
    if (input$cyl != "All") {
      data <- data[data$cyl == input$cyl,]
    }
    if (input$trans != "All") {
      data <- data[data$trans == input$trans,]
    }
    data
  })
}

Session:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.5.0       DT_0.16           waffle_0.7.0      extrafont_0.17   
[5] fontawesome_0.1.0 ggplot2_3.3.2    

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0   remotes_2.2.0      purrr_0.3.4       
 [4] colorspace_1.4-1   vctrs_0.3.4        generics_0.0.2    
 [7] testthat_2.3.2     usethis_1.6.3      htmltools_0.5.0   
[10] utf8_1.1.4         rlang_0.4.8        pkgbuild_1.1.0    
[13] pillar_1.4.6       later_1.1.0.1      glue_1.4.2        
[16] withr_2.3.0        RColorBrewer_1.1-2 sessioninfo_1.1.1 
[19] lifecycle_0.2.0    munsell_0.5.0      gtable_0.3.0      
[22] devtools_2.3.2     htmlwidgets_1.5.2  memoise_1.1.0     
[25] fastmap_1.0.1      callr_3.5.1        crosstalk_1.1.0.1 
[28] httpuv_1.5.4       ps_1.4.0           curl_4.3          
[31] fansi_0.4.1        Rttf2pt1_1.3.8     Rcpp_1.0.5        
[34] xtable_1.8-4       backports_1.1.10   scales_1.1.1      
[37] promises_1.1.1     desc_1.2.0         pkgload_1.1.0     
[40] jsonlite_1.7.1     mime_0.9           fs_1.5.0          
[43] gridExtra_2.3      digest_0.6.26      processx_3.4.4    
[46] dplyr_1.0.2        grid_4.0.2         rprojroot_1.3-2   
[49] cli_2.1.0          tools_4.0.2        magrittr_1.5      
[52] tibble_3.0.4       crayon_1.3.4       extrafontdb_1.0   
[55] pkgconfig_2.0.3    ellipsis_0.3.1     prettyunits_1.1.1 
[58] assertthat_0.2.1   rstudioapi_0.11    R6_2.4.1          
[61] compiler_4.0.2    

Release fontawesome 0.2.1

Prepare for release:

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

CRAN timeline?

@rich-iannone I just found this repo as I was searching for the best way to include fontawesome icons in rmarkdown docs. One option I found here is shown below. The fontawesome package looks very interesting as well. Could you perhaps comment on if/when the fontawsome package will be on CRAN?

```{r setup, include = FALSE}
htmltools::tagList(rmarkdown::html_dependency_font_awesome())
```

Allow icons to appear in RMarkdown PDF output

It would be good to have Font Awesome icons appear in LaTeX/PDF documents. This would probably involve converting the SVG icons to PNG/PDF, sizing the images correctly, and using knitr::include_graphics().

Release fontawesome 0.1.0

First release:

Prepare for release:

  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Update install instructions in README
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Combine efforts with icon package?

The icon package was created in October 2017 with identical usecase to this one. It even uses the same base function name: fa(). At the moment its scope is maybe slightly broader than this package with some additional icon sets.

Since icon is still under active maintenance, it might be worth seeing if the authors would accept PRs for anything you think is missing. At the very least it'd be polite to acknowledge the prior art in the README, even though it is probable you happened upon the same function name by coincidence.

Release fontawesome 0.2.2

Preparation

  • If not a new package, make sure any warnings/errors in CRAN check results page are fixed
  • Create branch labelled v[version]-rc, for example, v1.5.2-rc (the "rc" stands for "Release Candidate").
  • Commit and push to the RC branch.
  • usethis::use_version('patch')
  • Clean your package directory to remove any extraneous files, including ones that are git-ignored. (Warning, this will delete any unsaved buffers in RStudio! Also, be sure to close RStudio before taking this step!) Use git clean -xdf.
  • Build your package with:
    PATH=$PATH:/Applications/RStudio.app/Contents/MacOS/pandoc R CMD build [pkgdir]
  • Do a final check by installing/testing the built package.
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • rhub::check(platform = 'ubuntu-rchk')
  • revdepcheck::revdep_check(num_workers = 4)
  • urlchecker::url_check()
  • Polish NEWS
  • Run R CMD check --as-cran pkg_version.tar.gz locally
  • Read every bullet point in the CRAN Policies document if this is the first release of the package. Be sure to check off the items one by one.

Submission

  • Submit to CRAN via their online form at https://cran.r-project.org/submit.html
  • If there are R CMD check warnings that are unavoidable, make sure to explain them in the comments.
  • Approve email
  • If rejected, make changes on the RC branch and bump the fourth (patch) version component (i.e. 1.5.2.1)

After Acceptance

  • usethis::use_github_release()
  • usethis::use_dev_version()

Release fontawesome 0.2.0

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Warning in third party package shinymanager

I raised this issue:

datastorm-open/shinymanager#117 (comment)

which was closed because it supposedly is an issue with this package. Not sure what is correct.

The name provided ('sign-out') is deprecated in Font Awesome 5:

  • please consider using 'sign-out-alt' or 'fas fa-sign-out-alt' instead
  • use the verify_fa = FALSE to deactivate these messages
    This Font Awesome icon ('close') does not exist:
  • if providing a custom html_dependency these name checks can
    be deactivated with verify_fa = FALSE

SVG tags should be accessible

See "Better Accessibility" section in https://www.irigoyen.dev/blog/2021/02/17/stop-using-icon-fonts/

Some other resources:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Role_Img
https://www.deque.com/blog/creating-accessible-svgs/
https://www.tpgi.com/using-aria-enhance-svg-accessibility/

Maybe also allow users to pass in a title/tooltip/description. This is sort of orthogonal to accessibility per se, but could be handy for tooltips. For example:

icon("question", title = "This thing does x, y, z")

Icons are not at the right place in Windows, IE11

Install Fontawesome from cran and run shiny-test.R and test.Rmd from tests/manual_tests . Icons which were supposed to be left of the labels are on the right and there is lot of space in between.

CaptureIE11Rmd
CaptureIE11

placement of fa glyphs - web only? free only?

I'm having trouble placing an icon in a more-or-less in-line fashion (as a logo next a "Back to Top" link that takes the user to the #TOC bookmark). See the code quote below...

r fa("arrow-square-up", fill = "tomato")

...which yields no result on the page. However if I use "r-project" as the icon they all show. (see attached image)

Did I miss a memo on the glyphs that were available? Thanks!
h3portfoliositefontawesomer-projectsonly

Should have a function that reports included version of Font-Awesome

It would also be nice to have the version reported somewhere that's easily findable, like on the README, but it might be confusing if the README shows the version of FA in the dev version of this package, which could differ from the version included with the CRAN version. Although I suppose the README could say to look at README for tagged commits.

Move `master` branch to `main`

Cc @schloerke

The master branch of this repository will soon be renamed to main, as part of a coordinated change across several GitHub organizations (including, but not limited to: tidyverse, r-lib, tidymodels, and sol-eng). We anticipate this will happen by the end of September 2021.

That will be preceded by a release of the usethis package, which will gain some functionality around detecting and adapting to a renamed default branch. There will also be a blog post at the time of this master --> main change.

The purpose of this issue is to:

  • Help us firm up the list of targetted repositories
  • Make sure all maintainers are aware of what's coming
  • Give us an issue to close when the job is done
  • Give us a place to put advice for collaborators re: how to adapt

message id: entire_lizard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.