Verified Commit ce647465 authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Merge branch 'preprod'

parents 132d537c 0e67ee32
Pipeline #1741 passed with stages
in 1 minute and 43 seconds
...@@ -64,23 +64,56 @@ app.use(function(req, res, next) { ...@@ -64,23 +64,56 @@ app.use(function(req, res, next) {
next(); next();
}); });
// {name: filepath} // {name: {filepath, offset}}
let fonts = { let fonts = {
'FiraSans': 'FiraSans-Regular.otf', 'FiraSans': {
'bilbo-inc': 'BilboINC.ttf', path: 'FiraSans-Regular.otf',
'bluu-next': 'BluuNext-Bold.otf', offset: 0
'combat': 'Combat.otf', },
'gulax': 'Gulax.otf', 'bilbo-inc': {
'lineal': 'Lineal.otf', path: 'BilboINC.ttf',
'resistance': 'Resistance.otf', offset: 10
'savate': 'savate-regular.otf', },
'solid-mirage': 'SolideMirageMono.otf', 'bluu-next': {
'steps-mono': 'Steps-Mono.otf', path: 'BluuNext-Bold.otf',
'terminal': 'terminal-grotesque_open.otf' offset: 0
},
'combat': {
path: 'Combat.otf',
offset: 0
},
'gulax': {
path: 'Gulax.otf',
offset: 10
},
'lineal': {
path: 'Lineal.otf',
offset: 4
},
'resistance': {
path: 'Resistance.otf',
offset: 2
},
'savate': {
path: 'savate-regular.otf',
offset: 10
},
'solid-mirage': {
path: 'SolideMirageMono.otf',
offset: 0
},
'steps-mono': {
path: 'Steps-Mono.otf',
offset: 10
},
'terminal': {
path: 'terminal-grotesque_open.otf',
offset: 15
}
}; };
for (let i in fonts) { for (let i in fonts) {
Canvas.registerFont('./static/fonts/' + fonts[i], {family: i}); Canvas.registerFont('./static/fonts/' + fonts[i].path, {family: i});
} }
Canvas.registerFont('./static/fonts/FiraSans-Bold.otf', {family: 'FiraSans', weight: 'bold'}); Canvas.registerFont('./static/fonts/FiraSans-Bold.otf', {family: 'FiraSans', weight: 'bold'});
...@@ -125,7 +158,7 @@ app.get('/generate.png', function (req, res) { ...@@ -125,7 +158,7 @@ app.get('/generate.png', function (req, res) {
ctx.fillText(_('et libertés.'), width * 0.08, height * 0.2 + fontSize * 2.8); ctx.fillText(_('et libertés.'), width * 0.08, height * 0.2 + fontSize * 2.8);
ctx.font = fontSize + 'pt ' + req.args.font; ctx.font = fontSize + 'pt ' + req.args.font;
ctx.fillStyle = req.args.fgColor; ctx.fillStyle = req.args.fgColor;
ctx.fillText(req.args.text, width * 0.08, height * 0.2 + fontSize * 1.4); ctx.fillText(req.args.text, width * 0.08, height * 0.2 + fontSize * 1.4 + fonts[req.args.font].offset);
// Add footer // Add footer
ctx.fillStyle = 'white'; ctx.fillStyle = 'white';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment