0

I'm trying to add a custum font from a local .ttf file and then deploy it into shinyapps.io

Inside my app directory i have a www folder that contains 'font.ttf' and a style.css that looks as follows:

@font-face {  

src: url(www/font.ttf);

font-family: "font.ttf";

}


/* main header */

.skin-blue .main-header .logo {

font-family: "mexecellent";

font-size: 12px;

}

Then I include it inside my shiny app as follows

tags$head(includeCSS("www/style.css"))

However there is NO change in the text fonts.

I would really apprecciate some help.

2 Answers2

0

I would try:

@font-face {  
  src: url(font.ttf);
  font-family: myfont;
}

/* main header */
.skin-blue .main-header .logo {
  font-family: myfont;
  font-size: 12px;
}
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
0

After lots of research I found out thhat this was some issue regarding both browser compatibility and css syntax.

The code that worked was

@font-face {  

font-family: 'mexecellent';

src: url('mexcellent.ttf') format('truetype'),

     url('mexcellent.woff') format('woff');

}

As suggested in this answer How to include a font .ttf using CSS?