Last active
January 31, 2018 15:43
-
-
Save webfirmframework/5764d58608b97b91ade0a52bb9bcc690 to your computer and use it in GitHub Desktop.
Google Roboto css file converted to wffweb java css file ( https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900 )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file is contributed by one of the wffweb users but he doesn't like to publish his name. | |
*/ | |
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.Set; | |
import com.webfirmframework.wffweb.css.FontFamily; | |
import com.webfirmframework.wffweb.css.FontStyle; | |
import com.webfirmframework.wffweb.css.FontWeight; | |
import com.webfirmframework.wffweb.css.Src; | |
import com.webfirmframework.wffweb.css.UnicodeRange; | |
import com.webfirmframework.wffweb.css.core.CssProperty; | |
import com.webfirmframework.wffweb.css.file.CssBlock; | |
import com.webfirmframework.wffweb.css.file.CssFile; | |
@SuppressWarnings({ "serial", "unused" }) | |
public class RobotoCss extends CssFile { | |
private Set<FontWeight> fontWeights; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/ty9dfvLAziwdqQ2dHoyjphTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/frNV30OaYdlFRtH2VnZZdhTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/gwVJDERN2Amz39wrSoZ7FxTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/aZMswpodYeVhtRvuABJWvBTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/VvXUGKZXbHtX_S_VCTLpGhTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/e7MeVAyvogMqFwwl61PKhBTbgVql8nDJpwnrE27mub0.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin */ | |
private CssBlock latin100 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.ONE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.ONE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Thin'), local('Roboto-Thin'), url(https://fonts.gstatic.com/s/roboto/v15/2tsd397wLxj96qwHyNIkxPesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/0eC6fl06luXEYWpBSJvXCBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/Fl4y0QdOxyyTHEGMXX8kcRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/-L14Jk06m6pUHB-5mXQQnRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/I3S1wsgSg9YCurV6PUkTORJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/NYDWBdD4gIq26G5XYbHsFBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/Pru33qjShpZSmG3z6VYwnRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin */ | |
private CssBlock latin300 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.THREE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.THREE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v15/Hgo13k-tfSpn0qi1SFdUfVtXRa8TVwTICgirnJhmVJw.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/ek4gzZ-GeXAPcSbHtCeQI_esZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/mErvLBYg_cXG3rLvUsKT_fesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/-2n2p-_Y08sg57CNWQfKNvesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/u0TOpm082MNkS5K0Q4rhqvesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/NdF9MtnOpLzo-noMoG0miPesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/Fcx7Wwv8OzT71A3E1XOAjvesZW2xOQ-xsNqO47m55DA.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin */ | |
private CssBlock latin400 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FOUR_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FOUR_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v15/CWB0XYA8bzo0kSThX0UTuA.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/ZLqKeelYbATG60EpZBSDyxJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/oHi30kwQWvpCWqAhzHcCSBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/rGvHdJnr2l75qb0YND9NyBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/mx9Uck6uB63VIKFYnEMXrRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/mbmhprMH69Zi6eEPBYVFhRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/oOeFwZNlrTefzLYmlVV1UBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latin500 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.FIVE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.FIVE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Medium'), local('Roboto-Medium'), url(https://fonts.gstatic.com/s/roboto/v15/RxZJdnzeo3R5zSexge8UUVtXRa8TVwTICgirnJhmVJw.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/77FXFjRbGzN4aCrSFhlh3hJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/isZ-wbCXNKAbnjo6_TwHThJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/UX6i4JxQDm3fVTc1CPuwqhJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/jSN2CGVDbcVyCnfJfjSdfBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/PwZc-YbIL414wB9rB1IAPRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/97uahxiqZRoncBaCEI3aWxJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin */ | |
private CssBlock latin700 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.SEVEN_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.SEVEN_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v15/d-6IYplOFocCacKzxwXSOFtXRa8TVwTICgirnJhmVJw.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
/* cyrillic-ext */ | |
private CssBlock cyrillicExt900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/s7gftie1JANC-QmDJvMWZhJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F")); | |
} | |
}; | |
/* cyrillic */ | |
private CssBlock cyrillic900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/3Y_xCyt7TNunMGg0Et2pnhJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116")); | |
} | |
}; | |
/* greek-ext */ | |
private CssBlock greekExt900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/WeQRRE07FDkIrr29oHQgHBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+1F00-1FFF")); | |
} | |
}; | |
/* greek */ | |
private CssBlock greek900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/jyIYROCkJM3gZ4KV00YXOBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0370-03FF")); | |
} | |
}; | |
/* vietnamese */ | |
private CssBlock vietnamese900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/phsu-QZXz1JBv0PbFoPmEBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange("U+0102-0103, U+1EA0-1EF9, U+20AB")); | |
} | |
}; | |
/* latin-ext */ | |
private CssBlock latinExt900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/9_7S_tWeGDh5Pq3u05RVkhJtnKITppOI_IvcXXDNrsc.woff2) format('woff2')")); | |
cssProperties.add( | |
new UnicodeRange("U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF")); | |
} | |
}; | |
/* latin */ | |
private CssBlock latin900 = new CssBlock("@font-face") { | |
@Override | |
protected void load(Set<CssProperty> cssProperties) { | |
if (!fontWeights.contains(FontWeight.NINE_HUNDRED)) { | |
setExcludeCssBlock(true); | |
return; | |
} | |
FontFamily fontFamily = new FontFamily("Roboto"); | |
cssProperties.add(fontFamily); | |
cssProperties.add(FontStyle.NORMAL); | |
cssProperties.add(FontWeight.NINE_HUNDRED); | |
cssProperties.add(new Src( | |
"local('Roboto Black'), local('Roboto-Black'), url(https://fonts.gstatic.com/s/roboto/v15/mnpfi9pxYH-Go5UiibESIltXRa8TVwTICgirnJhmVJw.woff2) format('woff2')")); | |
cssProperties.add(new UnicodeRange( | |
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000")); | |
} | |
}; | |
public RobotoCss(FontWeight... fontWeights) { | |
this.fontWeights = new HashSet<FontWeight>(Arrays.asList(fontWeights)); | |
// if it is not set to true then the duplicate selector names will be | |
// removed | |
setOptimizeCssString(false); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; | |
import com.webfirmframework.wffweb.css.FontWeight; | |
public class Usage { | |
public static void main(String[] args) throws IOException { | |
RobotoCss robotoCss = new RobotoCss(FontWeight.values()); | |
{ | |
// prepends @CHARSET "UTF-8"; (the charset of the written bytes by | |
// toOutputStream methods) | |
robotoCss.setPrependCharset(true); | |
ByteArrayOutputStream os = new ByteArrayOutputStream(); | |
robotoCss.toOutputStream(os, StandardCharsets.UTF_8); | |
System.out.println(os.toString(StandardCharsets.UTF_8.name())); | |
} | |
System.out.println("\n--------------------------------\n"); | |
{ | |
System.out.println(robotoCss.toCssString(true)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Developers Guide to get started