Setting San Francisco font in Style Sheet

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Setting San Francisco font in Style Sheet

Postby huber » Wed Feb 08, 2017 3:59 pm

I would like to add macOS system font San Francisco to the CSS style sheet. I tried to use font-family "San Francisco", also tried font-family: -apple-system,
but no luck so far. What would be the correct string?

Regards,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Setting San Francisco font in Style Sheet

Postby patrick » Wed Feb 08, 2017 4:08 pm

Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Setting San Francisco font in Style Sheet

Postby paronne » Wed Feb 08, 2017 4:30 pm

Hi, indeed check the comment in the link provided by Patrick.

None of the current answers -- including the accept one -- will use Apple's San Francisco font on systems that don't have it installed as the system font. Since the question isn't "how do I use the OS X system font on a webpage," the correct solution is to use web fonts:


You can include the San Francisco web fonts by adding this CSS

Code: Select all
/** Ultra Light */
@font-face {
  font-family: "San Francisco";
  font-weight: 100;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-ultralight-webfont.woff");
}

/** Thin */
@font-face {
  font-family: "San Francisco";
  font-weight: 200;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-thin-webfont.woff");
}

/** Regular */
@font-face {
  font-family: "San Francisco";
  font-weight: 400;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff");
}

/** Medium */
@font-face {
  font-family: "San Francisco";
  font-weight: 500;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-medium-webfont.woff");
}

/** Semi Bold */
@font-face {
  font-family: "San Francisco";
  font-weight: 600;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-semibold-webfont.woff");
}

/** Bold */
@font-face {
  font-family: "San Francisco";
  font-weight: 700;
  src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff");
}

* {
  font-family: "San Francisco"
}


Source: https://gist.github.com/AndrewBarba/2c0 ... ef30f5f55d
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 39 guests

cron