fix(Luciole): only use woff files

This commit is contained in:
Jérémy Dufraisse 2023-02-17 15:53:50 +01:00
parent 3c7abddd2d
commit 4108eeaabe
22 changed files with 126 additions and 16767 deletions

View File

@ -10,7 +10,7 @@
/* ----------------------------- */
@import url('../fonts/vendor/icomoon-free-npm/icomoon.css');
@import url('../fonts/luciole/webfonts.css');
@import url('../fonts/vendor/Luciole/Luciole.css');
@import url('animation.css');
:root {

View File

@ -1,15 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta content="en-us" http-equiv="Content-Language"/>
<title>Luciole - Web Font Specimen</title>
<link rel="stylesheet" type="text/css" media="screen" href="Luciole-Regular.css" />
<style type="text/css" media="screen">
body { font-size: 42px; font-family: "Luciole", Georgia; }
</style>
</head>
<body>
<p contenteditable="true">The quick brown fox jumps over the lazy dog. $123.45!</p>
</body>
</html>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 496 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,27 +0,0 @@
/* Webfont: Luciole */
@font-face {
font-family: 'Luciole';
src: url('luciole-regular.eot');
src: url('luciole-regular.eot?#iefix') format('embedded-opentype'),
url('luciole-regular.woff') format('woff'),
url('luciole-regular.woff2') format('woff2'),
url('luciole-regular.ttf') format('truetype'),
url('luciole-regular.svg#luciole-regular') format('svg');
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
}
@font-face {
font-family: 'Luciole';
src: url('luciole-bold.eot');
src: url('luciole-bold.eot?#iefix') format('embedded-opentype'),
url('luciole-bold.woff') format('woff'),
url('luciole-bold.woff2') format('woff2'),
url('luciole-bold.ttf') format('truetype'),
url('luciole-bold.svg#luciole-bold') format('svg');
font-style: normal;
font-weight: bold;
text-rendering: optimizeLegibility;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

34
fonts/vendor/Luciole/Luciole.css vendored Normal file
View File

@ -0,0 +1,34 @@
/* Webfont: Luciole */
/* Webfont: Luciole-Regular */
@font-face {
font-family: 'Luciole';
src: url('./Luciole-Regular/Luciole-Regular.woff') format('woff');
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
}
/* Webfont: Luciole-Italic */
@font-face {
font-family: 'Luciole';
src: url('./Luciole-Italic/Luciole-Italic.woff') format('woff');
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
}
/* Webfont: Luciole-Bold */
@font-face {
font-family: 'Luciole';
src: url('./Luciole-Bold/Luciole-Bold.woff') format('woff');
font-style: normal;
font-weight: bold;
text-rendering: optimizeLegibility;
}
/* Webfont: Luciole-BoldItalic */
@font-face {
font-family: 'Luciole';
src: url('./Luciole-BoldItalic/Luciole-BoldItalic.woff') format('woff');
font-style: italic;
font-weight: bold;
text-rendering: optimizeLegibility;
}

View File

@ -99,10 +99,93 @@ fs.writeFileSync(
)
const execSync = require('child_process').execSync;
const output = execSync('node node_modules/ttf2woff/ttf2woff.js node_modules/icomoon-free-npm/Font/IcoMoon-Free.ttf fonts/vendor/icomoon-free-npm/IcoMoon-Free.woff', { encoding: 'utf-8' });
console.log('Output was:\n', output);
execSync('node node_modules/ttf2woff/ttf2woff.js node_modules/icomoon-free-npm/Font/IcoMoon-Free.ttf fonts/vendor/icomoon-free-npm/IcoMoon-Free.woff', { encoding: 'utf-8' });
// font Luciole
fetch('https://www.luciole-vision.com/Fichiers/Luciole_webfonts.zip')
.then((response)=>{
if (!response.ok){
throw 'response not ok'
} else {
}
})
const http = require('http');
let src = 'node_modules/Luciole/'
let currentPath = path.join(basePath, src)
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath,{recursive :true})
}
const zipPath = path.join(currentPath,'Luciole_webfonts.zip')
const file = fs.createWriteStream(zipPath)
const request = http.get("http://www.luciole-vision.com/Fichiers/Luciole_webfonts.zip", function(response) {
response.pipe(file)
response.on('end', () => {
setTimeout(()=>{
var AdmZip = require("adm-zip")
var zip = new AdmZip(zipPath)
zip.extractAllTo(/*target path*/ currentPath, /*overwrite*/ true)
},500)
})
});
copySync(
'node_modules/Luciole/Luciole_webfonts/Read Me.txt',
'fonts/vendor/Luciole/Read Me.txt',
{ overwrite: true }
)
var arr = [
{
name:'Luciole-Regular',
style:'normal',
weight:'normal'
},
{
name:'Luciole-Italic',
style:'italic',
weight:'normal'
},
{
name:'Luciole-Bold',
style:'normal',
weight:'bold'
},
{
name:'Luciole-BoldItalic',
style:'italic',
weight:'bold'
}
]
let css = "/* Webfont: Luciole */\n\n"
arr.forEach((data)=>{
let name = data.name
copySync(
`node_modules/Luciole/Luciole_webfonts/${name}/${name}.woff`,
`fonts/vendor/Luciole/${name}/${name}.woff`,
{ overwrite: true }
)
css +=
`/* Webfont: ${name} */
@font-face {
font-family: 'Luciole';
src: url('./${name}/${name}.woff') format('woff');
font-style: ${data.style};
font-weight: ${data.weight};
text-rendering: optimizeLegibility;
}
`
})
fs.writeFileSync(
path.join(
basePath,
'fonts/vendor/Luciole/Luciole.css'
),
css
)
// example

View File

@ -4,6 +4,7 @@
},
"dependencies": {},
"devDependencies": {
"adm-zip": "^0.5.10",
"fs-extra": "^11.1.0",
"icomoon-free-npm": "^0.0.0",
"knacss": "https://github.com/alsacreations/KNACSS",

View File

@ -7,6 +7,11 @@
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
integrity sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==
adm-zip@^0.5.10:
version "0.5.10"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.10.tgz#4a51d5ab544b1f5ce51e1b9043139b639afff45b"
integrity sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==
alphanum-sort@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"